1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Fix handling of turn order in case of player defeat

This commit is contained in:
Ivan Savenko
2023-08-24 13:36:35 +03:00
parent f451c15932
commit a19cdb57ba
5 changed files with 30 additions and 25 deletions

View File

@@ -3480,6 +3480,8 @@ void CGameHandler::checkVictoryLossConditionsForPlayer(PlayerColor player)
peg.victoryLossCheckResult = victoryLossCheckResult;
sendAndApply(&peg);
turnOrder->onPlayerEndsGame(player);
if (victoryLossCheckResult.victory())
{
//one player won -> all enemies lost
@@ -3545,13 +3547,6 @@ void CGameHandler::checkVictoryLossConditionsForPlayer(PlayerColor player)
}
checkVictoryLossConditions(playerColors);
}
auto playerInfo = getPlayerState(gs->currentPlayer, false);
// If we are called before the actual game start, there might be no current player
// If player making turn has lost his turn must be over as well
if (playerInfo && playerInfo->status != EPlayerStatus::INGAME)
turnOrder->onPlayerEndsTurn(gs->currentPlayer, PlayerTurnEndReason::GAME_END);
}
}