mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-22 22:00:24 +07:00
One player in each round will be processed even if all players are defeated. (#10788)
This commit is contained in:
@ -362,11 +362,25 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
|
|||||||
|
|
||||||
val isOnline = gameParameters.isOnlineMultiplayer
|
val isOnline = gameParameters.isOnlineMultiplayer
|
||||||
|
|
||||||
|
// Skip the player if we are playing hotseat
|
||||||
|
// If all hotseat players are defeated then skip all but the first one
|
||||||
|
fun shouldAutoProcessHotseatPlayer(): Boolean =
|
||||||
|
!isOnline &&
|
||||||
|
player.isDefeated() && (civilizations.any { it.isHuman() && it.isAlive() }
|
||||||
|
|| civilizations.first { it.isHuman() } != player)
|
||||||
|
|
||||||
|
// Skip all spectators and defeated players
|
||||||
|
// If all players are defeated then let the first player control next turn
|
||||||
|
fun shouldAutoProcessOnlinePlayer(): Boolean =
|
||||||
|
isOnline && (player.isSpectator() || player.isDefeated() &&
|
||||||
|
(civilizations.any { it.isHuman() && it.isAlive() }
|
||||||
|
|| civilizations.first { it.isHuman() } != player))
|
||||||
|
|
||||||
// We process player automatically if:
|
// We process player automatically if:
|
||||||
while (isSimulation() || // simulation is active
|
while (isSimulation() || // simulation is active
|
||||||
player.isAI() || // or player is AI
|
player.isAI() || // or player is AI
|
||||||
player.isDefeated() ||
|
shouldAutoProcessHotseatPlayer() || // or a player is defeated in hotseat
|
||||||
isOnline && player.isSpectator()) // or player is online spectator
|
shouldAutoProcessOnlinePlayer()) // or player is online spectator
|
||||||
{
|
{
|
||||||
|
|
||||||
// Starting preparations
|
// Starting preparations
|
||||||
@ -391,12 +405,12 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
|
|||||||
if (turns == DebugUtils.SIMULATE_UNTIL_TURN)
|
if (turns == DebugUtils.SIMULATE_UNTIL_TURN)
|
||||||
DebugUtils.SIMULATE_UNTIL_TURN = 0
|
DebugUtils.SIMULATE_UNTIL_TURN = 0
|
||||||
|
|
||||||
// We found human player, so we are making him current
|
// We found a human player, so we are making them current
|
||||||
currentTurnStartTime = System.currentTimeMillis()
|
currentTurnStartTime = System.currentTimeMillis()
|
||||||
currentPlayer = player.civName
|
currentPlayer = player.civName
|
||||||
currentPlayerCiv = getCivilization(currentPlayer)
|
currentPlayerCiv = getCivilization(currentPlayer)
|
||||||
|
|
||||||
// Starting his turn
|
// Starting their turn
|
||||||
TurnManager(player).startTurn(progressBar)
|
TurnManager(player).startTurn(progressBar)
|
||||||
|
|
||||||
// No popups for spectators
|
// No popups for spectators
|
||||||
|
Reference in New Issue
Block a user