1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

CBattleInterface: fix crash on defeat in tactics phase. Fix issue 2440

It's possible to lose all mobile stacks if you move them on moat so tactics phase must end in that case.
This commit is contained in:
Arseniy Shestakov
2016-08-09 18:15:58 +03:00
parent 2bffd4e5c1
commit 3a1a6cf338

View File

@@ -1935,6 +1935,12 @@ void CBattleInterface::bTacticNextStack(const CStack *current /*= nullptr*/)
TStacks stacksOfMine = tacticianInterface->cb->battleGetStacks(CBattleCallback::ONLY_MINE);
vstd::erase_if(stacksOfMine, &immobile);
if(stacksOfMine.empty())
{
bEndTacticPhase();
return;
}
auto it = vstd::find(stacksOfMine, current);
if(it != stacksOfMine.end() && ++it != stacksOfMine.end())
stackActivated(*it);