From 0e71da82d4aaef0d75f17a86a2dc35c32b1cf97f Mon Sep 17 00:00:00 2001 From: HadeanLake <69697985+HadeanLake@users.noreply.github.com> Date: Wed, 2 Sep 2020 13:18:51 +0300 Subject: [PATCH] fixed base ruleset mods (#3078) oldBaseRuleset mod will be removed from gameParameters before adding selected one --- .../com/unciv/ui/newgamescreen/GameOptionsTable.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/com/unciv/ui/newgamescreen/GameOptionsTable.kt b/core/src/com/unciv/ui/newgamescreen/GameOptionsTable.kt index 3f1c3113..a290155e 100644 --- a/core/src/com/unciv/ui/newgamescreen/GameOptionsTable.kt +++ b/core/src/com/unciv/ui/newgamescreen/GameOptionsTable.kt @@ -191,7 +191,13 @@ class GameOptionsTable(val previousScreen: IPreviousScreen, val updatePlayerPick checkBox.isDisabled = locked if (mod.name in gameParameters.mods) checkBox.isChecked = true checkBox.onChange { - if (checkBox.isChecked) gameParameters.mods.add(mod.name) + if (checkBox.isChecked) { + if (mod.modOptions.isBaseRuleset) + for (oldBaseRuleset in gameParameters.mods) + if (modRulesets.firstOrNull { it.name == oldBaseRuleset }?.modOptions?.isBaseRuleset == true) + gameParameters.mods.remove(oldBaseRuleset) + gameParameters.mods.add(mod.name) + } else gameParameters.mods.remove(mod.name) reloadRuleset() update() @@ -201,10 +207,6 @@ class GameOptionsTable(val previousScreen: IPreviousScreen, val updatePlayerPick if (modNations != null && modNations.size > 0) { desiredCiv = modNations.keys.first() } - if (mod.modOptions.isBaseRuleset) - for (oldBaseRuleset in gameParameters.mods) - if (modRulesets.firstOrNull { it.name == oldBaseRuleset }?.modOptions?.isBaseRuleset == true) - gameParameters.mods.remove(oldBaseRuleset) } updatePlayerPickerTable(desiredCiv) }