浏览代码

Fix crash on winning game by capturing town that is victory condition
without defeating all enemies first

Ivan Savenko 9 月之前
父节点
当前提交
b946d36bb0
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      server/CGameHandler.cpp

+ 3 - 2
server/CGameHandler.cpp

@@ -3518,8 +3518,6 @@ void CGameHandler::checkVictoryLossConditionsForPlayer(PlayerColor player)
 		addStatistics(peg.statistic); // add last turn befor win / loss
 		sendAndApply(peg);
 
-		turnOrder->onPlayerEndsGame(player);
-
 		if (victoryLossCheckResult.victory())
 		{
 			//one player won -> all enemies lost
@@ -3547,6 +3545,9 @@ void CGameHandler::checkVictoryLossConditionsForPlayer(PlayerColor player)
 		}
 		else
 		{
+			// give turn to next player(s)
+			turnOrder->onPlayerEndsGame(player);
+
 			//copy heroes vector to avoid iterator invalidation as removal change PlayerState
 			auto hlp = p->getHeroes();
 			for (auto h : hlp) //eliminate heroes