* 'master' of https://github.com/BrunoDCC/otclient:
  Fix OTBM save Remove if(version > 1) { (it causes bug)
This commit is contained in:
Allan Ference 2013-08-09 14:54:09 +02:00
commit 914fe249ab
1 changed files with 9 additions and 4 deletions

View File

@ -295,10 +295,10 @@ void Map::saveOtbm(const std::string& fileName, const UIWidgetPtr&/* pbar*/)
root->addString(spawnFile); root->addString(spawnFile);
// house file. // house file.
if(version > 1) { //if(version > 1) {
root->addU8(OTBM_ATTR_HOUSE_FILE); root->addU8(OTBM_ATTR_HOUSE_FILE);
root->addString(houseFile); root->addString(houseFile);
} //}
int px = -1, py = -1, pz =-1; int px = -1, py = -1, pz =-1;
bool firstNode = true; bool firstNode = true;
@ -365,24 +365,29 @@ void Map::saveOtbm(const std::string& fileName, const UIWidgetPtr&/* pbar*/)
root->startNode(OTBM_TOWNS); root->startNode(OTBM_TOWNS);
for(const TownPtr& town : g_towns.getTowns()) { for(const TownPtr& town : g_towns.getTowns()) {
root->startNode(OTBM_TOWN);
root->addU32(town->getId()); root->addU32(town->getId());
root->addString(town->getName()); root->addString(town->getName());
Position townPos = town->getPos(); Position townPos = town->getPos();
root->addPos(townPos.x, townPos.y, townPos.z); root->addPos(townPos.x, townPos.y, townPos.z);
root->endNode();
} }
root->endNode(); root->endNode();
if(version > 1) { //if(version > 1) {
root->startNode(OTBM_WAYPOINTS); root->startNode(OTBM_WAYPOINTS);
for(const auto& it : m_waypoints) { for(const auto& it : m_waypoints) {
root->startNode(OTBM_WAYPOINT);
root->addString(it.second); root->addString(it.second);
Position pos = it.first; Position pos = it.first;
root->addPos(pos.x, pos.y, pos.z); root->addPos(pos.x, pos.y, pos.z);
}
root->endNode(); root->endNode();
} }
root->endNode();
//}
} }
root->endNode(); // OTBM_MAP_DATA root->endNode(); // OTBM_MAP_DATA
} }