From a487c2c373d6b8f49dc99962f073a0a4dc839bbb Mon Sep 17 00:00:00 2001 From: SomeTroglodyte <63000004+SomeTroglodyte@users.noreply.github.com> Date: Mon, 27 Sep 2021 16:28:26 +0200 Subject: [PATCH] Fix new game Mod nation icons on first open (#5334) --- .../unciv/ui/newgamescreen/NewGameScreen.kt | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt b/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt index 6418dcae44..99fcf04dcf 100644 --- a/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt +++ b/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt @@ -28,23 +28,24 @@ class NewGameScreen( override val gameSetupInfo = _gameSetupInfo ?: GameSetupInfo.fromSettings() override var ruleset = RulesetCache.getComplexRuleset(gameSetupInfo.gameParameters.mods) // needs to be set because the GameOptionsTable etc. depend on this - private val newGameOptionsTable = GameOptionsTable(this, isNarrowerThan4to3()) { desiredCiv: String -> playerPickerTable.update(desiredCiv) } - - // Has to be defined before the mapOptionsTable, since the mapOptionsTable refers to it on init - private val playerPickerTable = PlayerPickerTable( - this, gameSetupInfo.gameParameters, - if (isNarrowerThan4to3()) stage.width - 20f else 0f - ) - private val mapOptionsTable = MapOptionsTable(this) + private val newGameOptionsTable: GameOptionsTable + private val playerPickerTable: PlayerPickerTable + private val mapOptionsTable: MapOptionsTable init { + updateRuleset() // must come before playerPickerTable so mod nations from fromSettings + // Has to be initialized before the mapOptionsTable, since the mapOptionsTable refers to it on init + playerPickerTable = PlayerPickerTable( + this, gameSetupInfo.gameParameters, + if (isNarrowerThan4to3()) stage.width - 20f else 0f + ) + newGameOptionsTable = GameOptionsTable(this, isNarrowerThan4to3()) { desiredCiv: String -> playerPickerTable.update(desiredCiv) } + mapOptionsTable = MapOptionsTable(this) setDefaultCloseAction(previousScreen) if (isNarrowerThan4to3()) initPortrait() else initLandscape() - updateRuleset() - if (UncivGame.Current.settings.lastGameSetup != null) { rightSideGroup.addActorAt(0, VerticalGroup().padBottom(5f)) val resetToDefaultsButton = "Reset to defaults".toTextButton()