mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Converted terrainTypeHandler into proper handler class
This commit is contained in:
@@ -119,9 +119,9 @@ void initTerrainType(Zone & zone, CMapGenerator & gen)
|
||||
{
|
||||
//collect all water terrain types
|
||||
std::vector<TerrainId> waterTerrains;
|
||||
for(const auto & terrain : VLC->terrainTypeHandler->terrains())
|
||||
if(terrain.isWater())
|
||||
waterTerrains.push_back(terrain.id);
|
||||
for(const auto & terrain : VLC->terrainTypeHandler->objects)
|
||||
if(terrain->isWater())
|
||||
waterTerrains.push_back(terrain->id);
|
||||
|
||||
zone.setTerrainType(*RandomGeneratorUtil::nextItem(waterTerrains, gen.rand));
|
||||
}
|
||||
@@ -137,20 +137,20 @@ void initTerrainType(Zone & zone, CMapGenerator & gen)
|
||||
}
|
||||
|
||||
//Now, replace disallowed terrains on surface and in the underground
|
||||
const auto & terrainType = VLC->terrainTypeHandler->terrains()[zone.getTerrainType()];
|
||||
const auto & terrainType = VLC->terrainTypeHandler->getById(zone.getTerrainType());
|
||||
|
||||
if(zone.isUnderground())
|
||||
{
|
||||
if(!terrainType.isUnderground())
|
||||
if(!terrainType->isUnderground())
|
||||
{
|
||||
zone.setTerrainType(Terrain::SUBTERRANEAN);
|
||||
zone.setTerrainType(TerrainId::SUBTERRANEAN);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!terrainType.isSurface())
|
||||
if (!terrainType->isSurface())
|
||||
{
|
||||
zone.setTerrainType(Terrain::DIRT);
|
||||
zone.setTerrainType(TerrainId::DIRT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user