Game no longer crashes on new game screen when no scenarios are available
This commit is contained in:
parent
324f4d7a15
commit
be216d8e6b
1 changed files with 11 additions and 8 deletions
|
@ -80,7 +80,9 @@ class MapOptionsTable(val newGameScreen: NewGameScreen): Table() {
|
||||||
override fun toString() = fileHandle.name()
|
override fun toString() = fileHandle.name()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val scenarioFiles = getScenarioFiles()
|
||||||
val scenarioSelectBox = SelectBox<FileHandleWrapper>(CameraStageBaseScreen.skin)
|
val scenarioSelectBox = SelectBox<FileHandleWrapper>(CameraStageBaseScreen.skin)
|
||||||
|
if (scenarioFiles.any()) {
|
||||||
for (savedGame in getScenarioFiles()) {
|
for (savedGame in getScenarioFiles()) {
|
||||||
scenarioSelectBox.items.add(FileHandleWrapper(savedGame))
|
scenarioSelectBox.items.add(FileHandleWrapper(savedGame))
|
||||||
}
|
}
|
||||||
|
@ -90,6 +92,7 @@ class MapOptionsTable(val newGameScreen: NewGameScreen): Table() {
|
||||||
scenarioSelectBox.onChange { selectSavedGameAsScenario(scenarioSelectBox.selected.fileHandle) }
|
scenarioSelectBox.onChange { selectSavedGameAsScenario(scenarioSelectBox.selected.fileHandle) }
|
||||||
scenarioOptionsTable.add("{Scenario file}:".toLabel()).left()
|
scenarioOptionsTable.add("{Scenario file}:".toLabel()).left()
|
||||||
scenarioOptionsTable.add(scenarioSelectBox)
|
scenarioOptionsTable.add(scenarioSelectBox)
|
||||||
|
}
|
||||||
|
|
||||||
fun updateOnMapTypeChange() {
|
fun updateOnMapTypeChange() {
|
||||||
mapTypeSpecificTable.clear()
|
mapTypeSpecificTable.clear()
|
||||||
|
|
Loading…
Reference in a new issue