Add 'GameKeepUnawareTiles' feature.

Remove tiles that we are not aware anymore by default.
This commit is contained in:
Nailson 2015-10-06 00:37:50 -03:00
parent 1686d8081b
commit d41fe195f4
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)