From a1f7721878bd90938e201a8c8353f98b98ce9a0b Mon Sep 17 00:00:00 2001 From: Xander Lenstra <71121390+xlenstra@users.noreply.github.com> Date: Wed, 8 Sep 2021 19:42:58 +0200 Subject: [PATCH] Fixes #5113 (#5122) * Fixed #5113 * Better check --- .../src/com/unciv/logic/automation/WorkerAutomation.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/automation/WorkerAutomation.kt b/core/src/com/unciv/logic/automation/WorkerAutomation.kt index 116f512288..02f90e550e 100644 --- a/core/src/com/unciv/logic/automation/WorkerAutomation.kt +++ b/core/src/com/unciv/logic/automation/WorkerAutomation.kt @@ -281,14 +281,20 @@ class WorkerAutomation( val city = tile.getCity() if (city == null || city.civInfo != civInfo) return false - if (tile.improvement != null && !UncivGame.Current.settings.automatedWorkersReplaceImprovements) - return false + if (tile.improvement != null && !UncivGame.Current.settings.automatedWorkersReplaceImprovements) { + if (unit != null) { + if (unit.civInfo.isPlayerCivilization()) + return false + } else if (UncivGame.Current.gameInfo.currentPlayerCiv.isPlayerCivilization()) + return false + } if (tile.improvement == null) { if (unit == null) return true if (tile.improvementInProgress != null && unit.canBuildImprovement(tile.getTileImprovementInProgress()!!, tile)) return true val chosenImprovement = chooseImprovement(unit, tile) if (chosenImprovement != null && tile.canBuildImprovement(chosenImprovement, civInfo) && unit.canBuildImprovement(chosenImprovement, tile)) return true + } else if (!tile.containsGreatImprovement() && tile.hasViewableResource(civInfo) && tile.getTileResource().improvement != tile.improvement && (unit == null || chooseImprovement(unit, tile) // if the chosen improvement is not null and buildable