mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
Fix the case of invalid native town type :?
This commit is contained in:
parent
61ed22f553
commit
68a2bb78a5
@ -130,7 +130,17 @@ void initTerrainType(Zone & zone, CMapGenerator & gen)
|
||||
{
|
||||
if(zone.isMatchTerrainToTown() && zone.getTownType() != ETownType::NEUTRAL)
|
||||
{
|
||||
zone.setTerrainType((*VLC->townh)[zone.getTownType()]->nativeTerrain);
|
||||
auto terrainType = (*VLC->townh)[zone.getTownType()]->nativeTerrain;
|
||||
|
||||
if (terrainType <= ETerrainId::NONE)
|
||||
{
|
||||
logGlobal->warn("Town %s has invalid terrain type: %s", zone.getTownType(), terrainType);
|
||||
zone.setTerrainType(ETerrainId::DIRT);
|
||||
}
|
||||
else
|
||||
{
|
||||
zone.setTerrainType(terrainType);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user