Пример #1
0
bool Materials::unserializeTileset(xmlNodePtr node, wxArrayString& warnings)
{
	std::string strVal;

	if(readXMLString(node, "name", strVal))
	{
		Tileset* ts;
		TilesetContainer::iterator iter = tilesets.find(strVal);
		if(iter != tilesets.end())
		{
			ts = iter->second;
		}
		else
		{
			ts = newd Tileset(brushes, strVal);
			tilesets.insert(make_pair(strVal, ts));
		}

		xmlNodePtr child = node->children;
		while(child)
		{
			ts->loadCategory(child, warnings);
			child = child->next;
		}
	}
	else
	{
		warnings.push_back(wxT("Couldn't read tileset name"));
		return false;
	}
	return true;
}
Пример #2
0
bool Materials::unserializeTileset(pugi::xml_node node, wxArrayString& warnings)
{
	pugi::xml_attribute attribute;
	if(!(attribute = node.attribute("name"))) {
		warnings.push_back("Couldn't read tileset name");
		return false;
	}

	const std::string& name = attribute.as_string();

	Tileset* tileset;
	auto it = tilesets.find(name);
	if(it != tilesets.end()) {
		tileset = it->second;
	} else {
		tileset = newd Tileset(g_brushes, name);
		tilesets.insert(std::make_pair(name, tileset));
	}

	for(pugi::xml_node childNode = node.first_child(); childNode; childNode = childNode.next_sibling()) {
		tileset->loadCategory(childNode, warnings);
	}
	return true;
}