From 9f0abbd69035eed328b43419841a0f61450ce315 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 1 Aug 2024 16:16:07 +0300 Subject: [PATCH] Solved defaults changing *existing games* due to no serialization of defaults in json. (#12049) Only new installations get rectangular and world wrap by default --- core/src/com/unciv/logic/civilization/Civilization.kt | 2 +- core/src/com/unciv/logic/map/MapParameters.kt | 4 ++-- core/src/com/unciv/models/metadata/GameSetupInfo.kt | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/logic/civilization/Civilization.kt b/core/src/com/unciv/logic/civilization/Civilization.kt index 9d7f66add0c35..a052357b97fa1 100644 --- a/core/src/com/unciv/logic/civilization/Civilization.kt +++ b/core/src/com/unciv/logic/civilization/Civilization.kt @@ -58,7 +58,6 @@ import com.unciv.models.stats.Stats import com.unciv.models.translations.tr import com.unciv.ui.components.extensions.toPercent import com.unciv.ui.screens.victoryscreen.RankingType -import com.unciv.utils.Log import org.jetbrains.annotations.VisibleForTesting import kotlin.math.max import kotlin.math.min @@ -561,6 +560,7 @@ class Civilization : IsPartOfGameInfoSerialization { }.toList() // Triggers can e.g. add buildings which contain triggers, causing concurrent modification errors + @Transient private val cachedMatchesFilterResult = HashMap() /** Implements [UniqueParameterType.CivFilter][com.unciv.models.ruleset.unique.UniqueParameterType.CivFilter] */ diff --git a/core/src/com/unciv/logic/map/MapParameters.kt b/core/src/com/unciv/logic/map/MapParameters.kt index 8f6e768d6f813..2440520e2dfad 100644 --- a/core/src/com/unciv/logic/map/MapParameters.kt +++ b/core/src/com/unciv/logic/map/MapParameters.kt @@ -41,12 +41,12 @@ object MapType { class MapParameters : IsPartOfGameInfoSerialization { var name = "" var type = MapType.pangaea - var shape = MapShape.rectangular + var shape = MapShape.hexagonal var mapSize = MapSize.Medium var mapResources = MapResourceSetting.default.label var noRuins = false var noNaturalWonders = false - var worldWrap = true + var worldWrap = false var strategicBalance = false var legendaryStart = false diff --git a/core/src/com/unciv/models/metadata/GameSetupInfo.kt b/core/src/com/unciv/models/metadata/GameSetupInfo.kt index 6f05e029dda86..37717a409bce9 100644 --- a/core/src/com/unciv/models/metadata/GameSetupInfo.kt +++ b/core/src/com/unciv/models/metadata/GameSetupInfo.kt @@ -4,6 +4,7 @@ import com.badlogic.gdx.files.FileHandle import com.unciv.UncivGame import com.unciv.logic.GameInfo import com.unciv.logic.map.MapParameters +import com.unciv.logic.map.MapShape class GameSetupInfo( val gameParameters: GameParameters = GameParameters(), @@ -26,6 +27,8 @@ class GameSetupInfo( fun fromSettings(defaultDifficulty: String? = null) = UncivGame.Current.settings.run { if (lastGameSetup == null) GameSetupInfo().apply { if (defaultDifficulty != null) gameParameters.difficulty = defaultDifficulty + mapParameters.shape = MapShape.rectangular + mapParameters.worldWrap = true } else GameSetupInfo(lastGameSetup!!).apply { mapParameters.reseed()