Fixed "Endless Production" bug for Hanse
This commit is contained in:
parent
8f0c3f1c02
commit
e921833580
2 changed files with 4 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue