mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
Fix the SACRIFICE fix regression
(crach if stack die on counter attack)
This commit is contained in:
parent
4e60b4cf53
commit
d042b08682
@ -5441,8 +5441,9 @@ void CGameHandler::runBattle()
|
||||
else
|
||||
{
|
||||
logGlobal->traceStream() << "Activating " << next->nodeName();
|
||||
auto nextId = next->ID;
|
||||
BattleSetActiveStack sas;
|
||||
sas.stack = next->ID;
|
||||
sas.stack = nextId;
|
||||
sendAndApply(&sas);
|
||||
|
||||
auto actionWasMade = [&]() -> bool
|
||||
@ -5459,7 +5460,8 @@ void CGameHandler::runBattle()
|
||||
while(!actionWasMade())
|
||||
{
|
||||
battleMadeAction.cond.wait(lock);
|
||||
next = gs->curB->battleActiveStack(); //it may change while we wait
|
||||
if(battleGetStackByID(nextId, false) != next)
|
||||
next = nullptr; //it may be removed, while we wait
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5469,10 +5471,11 @@ void CGameHandler::runBattle()
|
||||
breakOuter = true;
|
||||
break;
|
||||
}
|
||||
|
||||
//we're after action, all results applied
|
||||
checkForBattleEnd(); //check if this action ended the battle
|
||||
|
||||
if(next != nullptr)
|
||||
{
|
||||
//check for good morale
|
||||
nextStackMorale = next->MoraleVal();
|
||||
if(!vstd::contains(next->state,EBattleStackState::HAD_MORALE) //only one extra move per turn possible
|
||||
@ -5498,7 +5501,7 @@ void CGameHandler::runBattle()
|
||||
++numberOfAsks; //move this stack once more
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
--numberOfAsks;
|
||||
} while (numberOfAsks > 0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user