From d1135f3d20d4d25b7c4fc4f9e6772d4e2d9b9fd4 Mon Sep 17 00:00:00 2001 From: Xander Lenstra <71121390+xlenstra@users.noreply.github.com> Date: Wed, 8 Sep 2021 19:44:50 +0200 Subject: [PATCH] Fixes incorrect default paramter for starting era (#5119) --- core/src/com/unciv/models/metadata/GameParameters.kt | 2 +- core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt | 3 +-- tests/src/com/unciv/testing/SerializationTests.kt | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/core/src/com/unciv/models/metadata/GameParameters.kt b/core/src/com/unciv/models/metadata/GameParameters.kt index 4a8959130c..f990745b8f 100644 --- a/core/src/com/unciv/models/metadata/GameParameters.kt +++ b/core/src/com/unciv/models/metadata/GameParameters.kt @@ -25,7 +25,7 @@ class GameParameters { // Default values are the default new game // By default, all victory types except Diplomacy as it is quite new var victoryTypes: ArrayList = arrayListOf(VictoryType.Cultural, VictoryType.Domination, VictoryType.Scientific) - var startingEra = "Ancient Era" + var startingEra = "Ancient era" var isOnlineMultiplayer = false var baseRuleset: BaseRuleset = BaseRuleset.Civ_V_Vanilla diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt b/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt index 4f9294a88e..19534df5a8 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt @@ -294,8 +294,7 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() { private fun getEquivalentTurn(gameInfo: GameInfo): Int { val totalTurns = 500f * gameInfo.gameParameters.gameSpeed.modifier - val startPercent = gameInfo.ruleSet.eras[gameInfo.gameParameters.startingEra]?.startPercent - if (startPercent == null) return gameInfo.turns + val startPercent = gameInfo.ruleSet.eras[gameInfo.gameParameters.startingEra]!!.startPercent return gameInfo.turns + ((totalTurns * startPercent).toInt() / 100) } } diff --git a/tests/src/com/unciv/testing/SerializationTests.kt b/tests/src/com/unciv/testing/SerializationTests.kt index b510ba4729..fd83d2cf1d 100644 --- a/tests/src/com/unciv/testing/SerializationTests.kt +++ b/tests/src/com/unciv/testing/SerializationTests.kt @@ -51,7 +51,6 @@ class SerializationTests { players.add(Player("Rome").apply { playerType = PlayerType.Human }) players.add(Player("Greece")) religionEnabled = true - startingEra = "Ancient era" } val mapParameters = MapParameters().apply { mapSize = MapSizeNew(MapSize.Tiny)