mirror of
https://github.com/vcmi/vcmi.git
synced 2026-06-19 22:57:37 +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:
+10
-1
@@ -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