diff --git a/core/src/com/unciv/logic/GameInfo.kt b/core/src/com/unciv/logic/GameInfo.kt index 30c535ae34..22f9ddfe06 100644 --- a/core/src/com/unciv/logic/GameInfo.kt +++ b/core/src/com/unciv/logic/GameInfo.kt @@ -362,11 +362,25 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion 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: while (isSimulation() || // simulation is active player.isAI() || // or player is AI - player.isDefeated() || - isOnline && player.isSpectator()) // or player is online spectator + shouldAutoProcessHotseatPlayer() || // or a player is defeated in hotseat + shouldAutoProcessOnlinePlayer()) // or player is online spectator { // Starting preparations @@ -391,12 +405,12 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion if (turns == DebugUtils.SIMULATE_UNTIL_TURN) 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() currentPlayer = player.civName currentPlayerCiv = getCivilization(currentPlayer) - // Starting his turn + // Starting their turn TurnManager(player).startTurn(progressBar) // No popups for spectators