From 62310fa3d55a55a8964820353b6ffa67d2cc0cb0 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 8 Oct 2019 10:26:46 +0300 Subject: [PATCH] Fixed "Game errors when loading game" - #1171 --- core/src/com/unciv/ui/worldscreen/WorldScreen.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index 9f44162dba..65402618f4 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -52,6 +52,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { private val notificationsScroll: NotificationsScroll var alertPopupIsOpen = false // if we have an alert popup and then we changed screens, the old one shouldn't affect us + var shouldUpdate=false init { topBar.setPosition(0f, stage.height - topBar.height) @@ -112,7 +113,6 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { } tileMapHolder.setCenterPosition(tileToCenterOn,true) - update() if(gameInfo.gameParameters.isOnlineMultiplayer && !gameInfo.isUpToDate) isPlayersTurn = false // until we're up to date, don't let the player do anything @@ -121,6 +121,10 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { loadLatestMultiplayerState() }, Actions.delay(10f)))) // delay is in seconds } + + // don't run update() directly, because the UncivGame.worldScreen should be set so that the city buttons and tile groups + // know what the viewing civ is. + shouldUpdate=true } fun loadLatestMultiplayerState(){ @@ -409,8 +413,6 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { } } - var shouldUpdate=false - override fun render(delta: Float) { // This is so that updates happen in the MAIN THREAD, where there is a GL Context,