Removed pre-3.0 deprecated fields - there's a limit to how long you can reasonably stay backwards-compatible to older saves

This commit is contained in:
Yair Morgenstern 2020-03-31 23:10:48 +03:00
parent 235143751c
commit 567a9446ad
6 changed files with 0 additions and 102 deletions

View file

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

View file

@ -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<String, DiplomacyManager>()
var notifications = ArrayList<Notification>()
@ -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()

View file

@ -8,8 +8,6 @@ enum class AlertType{
FirstContact,
CityConquered,
BorderConflict,
@Deprecated("As of 2.19.0 - replaced with DemandToStopSettlingCitiesNear")
CitiesSettledNearOtherCiv,
DemandToStopSettlingCitiesNear,
CitySettledNearOtherCivDespiteOurPromise,
GoldenAge,

View file

@ -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<String>()
var currentParts = Counter<String>()
init {
requiredParts.add("SS Booster", 3)
requiredParts.add("SS Cockpit", 1)
requiredParts.add("SS Engine", 1)
requiredParts.add("SS Stasis Chamber", 1)
}
}

View file

@ -19,9 +19,6 @@ class TileMap {
var mapParameters = MapParameters()
@Deprecated("as of 2.7.10")
private var tiles = HashMap<String, TileInfo>()
private var tileList = ArrayList<TileInfo>()
val values: Collection<TileInfo>
@ -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()!!

View file

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