From de3160c90db0060f9ab43f2343a2600d6e2c01a1 Mon Sep 17 00:00:00 2001 From: BrunoDCC Date: Fri, 11 Oct 2013 02:35:31 -0300 Subject: [PATCH 1/2] Save houses and spawns fix --- src/client/creatures.cpp | 5 ++--- src/client/houses.cpp | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/client/creatures.cpp b/src/client/creatures.cpp index 3b827614..5da0a842 100644 --- a/src/client/creatures.cpp +++ b/src/client/creatures.cpp @@ -266,9 +266,8 @@ void CreatureManager::saveSpawns(const std::string& fileName) root->LinkEndChild(elem); } - std::string savePath = g_resources.getRealPath(fileName); - if(!doc.SaveFile(savePath)) - stdext::throw_exception(stdext::format("failed to save spawns XML %s: %s", savePath, doc.ErrorDesc())); + if(!doc.SaveFile("data"+fileName)) + stdext::throw_exception(stdext::format("failed to save spawns XML %s: %s", fileName, doc.ErrorDesc())); } catch(std::exception& e) { g_logger.error(stdext::format("Failed to save '%s': %s", fileName, e.what())); } diff --git a/src/client/houses.cpp b/src/client/houses.cpp index 8cf7d5e8..5109d5d2 100644 --- a/src/client/houses.cpp +++ b/src/client/houses.cpp @@ -178,9 +178,8 @@ void HouseManager::save(const std::string& fileName) root->LinkEndChild(elem); } - std::string savePath = g_resources.getRealPath(fileName); - if(!doc.SaveFile(savePath)) - stdext::throw_exception(stdext::format("failed to save houses XML %s: %s", savePath, doc.ErrorDesc())); + if(!doc.SaveFile("data"+fileName)) + stdext::throw_exception(stdext::format("failed to save houses XML %s: %s", fileName, doc.ErrorDesc())); } catch(std::exception& e) { g_logger.error(stdext::format("Failed to save '%s': %s", fileName, e.what())); } From 63ce68b449e4be21dba6cd3820d888ee7d83ed41 Mon Sep 17 00:00:00 2001 From: Ahmed Samy Date: Sat, 12 Oct 2013 11:38:30 +0200 Subject: [PATCH 2/2] mapio: make sure we read the house tile flag --- src/client/mapio.cpp | 2 ++ src/client/tile.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client/mapio.cpp b/src/client/mapio.cpp index 5da46593..2e57f9fb 100644 --- a/src/client/mapio.cpp +++ b/src/client/mapio.cpp @@ -137,6 +137,8 @@ void Map::loadOtbm(const std::string& fileName) if((_flags & TILESTATE_REFRESH) == TILESTATE_REFRESH) flags |= TILESTATE_REFRESH; + if((_flags & TILESTATE_HOUSE) == TILESTATE_HOUSE) + flags |= TILESTATE_HOUSE; break; } case OTBM_ATTR_ITEM: { diff --git a/src/client/tile.h b/src/client/tile.h index a44775d0..0ef41506 100644 --- a/src/client/tile.h +++ b/src/client/tile.h @@ -119,7 +119,7 @@ public: void setHouseId(uint32 hid) { m_houseId = hid; } uint32 getHouseId() { return m_houseId; } - bool isHouseTile() const { return (m_flags & TILESTATE_HOUSE) == TILESTATE_HOUSE; } + bool isHouseTile() const { return m_houseId != 0 && (m_flags & TILESTATE_HOUSE) == TILESTATE_HOUSE; } TilePtr asTile() { return static_self_cast(); }