don't set bits twice

This commit is contained in:
Ahmed Samy 2013-11-12 20:05:15 +02:00
parent f04b4a0b42
commit 2b015d49d7
2 changed files with 3 additions and 2 deletions

View File

@ -41,6 +41,7 @@ House::House(uint32 hId, const std::string &name, const Position &pos)
void House::setTile(const TilePtr& tile) void House::setTile(const TilePtr& tile)
{ {
tile->setFlag(TILESTATE_HOUSE); tile->setFlag(TILESTATE_HOUSE);
tile->setHouseId(getId());
m_tiles.insert(std::make_pair(tile->getPosition(), tile)); m_tiles.insert(std::make_pair(tile->getPosition(), tile));
} }

View File

@ -179,8 +179,8 @@ void Map::loadOtbm(const std::string& fileName)
} }
if(const TilePtr& tile = getTile(pos)) { if(const TilePtr& tile = getTile(pos)) {
if(house) if(tile->hasFlag(TILESTATE_HOUSE))
tile->setHouseId(house->getId()); tile->setFlags(tile->getFlags() & ~TILESTATE_HOUSE);
tile->setFlags((tileflags_t)flags); tile->setFlags((tileflags_t)flags);
} }
} }