mapio: don't add description twice

This commit is contained in:
Ahmed Samy 2013-12-07 02:27:21 +02:00
parent 95610de5f3
commit 066638e7c0
2 changed files with 4 additions and 8 deletions

View File

@ -151,6 +151,7 @@ public:
void setHouseFile(const std::string& file) { m_attribs.set(OTBM_ATTR_HOUSE_FILE, file); } void setHouseFile(const std::string& file) { m_attribs.set(OTBM_ATTR_HOUSE_FILE, file); }
void setSpawnFile(const std::string& file) { m_attribs.set(OTBM_ATTR_SPAWN_FILE, file); } void setSpawnFile(const std::string& file) { m_attribs.set(OTBM_ATTR_SPAWN_FILE, file); }
void setDescription(const std::string& desc) { m_attribs.set(OTBM_ATTR_DESCRIPTION, desc); } void setDescription(const std::string& desc) { m_attribs.set(OTBM_ATTR_DESCRIPTION, desc); }
void clearDescriptions() { m_attribs.remove(OTBM_ATTR_DESCRIPTION); } void clearDescriptions() { m_attribs.remove(OTBM_ATTR_DESCRIPTION); }
void setWidth(uint16 w) { m_attribs.set(OTBM_ATTR_WIDTH, w); } void setWidth(uint16 w) { m_attribs.set(OTBM_ATTR_WIDTH, w); }
void setHeight(uint16 h) { m_attribs.set(OTBM_ATTR_HEIGHT, h); } void setHeight(uint16 h) { m_attribs.set(OTBM_ATTR_HEIGHT, h); }

View File

@ -284,15 +284,10 @@ void Map::saveOtbm(const std::string& fileName)
root->startNode(OTBM_MAP_DATA); root->startNode(OTBM_MAP_DATA);
{ {
const auto& descvec = getDescriptions();
for(const auto& desc : descvec) {
root->addU8(OTBM_ATTR_DESCRIPTION); root->addU8(OTBM_ATTR_DESCRIPTION);
root->addString(desc); root->addString(stdext::format("%s\nSaved with %s v%s",
} m_attribs.get<std::string>(OTBM_ATTR_DESCRIPTION),
g_app.getName(), g_app.getVersion()));
// special one
root->addU8(OTBM_ATTR_DESCRIPTION);
root->addString(stdext::format("Saved with %s v%s", g_app.getName(), g_app.getVersion()));
// spawn file. // spawn file.
root->addU8(OTBM_ATTR_SPAWN_FILE); root->addU8(OTBM_ATTR_SPAWN_FILE);