From 567a9446adba18954caa79d08ab25f966f23bfc0 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 31 Mar 2020 23:10:48 +0300 Subject: [PATCH] Removed pre-3.0 deprecated fields - there's a limit to how long you can reasonably stay backwards-compatible to older saves --- core/src/com/unciv/logic/GameInfo.kt | 22 --------- .../logic/civilization/CivilizationInfo.kt | 7 --- .../unciv/logic/civilization/PopupAlert.kt | 2 - .../civilization/ScienceVictoryManager.kt | 16 ------ core/src/com/unciv/logic/map/TileMap.kt | 6 --- .../mainmenu/WorldScreenMenuPopup.kt | 49 ------------------- 6 files changed, 102 deletions(-) delete mode 100644 core/src/com/unciv/logic/civilization/ScienceVictoryManager.kt diff --git a/core/src/com/unciv/logic/GameInfo.kt b/core/src/com/unciv/logic/GameInfo.kt index a20a652c..21fc9841 100644 --- a/core/src/com/unciv/logic/GameInfo.kt +++ b/core/src/com/unciv/logic/GameInfo.kt @@ -251,11 +251,6 @@ class GameInfo { // we try to find new civs, and we check if civ is barbarian, which we can't know unless the gameInfo is already set. for (civInfo in civilizations) civInfo.gameInfo = this - // PlayerType was only added in 2.11.1, so we need to adjust for older saved games - if(civilizations.all { it.playerType==PlayerType.AI }) - getCurrentPlayerCivilization().playerType=PlayerType.Human - if(getCurrentPlayerCivilization().difficulty!="Chieftain") - difficulty= getCurrentPlayerCivilization().difficulty difficultyObject = ruleSet.difficulties[difficulty]!! // We have to remove all deprecated buildings from all cities BEFORE we update a single one, or run setTransients on the civs, @@ -269,23 +264,6 @@ class GameInfo { civInfo.policies.adoptedPolicies.add("Fascism") } - for (cityInfo in civInfo.cities) { - val cityConstructions = cityInfo.cityConstructions - - // As of 2.9.6, removed hydro plant, since it requires rivers, which we do not yet have - if ("Hydro Plant" in cityConstructions.builtBuildings) - cityConstructions.builtBuildings.remove("Hydro Plant") - if (cityConstructions.currentConstruction == "Hydro Plant") { - cityConstructions.currentConstruction = "" - cityConstructions.chooseNextConstruction() - } - - // As of 2.14.1, changed Machu Pichu to Machu Picchu - changeBuildingName(cityConstructions, "Machu Pichu", "Machu Picchu") - // As of 2.16.1, changed Colloseum to Colosseum - changeBuildingName(cityConstructions, "Colloseum", "Colosseum") - } - // This doesn't HAVE to go here, but why not. // As of version 3.1.3, trade offers of "Declare war on X" and "Introduction to X" were changed to X, // with the extra text being added only on UI display (solved a couple of problems). diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt index ff751eb6..ce3dce1d 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt @@ -56,13 +56,11 @@ class CivilizationInfo { var playerType = PlayerType.AI /** Used in online multiplayer for human players */ var playerId = "" var gold = 0 - @Deprecated("As of 2.11.1") var difficulty = "Chieftain" var civName = "" var tech = TechManager() var policies = PolicyManager() var goldenAges = GoldenAgeManager() var greatPeople = GreatPersonManager() - @Deprecated("As of 2.11.3") var scienceVictory = ScienceVictoryManager() var victoryManager=VictoryManager() var diplomacy = HashMap() var notifications = ArrayList() @@ -362,11 +360,6 @@ class CivilizationInfo { victoryManager.civInfo=this - // As of 2.11.3 scienceVictory is deprecated - if(victoryManager.currentsSpaceshipParts.values.sum() == 0 - && scienceVictory.currentParts.values.sum()>0) - victoryManager.currentsSpaceshipParts = scienceVictory.currentParts - for (cityInfo in cities) { cityInfo.civInfo = this // must be before the city's setTransients because it depends on the tilemap, that comes from the currentPlayerCivInfo cityInfo.setTransients() diff --git a/core/src/com/unciv/logic/civilization/PopupAlert.kt b/core/src/com/unciv/logic/civilization/PopupAlert.kt index a6045a34..140df829 100644 --- a/core/src/com/unciv/logic/civilization/PopupAlert.kt +++ b/core/src/com/unciv/logic/civilization/PopupAlert.kt @@ -8,8 +8,6 @@ enum class AlertType{ FirstContact, CityConquered, BorderConflict, - @Deprecated("As of 2.19.0 - replaced with DemandToStopSettlingCitiesNear") - CitiesSettledNearOtherCiv, DemandToStopSettlingCitiesNear, CitySettledNearOtherCivDespiteOurPromise, GoldenAge, diff --git a/core/src/com/unciv/logic/civilization/ScienceVictoryManager.kt b/core/src/com/unciv/logic/civilization/ScienceVictoryManager.kt deleted file mode 100644 index 84c97cd4..00000000 --- a/core/src/com/unciv/logic/civilization/ScienceVictoryManager.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.unciv.logic.civilization - -import com.unciv.models.Counter - -@Deprecated("As of 2.11.3") -class ScienceVictoryManager { - var requiredParts = Counter() - var currentParts = Counter() - - init { - requiredParts.add("SS Booster", 3) - requiredParts.add("SS Cockpit", 1) - requiredParts.add("SS Engine", 1) - requiredParts.add("SS Stasis Chamber", 1) - } -} diff --git a/core/src/com/unciv/logic/map/TileMap.kt b/core/src/com/unciv/logic/map/TileMap.kt index 0427f789..0ae424cd 100644 --- a/core/src/com/unciv/logic/map/TileMap.kt +++ b/core/src/com/unciv/logic/map/TileMap.kt @@ -19,9 +19,6 @@ class TileMap { var mapParameters = MapParameters() - @Deprecated("as of 2.7.10") - private var tiles = HashMap() - private var tileList = ArrayList() val values: Collection @@ -223,9 +220,6 @@ class TileMap { } fun setTransients(ruleset: Ruleset) { - if(tiles.any()) - tileList.addAll(tiles.values) - val topY= tileList.asSequence().map { it.position.y.toInt() }.max()!! bottomY= tileList.asSequence().map { it.position.y.toInt() }.min()!! val rightX= tileList.asSequence().map { it.position.x.toInt() }.max()!! diff --git a/core/src/com/unciv/ui/worldscreen/mainmenu/WorldScreenMenuPopup.kt b/core/src/com/unciv/ui/worldscreen/mainmenu/WorldScreenMenuPopup.kt index c1b3806e..4727edcf 100644 --- a/core/src/com/unciv/ui/worldscreen/mainmenu/WorldScreenMenuPopup.kt +++ b/core/src/com/unciv/ui/worldscreen/mainmenu/WorldScreenMenuPopup.kt @@ -82,55 +82,6 @@ class WorldScreenMenuPopup(val worldScreen: WorldScreen) : Popup(worldScreen) { } - @Deprecated("use MultiplayerScreen instead") - fun openMultiplayerPopup(){ - - close() - val multiplayerPopup = Popup(screen) - - multiplayerPopup.addGoodSizedLabel("To create a multiplayer game, check the 'multiplayer' toggle in the New Game screen, and for each human player insert that player's user ID.").row() - multiplayerPopup.addGoodSizedLabel("You can assign your own user ID there easily, and other players can copy their user IDs here and send them to you for you to include them in the game.").row() - - multiplayerPopup.addButton("Copy User ID"){ Gdx.app.clipboard.contents = UncivGame.Current.settings.userId }.row() - - multiplayerPopup.addGoodSizedLabel("Once you've created your game, enter this screen again to copy the Game ID and send it to the other players.").row() - - val copyGameIdButton = multiplayerPopup.addButton("Copy Game ID".tr()) { - Gdx.app.clipboard.contents = worldScreen.gameInfo.gameId }.apply { row() } - if(!worldScreen.gameInfo.gameParameters.isOnlineMultiplayer) - copyGameIdButton.actor.disable() - - multiplayerPopup.addGoodSizedLabel("Players can enter your game by copying the game ID to the clipboard, and clicking on the Join Game button").row() - val badGameIdLabel = "".toLabel(Color.RED) - badGameIdLabel.isVisible = false - multiplayerPopup.addButton("Join Game") { - val gameId = Gdx.app.clipboard.contents - try { - UUID.fromString(IdChecker.checkAndReturnGameUuid(gameId)) - } catch (ex: Exception) { - badGameIdLabel.setText("Invalid game ID!") - badGameIdLabel.isVisible = true - return@addButton - } - thread(name="MultiplayerDownload") { - try { - // The tryDownload can take more than 500ms. Therefore, to avoid ANRs, - // we need to run it in a different thread. - val game = OnlineMultiplayer().tryDownloadGame(gameId.trim()) - // The loadGame creates a screen, so it's a UI action, - // therefore it needs to run on the main thread so it has a GL context - Gdx.app.postRunnable { UncivGame.Current.loadGame(game) } - } catch (ex: Exception) { - badGameIdLabel.setText("Could not download game!".tr()) - badGameIdLabel.isVisible = true - } - } - }.row() - multiplayerPopup.add(badGameIdLabel).row() - multiplayerPopup.addCloseButton() - multiplayerPopup.open() - } - /** Shows the [Popup] with the map editor initialization options */ private fun openMapEditorPopup() {