Better checking for unloadable scenarios

This commit is contained in:
Yair Morgenstern
2020-09-29 14:15:00 +03:00
parent 6662944f32
commit 9b3dd5058f
2 changed files with 4 additions and 3 deletions

View File

@ -304,9 +304,9 @@ class MapUnit {
updateUniques() updateUniques()
} }
fun useMovementPoints(amount:Float){ fun useMovementPoints(amount:Float) {
currentMovement -= amount currentMovement -= amount
if(currentMovement<0) currentMovement = 0f if (currentMovement < 0) currentMovement = 0f
} }
fun doAction() { fun doAction() {

View File

@ -80,10 +80,11 @@ class MapOptionsTable(val newGameScreen: NewGameScreen): Table() {
if (scenarioFiles.any()) { if (scenarioFiles.any()) {
for (savedGame in getScenarioFiles()) { for (savedGame in getScenarioFiles()) {
try { // Sometimes, we have scenarios that are dependent on mods that we don't have and so they can't be loaded. try { // Sometimes, we have scenarios that are dependent on mods that we don't have and so they can't be loaded.
selectSavedGameAsScenario(savedGame) GameSaver.loadGameFromFile(savedGame)
scenarioSelectBox.items.add(FileHandleWrapper(savedGame)) scenarioSelectBox.items.add(FileHandleWrapper(savedGame))
} catch (ex: Exception) {} } catch (ex: Exception) {}
} }
scenarioSelectBox.items = scenarioSelectBox.items // it doesn't register them until you do this. scenarioSelectBox.items = scenarioSelectBox.items // it doesn't register them until you do this.
scenarioSelectBox.selected = scenarioSelectBox.items.first() scenarioSelectBox.selected = scenarioSelectBox.items.first()
// needs to be after the item change, so it doesn't activate before we choose the Scenario maptype // needs to be after the item change, so it doesn't activate before we choose the Scenario maptype