1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fix crash during auto battle

This commit is contained in:
edeksumo 2015-11-24 20:55:11 +01:00
parent ba1062ed3c
commit aab5a05036

View File

@ -1304,9 +1304,6 @@ DLL_LINKAGE void StartAction::applyGs( CGameState *gs )
{
CStack *st = gs->curB->getStack(ba.stackNumber);
if(vstd::contains(st->state, EBattleStackState::DEFENDING_ANIM))
st->state -= EBattleStackState::DEFENDING_ANIM;
if(ba.actionType == Battle::END_TACTIC_PHASE)
{
gs->curB->tacticDistance = 0;
@ -1332,15 +1329,18 @@ DLL_LINKAGE void StartAction::applyGs( CGameState *gs )
switch(ba.actionType)
{
case Battle::DEFEND:
st->state -= EBattleStackState::DEFENDING_ANIM;
st->state.insert(EBattleStackState::DEFENDING);
st->state.insert(EBattleStackState::DEFENDING_ANIM);
break;
case Battle::WAIT:
st->state -= EBattleStackState::DEFENDING_ANIM;
st->state.insert(EBattleStackState::WAITING);
return;
case Battle::HERO_SPELL: //no change in current stack state
return;
default: //any active stack action - attack, catapult, heal, spell...
st->state -= EBattleStackState::DEFENDING_ANIM;
st->state.insert(EBattleStackState::MOVED);
break;
}