1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Huge optimization based on profiling - cut generation time by almost half (Jebus XL+U).

This commit is contained in:
DjWarmonger
2016-08-09 10:12:13 +02:00
parent 08dccb4cc3
commit 7f0b852449
4 changed files with 43 additions and 14 deletions

View File

@@ -60,6 +60,8 @@ void CMapGenerator::initTiles()
tiles[i][j] = new CTileInfo[level];
}
}
zoneColouring.resize(boost::extents[map->twoLevel ? 2 : 1][map->width][map->height]);
}
CMapGenerator::~CMapGenerator()
@@ -697,6 +699,20 @@ CTileInfo CMapGenerator::getTile(const int3& tile) const
return tiles[tile.x][tile.y][tile.z];
}
TRmgTemplateZoneId CMapGenerator::getZoneID(const int3& tile) const
{
checkIsOnMap(tile);
return zoneColouring[tile.z][tile.x][tile.y];
}
void CMapGenerator::setZoneID(const int3& tile, TRmgTemplateZoneId zid)
{
checkIsOnMap(tile);
zoneColouring[tile.z][tile.x][tile.y] = zid;
}
bool CMapGenerator::isAllowedSpell(SpellID sid) const
{
assert(sid >= 0);