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

Fixed crash at double attack, including #1202.

This commit is contained in:
DjWarmonger 2013-02-19 14:33:30 +00:00
parent 9492592a8f
commit a63b30e516

View File

@ -3462,17 +3462,20 @@ bool CGameHandler::makeBattleAction( BattleAction &ba )
for (int i = 0; i < totalAttacks; ++i)
{
if( stack &&stack->alive()) //move can cause death, eg. by walking into the moat
if (stack &&
stack->alive() && //move can cause death, eg. by walking into the moat
stackAtEnd->alive())
{
BattleAttack bat;
prepareAttack(bat, stack, stackAtEnd, distance, ba.additionalInfo);
prepareAttack(bat, stack, stackAtEnd, (i ? 0 : distance), ba.additionalInfo); //no distance travelled on second attack
//prepareAttack(bat, stack, stackAtEnd, 0, ba.additionalInfo);
handleAttackBeforeCasting(bat); //only before first attack
sendAndApply(&bat);
handleAfterAttackCasting(bat);
}
//counterattack
if(!stack->hasBonusOfType(Bonus::BLOCKS_RETALIATION)
if (!stack->hasBonusOfType(Bonus::BLOCKS_RETALIATION)
&& stackAtEnd->ableToRetaliate()
&& stack->alive()) //attacker may have died (fire shield)
{