From 22b3997c28da4eb75c1b633625d5c006b17934d8 Mon Sep 17 00:00:00 2001 From: Xander Lenstra <71121390+xlenstra@users.noreply.github.com> Date: Tue, 7 Dec 2021 20:38:45 +0100 Subject: [PATCH] Band-aided a bug where players in multiplayer games were waiting for themselves. (#5768) --- core/src/com/unciv/logic/GameInfo.kt | 2 +- core/src/com/unciv/ui/worldscreen/WorldScreen.kt | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/GameInfo.kt b/core/src/com/unciv/logic/GameInfo.kt index f609de8676..5725b045f2 100644 --- a/core/src/com/unciv/logic/GameInfo.kt +++ b/core/src/com/unciv/logic/GameInfo.kt @@ -120,7 +120,7 @@ class GameInfo { } /** Get a civ by name - * @throws NoSuchElementException if no civ of than name is in the game (alive or dead)! */ + * @throws NoSuchElementException if no civ of that name is in the game (alive or dead)! */ fun getCivilization(civName: String) = civilizations.first { it.civName == civName } fun getCurrentPlayerCivilization() = currentPlayerCiv fun getCivilizationsAsPreviews() = civilizations.map { it.asPreview() }.toMutableList() diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index bbc4552f8f..1cceb955b5 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -335,7 +335,12 @@ class WorldScreen(val gameInfo: GameInfo, val viewingCiv:CivilizationInfo) : Bas val latestGame = OnlineMultiplayer().tryDownloadGame(gameInfo.gameId) // if we find the current player didn't change, don't update - if (gameInfo.currentPlayer == latestGame.currentPlayer) { + // Additionally, check if we are the current player, and in that case always stop + // This fixes a bug where for some reason players were waiting for themselves. + if (gameInfo.currentPlayer == latestGame.currentPlayer + && gameInfo.turns == latestGame.turns + && latestGame.currentPlayer != gameInfo.getPlayerToViewAs().civName + ) { Gdx.app.postRunnable { loadingGamePopup.close() } shouldUpdate = true return