mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-13 09:18:43 +07:00
Game no longer crashes on new game screen when no scenarios are available
This commit is contained in:
@ -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()
|
||||||
|
Reference in New Issue
Block a user