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:
parent
ba1062ed3c
commit
aab5a05036
@ -1304,9 +1304,6 @@ DLL_LINKAGE void StartAction::applyGs( CGameState *gs )
|
|||||||
{
|
{
|
||||||
CStack *st = gs->curB->getStack(ba.stackNumber);
|
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)
|
if(ba.actionType == Battle::END_TACTIC_PHASE)
|
||||||
{
|
{
|
||||||
gs->curB->tacticDistance = 0;
|
gs->curB->tacticDistance = 0;
|
||||||
@ -1332,15 +1329,18 @@ DLL_LINKAGE void StartAction::applyGs( CGameState *gs )
|
|||||||
switch(ba.actionType)
|
switch(ba.actionType)
|
||||||
{
|
{
|
||||||
case Battle::DEFEND:
|
case Battle::DEFEND:
|
||||||
|
st->state -= EBattleStackState::DEFENDING_ANIM;
|
||||||
st->state.insert(EBattleStackState::DEFENDING);
|
st->state.insert(EBattleStackState::DEFENDING);
|
||||||
st->state.insert(EBattleStackState::DEFENDING_ANIM);
|
st->state.insert(EBattleStackState::DEFENDING_ANIM);
|
||||||
break;
|
break;
|
||||||
case Battle::WAIT:
|
case Battle::WAIT:
|
||||||
|
st->state -= EBattleStackState::DEFENDING_ANIM;
|
||||||
st->state.insert(EBattleStackState::WAITING);
|
st->state.insert(EBattleStackState::WAITING);
|
||||||
return;
|
return;
|
||||||
case Battle::HERO_SPELL: //no change in current stack state
|
case Battle::HERO_SPELL: //no change in current stack state
|
||||||
return;
|
return;
|
||||||
default: //any active stack action - attack, catapult, heal, spell...
|
default: //any active stack action - attack, catapult, heal, spell...
|
||||||
|
st->state -= EBattleStackState::DEFENDING_ANIM;
|
||||||
st->state.insert(EBattleStackState::MOVED);
|
st->state.insert(EBattleStackState::MOVED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user