1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Split BattleAI::activeStack into several smaller methods

This commit is contained in:
Ivan Savenko
2023-07-18 16:29:02 +03:00
parent 5e8a778e7d
commit f27f5ebc7c
4 changed files with 170 additions and 138 deletions

View File

@ -774,6 +774,14 @@ BattleAction CPlayerInterface::activeStack(const CStack * stack) //called when i
logGlobal->trace("Awaiting command for %s", stack->nodeName());
auto stackId = stack->unitId();
auto stackName = stack->nodeName();
assert(!cb->battleIsFinished());
if (cb->battleIsFinished())
{
logGlobal->error("Received CPlayerInterface::activeStack after battle is finished!");
return BattleAction::makeDefend(stack);
}
if (autofightingAI)
{
if (isAutoFightOn)