Sfoglia il codice sorgente

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.
Arseniy Shestakov 9 anni fa
parent
commit
3a1a6cf338
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  1. 6 0
      client/battle/CBattleInterface.cpp

+ 6 - 0
client/battle/CBattleInterface.cpp

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