mirror of
https://github.com/vcmi/vcmi.git
synced 2025-09-16 09:26:28 +02:00
Add fallback for empty terrain types. Still it's a workaround and does not solve the root cause.
This commit is contained in:
@@ -134,7 +134,16 @@ void initTerrainType(Zone & zone, CMapGenerator & gen)
|
||||
}
|
||||
else
|
||||
{
|
||||
zone.setTerrainType(*RandomGeneratorUtil::nextItem(zone.getTerrainTypes(), gen.rand));
|
||||
auto terrainTypes = zone.getTerrainTypes();
|
||||
if (terrainTypes.empty())
|
||||
{
|
||||
logGlobal->warn("No terrain types found, falling back to DIRT");
|
||||
zone.setTerrainType(ETerrainId::DIRT);
|
||||
}
|
||||
else
|
||||
{
|
||||
zone.setTerrainType(*RandomGeneratorUtil::nextItem(terrainTypes, gen.rand));
|
||||
}
|
||||
}
|
||||
|
||||
//Now, replace disallowed terrains on surface and in the underground
|
||||
|
Reference in New Issue
Block a user