diff --git a/core/src/com/unciv/logic/GameSaver.kt b/core/src/com/unciv/logic/GameSaver.kt index cd684e82e5..0b815f3b39 100644 --- a/core/src/com/unciv/logic/GameSaver.kt +++ b/core/src/com/unciv/logic/GameSaver.kt @@ -69,11 +69,11 @@ class GameSaver { } fun autoSave(gameInfo: GameInfo, postRunnable: () -> Unit = {}) { + // The save takes a long time (up to a few seconds on large games!) and we can do it while the player continues his game. + // On the other hand if we alter the game data while it's being serialized we could get a concurrent modification exception. + // So what we do is we clone all the game data and serialize the clone. val gameInfoClone = gameInfo.clone() kotlin.concurrent.thread { - // the save takes a long time (up to a second!) and we can do it while the player continues his game. - // On the other hand if we alter the game data while it's being serialized we could get a concurrent modification exception. - // So what we do is we clone all the game data and serialize the clone. saveGame(gameInfoClone, "Autosave") // keep auto-saves for the last 10 turns for debugging purposes diff --git a/core/src/com/unciv/models/gamebasics/Building.kt b/core/src/com/unciv/models/gamebasics/Building.kt index 5ce628be0d..258f2d406e 100644 --- a/core/src/com/unciv/models/gamebasics/Building.kt +++ b/core/src/com/unciv/models/gamebasics/Building.kt @@ -163,8 +163,7 @@ class Building : NamedStats(), IConstruction{ } fun getStatPercentageBonuses(civInfo: CivilizationInfo?): Stats { - val stats = percentStatBonus - if(stats==null) return Stats() // empty + val stats = if(percentStatBonus==null) Stats() else percentStatBonus!!.clone() if(civInfo==null) return stats // initial stats val adoptedPolicies = civInfo.policies.adoptedPolicies