From 50e3f620188b7b9be4f63fe2475ce03385785a2d Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 1 Apr 2021 13:05:49 +0300 Subject: [PATCH] 3.13.12-patch1 --- buildSrc/src/main/kotlin/BuildConfig.kt | 4 +-- .../com/unciv/ui/worldscreen/WorldScreen.kt | 34 ++++++++----------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/buildSrc/src/main/kotlin/BuildConfig.kt b/buildSrc/src/main/kotlin/BuildConfig.kt index 681c5fac5f..530003441d 100644 --- a/buildSrc/src/main/kotlin/BuildConfig.kt +++ b/buildSrc/src/main/kotlin/BuildConfig.kt @@ -3,8 +3,8 @@ package com.unciv.build object BuildConfig { const val kotlinVersion = "1.4.30" const val appName = "Unciv" - const val appCodeNumber = 552 - const val appVersion = "3.13.12" + const val appCodeNumber = 553 + const val appVersion = "3.13.12-patch1" const val gdxVersion = "1.9.14" const val roboVMVersion = "2.3.1" diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index 18d1c8aa08..1af7a80357 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -138,6 +138,13 @@ class WorldScreen(val gameInfo: GameInfo, val viewingCiv:CivilizationInfo) : Cam mapHolder.setCenterPosition(tileToCenterOn, true, true) + tutorialController.allTutorialsShowedCallback = { shouldUpdate = true } + + onBackButtonClicked { backButtonAndESCHandler() } + + addKeyboardListener() // for map panning by W,S,A,D + + if (gameInfo.gameParameters.isOnlineMultiplayer && !gameInfo.isUpToDate) isPlayersTurn = false // until we're up to date, don't let the player do anything @@ -148,17 +155,10 @@ class WorldScreen(val gameInfo: GameInfo, val viewingCiv:CivilizationInfo) : Cam // isDaemon = true, in order to not block the app closing // DO NOT use Timer() since this seems to (maybe?) translate to com.badlogic.gdx.utils.Timer? Not sure about this. multiPlayerRefresher = timer("multiPlayerRefresh", true, period = 10000) { - if (game.screen != this@WorldScreen) multiPlayerRefresher?.cancel() - else loadLatestMultiplayerState() + loadLatestMultiplayerState() } } - tutorialController.allTutorialsShowedCallback = { shouldUpdate = true } - - onBackButtonClicked { backButtonAndESCHandler() } - - addKeyboardListener() // for map panning by W,S,A,D - // 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 @@ -241,8 +241,11 @@ class WorldScreen(val gameInfo: GameInfo, val viewingCiv:CivilizationInfo) : Cam val latestGame = OnlineMultiplayer().tryDownloadGame(gameInfo.gameId) // if we find it still isn't player's turn...nothing changed - if (gameInfo.isUpToDate && gameInfo.currentPlayer == latestGame.currentPlayer) { + if (gameInfo.currentPlayer == latestGame.currentPlayer) { Gdx.app.postRunnable { loadingGamePopup.close() } + // edge case - if there's only one player in a multiplayer game, we still check online, but it could be that we were correct and it is our turn + isPlayersTurn = latestGame.currentPlayer == viewingCiv.civName + shouldUpdate = true return } else { //else we found it is the player's turn again, turn off polling and load turn stopMultiPlayerRefresher() @@ -312,8 +315,6 @@ class WorldScreen(val gameInfo: GameInfo, val viewingCiv:CivilizationInfo) : Cam techPolicyAndVictoryHolder.setPosition(10f, topBar.y - techPolicyAndVictoryHolder.height - 5f) updateDiplomacyButton(viewingCiv) - isPlayersTurn = viewingCiv == gameInfo.currentPlayerCiv - if (!hasOpenPopups() && isPlayersTurn) { when { !gameInfo.oneMoreTurnMode && (viewingCiv.isDefeated() || gameInfo.civilizations.any { it.victoryManager.hasWon() }) -> @@ -381,16 +382,11 @@ class WorldScreen(val gameInfo: GameInfo, val viewingCiv:CivilizationInfo) : Cam displayTutorial(Tutorial.Introduction) displayTutorial(Tutorial.EnemyCityNeedsConqueringWithMeleeUnit) { - // diplomacy is a HashMap, cities a List - so sequences should help - // .flatMap { it.getUnits().asSequence() } is not a good idea because getUnits constructs an ArrayList dynamically viewingCiv.diplomacy.values.asSequence() .filter { it.diplomaticStatus == DiplomaticStatus.War } - .map { it.otherCiv() } - // we're now lazily enumerating over CivilizationInfo's we're at war with - .flatMap { it.cities.asSequence() } - // ... all *their* cities - .filter { it.health == 1 } - // ... those ripe for conquering + .map { it.otherCiv() } // we're now lazily enumerating over CivilizationInfo's we're at war with + .flatMap { it.cities.asSequence() } // ... all *their* cities + .filter { it.health == 1 } // ... those ripe for conquering .flatMap { it.getCenterTile().getTilesInDistance(2).asSequence() } // ... all tiles around those in range of an average melee unit // -> and now we look for a unit that could do the conquering because it's ours