示例#1
0
void TerrainDefaults::Load (const std::string & file, TextureRegistry & texReg) throw (std::runtime_error) {
	XML xml;
	xml.Load(file);
	xml.SelectSection("map");
	std::string defName = xml.GetValue("default");
	DefaultId = texReg.GetTextureId(defName);
	xml.SelectNode("terrain-types");
	for (bool res = xml.SelectNode("ttype"); res; res = xml.SelectNextNode ("ttype")) {
		Elements.push_back(Record());
		Elements.back().Name = xml.GetAttribute("name");
		Elements.back().Element.Load(xml, texReg);
	}
	Loaded = true;
}
示例#2
0
void Texture::Load (XML & xml) throw(std::runtime_error) {
	Name = xml.GetAttribute("name");
	LoadImage("tmp/" + xml.GetAttribute("path"));
	Loaded = true;
}