1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

* Fixed battle crash (if they're double wide creatures)

This commit is contained in:
beegee1 2012-10-19 13:16:14 +00:00
parent fcc66b7bb9
commit 2a50d8d464

View File

@ -2200,10 +2200,14 @@ bool AccessibilityInfo::accessible(BattleHex tile, bool doubleWide, bool attacke
// All hexes that stack would cover if standing on tile have to be accessible.
BOOST_FOREACH(auto hex, CStack::getHexes(tile, doubleWide, attackerOwned))
{
const bool markedAccessible = at(hex) == EAccessibility::ACCESSIBLE;
const bool gateAccessible = (at(hex) == EAccessibility::GATE) && !attackerOwned; //defender can always step on gate
if(!hex.isValid() || (!markedAccessible && !gateAccessible))
return false;
// If the hex is out of range then the tile isn't accessible
if(!hex.isValid())
return false;
// If we're no defender which step on gate and the hex isn't accessible, then the tile
// isn't accessible
else if(at(hex) != EAccessibility::ACCESSIBLE &&
!(at(hex) == EAccessibility::GATE && !attackerOwned))
return false;
}
return true;
}
@ -2345,4 +2349,4 @@ BattleAttackInfo BattleAttackInfo::reverse() const
ret.luckyHit = ret.ballistaDoubleDamage = ret.deathBlow = false;
return ret;
}
}