Fixed a crash when changing the base ruleset while in portrait mode (#5671)

* Fixed a crash when changing the base ruleset while in portrait mode

* Whoops
This commit is contained in:
Xander Lenstra 2021-11-14 13:14:16 +01:00 committed by GitHub
parent f3115d9f03
commit 5a458e93cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -15,13 +15,14 @@ import com.unciv.ui.utils.*
class GameOptionsTable( class GameOptionsTable(
val previousScreen: IPreviousScreen, val previousScreen: IPreviousScreen,
val withoutMods: Boolean = false, val isPortrait: Boolean = false,
val updatePlayerPickerTable:(desiredCiv:String)->Unit val updatePlayerPickerTable:(desiredCiv:String)->Unit
) : Table(CameraStageBaseScreen.skin) { ) : Table(CameraStageBaseScreen.skin) {
var gameParameters = previousScreen.gameSetupInfo.gameParameters var gameParameters = previousScreen.gameSetupInfo.gameParameters
val ruleset = previousScreen.ruleset val ruleset = previousScreen.ruleset
var locked = false var locked = false
private var modCheckboxes: ModCheckboxTable? = null var modCheckboxes: ModCheckboxTable? = null
private set;
init { init {
getGameOptionsTable() getGameOptionsTable()
@ -38,7 +39,11 @@ class GameOptionsTable(
defaults().pad(5f) defaults().pad(5f)
// We assign this first to make sure addBaseRulesetSelectBox doesn't reference a null object // We assign this first to make sure addBaseRulesetSelectBox doesn't reference a null object
if (!withoutMods) modCheckboxes = getModCheckboxes() if (isPortrait) {
modCheckboxes = getModCheckboxes(isPortrait = true)
} else {
modCheckboxes = getModCheckboxes()
}
add(Table().apply { add(Table().apply {
defaults().pad(5f) defaults().pad(5f)
@ -62,7 +67,8 @@ class GameOptionsTable(
checkboxTable.addReligionCheckbox(cityStateSlider) checkboxTable.addReligionCheckbox(cityStateSlider)
add(checkboxTable).center().row() add(checkboxTable).center().row()
if (!withoutMods) add(modCheckboxes).row() if (!isPortrait)
add(modCheckboxes).row()
pack() pack()
} }

View File

@ -162,7 +162,7 @@ class NewGameScreen(
}).expandX().fillX().row() }).expandX().fillX().row()
topTable.addSeparator(Color.DARK_GRAY, height = 1f) topTable.addSeparator(Color.DARK_GRAY, height = 1f)
topTable.add(newGameOptionsTable.getModCheckboxes(isPortrait = true)).expandX().fillX().row() topTable.add(newGameOptionsTable.modCheckboxes).expandX().fillX().row()
topTable.addSeparator(Color.DARK_GRAY, height = 1f) topTable.addSeparator(Color.DARK_GRAY, height = 1f)
topTable.add(ExpanderTab("Map Options") { topTable.add(ExpanderTab("Map Options") {