mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-11 11:31:52 +02:00
Merge pull request #1772 from vcmi/fix_invalid_native_terrain
Fix the case of invalid native town type
This commit is contained in:
commit
a0de223901
@ -250,8 +250,8 @@ public:
|
||||
}
|
||||
|
||||
bool operator == (const Identifier & b) const { return num == b.num; }
|
||||
bool operator <= (const Identifier & b) const { return num >= b.num; }
|
||||
bool operator >= (const Identifier & b) const { return num <= b.num; }
|
||||
bool operator <= (const Identifier & b) const { return num <= b.num; }
|
||||
bool operator >= (const Identifier & b) const { return num >= b.num; }
|
||||
bool operator != (const Identifier & b) const { return num != b.num; }
|
||||
bool operator < (const Identifier & b) const { return num < b.num; }
|
||||
bool operator > (const Identifier & b) const { return num > b.num; }
|
||||
|
@ -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: %d", zone.getTownType(), terrainType);
|
||||
zone.setTerrainType(ETerrainId::DIRT);
|
||||
}
|
||||
else
|
||||
{
|
||||
zone.setTerrainType(terrainType);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user