Band-aided a bug where players in multiplayer games were waiting for themselves. (#5768)

This commit is contained in:
Xander Lenstra
2021-12-07 20:38:45 +01:00
committed by GitHub
parent 24bd2b66b0
commit 22b3997c28
2 changed files with 7 additions and 2 deletions

View File

@ -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()

View File

@ -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