From 65e1c90e2866e973252f3f4d6746cedd97882264 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 18 Feb 2020 17:25:59 +0200 Subject: [PATCH] Resolved #1963 - can now unautomate embarked workers --- build.gradle | 4 ++-- .../unciv/ui/worldscreen/unit/UnitActions.kt | 24 +++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index b921f42f4e..ab757de177 100644 --- a/build.gradle +++ b/build.gradle @@ -33,8 +33,8 @@ allprojects { version = '1.0.1' ext { appName = "Unciv" - appCodeNumber = 381 - appVersion = "3.6.0" + appCodeNumber = 382 + appVersion = "3.6.0-patch1" gdxVersion = '1.9.10' roboVMVersion = '2.3.1' diff --git a/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt b/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt index c560635c02..1921ecbf4d 100644 --- a/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt +++ b/core/src/com/unciv/ui/worldscreen/unit/UnitActions.kt @@ -222,17 +222,9 @@ class UnitActions { } private fun addWorkerActions(unit: MapUnit, actionList: ArrayList, tile: TileInfo, worldScreen: WorldScreen, unitTable: UnitTable) { - if (!unit.hasUnique("Can build improvements on tiles") || unit.isEmbarked()) return - actionList += UnitAction( - type = UnitActionType.ConstructImprovement, - canAct = unit.currentMovement > 0 - && !tile.isCityCenter() - && unit.civInfo.gameInfo.ruleSet.tileImprovements.values.any { tile.canBuildImprovement(it, unit.civInfo) }, - isCurrentAction = unit.currentTile.hasImprovementInProgress(), - action = { - worldScreen.game.setScreen(ImprovementPickerScreen(tile) { unitTable.selectedUnit = null }) - }) + if (!unit.hasUnique("Can build improvements on tiles")) return + // Allow automate/unautomate when embarked, but not building improvements - see #1963 if (Constants.unitActionAutomation == unit.action) { actionList += UnitAction( type = UnitActionType.StopAutomation, @@ -248,6 +240,18 @@ class UnitActions { WorkerAutomation(unit).automateWorkerAction() }) } + + if(unit.isEmbarked()) return + + actionList += UnitAction( + type = UnitActionType.ConstructImprovement, + canAct = unit.currentMovement > 0 + && !tile.isCityCenter() + && unit.civInfo.gameInfo.ruleSet.tileImprovements.values.any { tile.canBuildImprovement(it, unit.civInfo) }, + isCurrentAction = unit.currentTile.hasImprovementInProgress(), + action = { + worldScreen.game.setScreen(ImprovementPickerScreen(tile) { unitTable.selectedUnit = null }) + }) } private fun addGreatPersonActions(unit: MapUnit, actionList: ArrayList, tile: TileInfo) {