mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
CGameState::battleGetBattlefieldType: avoid crash on tile 0,0,0
Fix issue 2524
This commit is contained in:
@ -953,7 +953,7 @@ void CGameState::initDuel()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
curB = BattleInfo::setupBattle(int3(), dp.terType, dp.bfieldType, armies, heroes, false, town);
|
curB = BattleInfo::setupBattle(int3(-1,-1,-1), dp.terType, dp.bfieldType, armies, heroes, false, town);
|
||||||
curB->obstacles = dp.obstacles;
|
curB->obstacles = dp.obstacles;
|
||||||
curB->localInit();
|
curB->localInit();
|
||||||
}
|
}
|
||||||
@ -1908,9 +1908,9 @@ void CGameState::initVisitingAndGarrisonedHeroes()
|
|||||||
|
|
||||||
BFieldType CGameState::battleGetBattlefieldType(int3 tile, CRandomGenerator & rand)
|
BFieldType CGameState::battleGetBattlefieldType(int3 tile, CRandomGenerator & rand)
|
||||||
{
|
{
|
||||||
if(tile==int3() && curB)
|
if(!tile.valid() && curB)
|
||||||
tile = curB->tile;
|
tile = curB->tile;
|
||||||
else if(tile==int3() && !curB)
|
else if(!tile.valid() && !curB)
|
||||||
return BFieldType::NONE;
|
return BFieldType::NONE;
|
||||||
|
|
||||||
const TerrainTile &t = map->getTile(tile);
|
const TerrainTile &t = map->getTile(tile);
|
||||||
|
Reference in New Issue
Block a user