Merge pull request #690 from ottools/master

Add 'GameKeepUnawareTiles' feature.
This commit is contained in:
Sam 2015-10-06 15:12:37 +02:00
commit d9e8bfff4c
3 changed files with 28 additions and 0 deletions

View File

@ -132,6 +132,7 @@ GameUnjustifiedPoints = 68
GameSessionKey = 69
GameDeathType = 70
GameIdleAnimations = 71
GameKeepUnawareTiles = 72
TextColors = {
red = '#f55e5e', --'#c83200'

View File

@ -404,6 +404,7 @@ namespace Otc
GameSessionKey = 69,
GameDeathType = 70,
GameIdleAnimations = 71,
GameKeepUnawareTiles=72,
LastGameFeature = 101
};

View File

@ -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<uint, TileBlock>& 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)