diff --git a/modules/gamelib/const.lua b/modules/gamelib/const.lua index 828579b5..558c15c4 100644 --- a/modules/gamelib/const.lua +++ b/modules/gamelib/const.lua @@ -132,6 +132,7 @@ GameUnjustifiedPoints = 68 GameSessionKey = 69 GameDeathType = 70 GameIdleAnimations = 71 +GameKeepUnawareTiles = 72 TextColors = { red = '#f55e5e', --'#c83200' diff --git a/src/client/const.h b/src/client/const.h index d2d2c186..39947392 100644 --- a/src/client/const.h +++ b/src/client/const.h @@ -404,6 +404,7 @@ namespace Otc GameSessionKey = 69, GameDeathType = 70, GameIdleAnimations = 71, + GameKeepUnawareTiles=72, LastGameFeature = 101 }; diff --git a/src/client/map.cpp b/src/client/map.cpp index 343b0c2d..92578fe0 100644 --- a/src/client/map.cpp +++ b/src/client/map.cpp @@ -504,6 +504,32 @@ void Map::removeUnawareThings() else ++it; } + + if(!g_game.getFeature(Otc::GameKeepUnawareTiles)) { + // remove tiles that we are not aware anymore + for(int z = 0; z <= Otc::MAX_Z; ++z) { + std::unordered_map& tileBlocks = m_tileBlocks[z]; + for(auto it = tileBlocks.begin(); it != tileBlocks.end();) { + TileBlock& block = (*it).second; + bool blockEmpty = true; + for(const TilePtr& tile : block.getTiles()) { + if(!tile) + continue; + + const Position& pos = tile->getPosition(); + if(!isAwareOfPosition(pos)) + block.remove(pos); + else + blockEmpty = false; + } + + if(blockEmpty) + it = tileBlocks.erase(it); + else + ++it; + } + } + } } void Map::setCentralPosition(const Position& centralPosition)