Fixed "Game errors when loading game" - #1171

This commit is contained in:
Yair Morgenstern
2019-10-08 10:26:46 +03:00
parent c32f4bba56
commit 62310fa3d5

View File

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