mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-29 21:56:54 +02:00
CGameState::battleGetBattlefieldType: avoid crash on tile 0,0,0
Fix issue 2524
This commit is contained in:
parent
c5440a1c6c
commit
04eb0e3787
@ -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->localInit();
|
||||
}
|
||||
@ -1908,9 +1908,9 @@ void CGameState::initVisitingAndGarrisonedHeroes()
|
||||
|
||||
BFieldType CGameState::battleGetBattlefieldType(int3 tile, CRandomGenerator & rand)
|
||||
{
|
||||
if(tile==int3() && curB)
|
||||
if(!tile.valid() && curB)
|
||||
tile = curB->tile;
|
||||
else if(tile==int3() && !curB)
|
||||
else if(!tile.valid() && !curB)
|
||||
return BFieldType::NONE;
|
||||
|
||||
const TerrainTile &t = map->getTile(tile);
|
||||
|
Loading…
x
Reference in New Issue
Block a user