Exemplo n.º 1
0
static int loadxml(lua_State *state)
{
	const char *path = luaL_checkstring(state, -1);
	assert(path);
	XML obj;
	obj.Load(path);
	return 0;
}
Exemplo n.º 2
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;
}