From ba94a6a4824a426b2366ed2e6420c5bb0ff136aa Mon Sep 17 00:00:00 2001 From: yairm210 Date: Sat, 2 Nov 2024 19:25:50 +0200 Subject: [PATCH] Fixed Wait action when auto unit cycle is disabled --- .../com/unciv/ui/screens/newgamescreen/MapOptionsTable.kt | 5 ++--- .../ui/screens/worldscreen/unit/actions/UnitActions.kt | 6 +++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/com/unciv/ui/screens/newgamescreen/MapOptionsTable.kt b/core/src/com/unciv/ui/screens/newgamescreen/MapOptionsTable.kt index bcb4dbe44b..727d3b7674 100644 --- a/core/src/com/unciv/ui/screens/newgamescreen/MapOptionsTable.kt +++ b/core/src/com/unciv/ui/screens/newgamescreen/MapOptionsTable.kt @@ -5,7 +5,6 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table import com.unciv.Constants import com.unciv.logic.GameInfoPreview import com.unciv.logic.map.MapGeneratedMainType -import com.unciv.logic.map.MapParameters import com.unciv.models.ruleset.Ruleset import com.unciv.ui.components.extensions.toLabel import com.unciv.ui.components.input.onChange @@ -13,7 +12,7 @@ import com.unciv.ui.components.widgets.TranslatedSelectBox import com.unciv.ui.screens.basescreen.BaseScreen import com.unciv.utils.Concurrency -class ScenarioSelectTable(val newGameScreen: NewGameScreen, mapParameters: MapParameters) : Table() { +class ScenarioSelectTable(val newGameScreen: NewGameScreen) : Table() { data class ScenarioData(val name:String, val file: FileHandle){ var preview: GameInfoPreview? = null @@ -71,7 +70,7 @@ class MapOptionsTable(private val newGameScreen: NewGameScreen) : Table() { internal val generatedMapOptionsTable = MapParametersTable(newGameScreen, mapParameters, MapGeneratedMainType.generated) private val randomMapOptionsTable = MapParametersTable(newGameScreen, mapParameters, MapGeneratedMainType.randomGenerated) private val savedMapOptionsTable = MapFileSelectTable(newGameScreen, mapParameters) - private val scenarioOptionsTable = ScenarioSelectTable(newGameScreen, mapParameters) + private val scenarioOptionsTable = ScenarioSelectTable(newGameScreen) internal val mapTypeSelectBox: TranslatedSelectBox init { diff --git a/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActions.kt b/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActions.kt index afb1b33630..5de887992f 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActions.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActions.kt @@ -382,7 +382,11 @@ object UnitActions { type = UnitActionType.Wait, useFrequency = 65f, // Preferably have this on the first page action = { - unit.due = false // Skips to next unit due to worldScreen.switchToNextUnit() in activateAction + // If it's on, skips to next unit due to worldScreen.switchToNextUnit() in activateAction + // We don't want to switch twice since then we skip units :) + if (!UncivGame.Current.settings.autoUnitCycle) + GUI.getWorldScreen().switchToNextUnit() + unit.due = false } )) }