From 100d6f9512fe19e3b3a2569beddeb931f4b4d3b1 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 28 Dec 2020 17:44:47 +0200 Subject: [PATCH] Fixed minor automation bug for modded terrains --- core/src/com/unciv/logic/automation/WorkerAutomation.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/automation/WorkerAutomation.kt b/core/src/com/unciv/logic/automation/WorkerAutomation.kt index 884bc4543a..dd082dc5d7 100644 --- a/core/src/com/unciv/logic/automation/WorkerAutomation.kt +++ b/core/src/com/unciv/logic/automation/WorkerAutomation.kt @@ -158,10 +158,11 @@ class WorkerAutomation(val unit: MapUnit) { if (chosenImprovement != null && tile.canBuildImprovement(chosenImprovement, civInfo)) return true } else if (!tile.containsGreatImprovement() && tile.hasViewableResource(civInfo) && tile.getTileResource().improvement != tile.improvement - && tile.canBuildImprovement(chooseImprovement(tile, civInfo)!!, civInfo)) + && chooseImprovement(tile, civInfo) // if the chosen improvement is not null and buildable + .let { it != null && tile.canBuildImprovement(it, civInfo) }) return true - return false // cou;dn't find anything to construct here + return false // couldn't find anything to construct here } fun getPriority(tileInfo: TileInfo, civInfo: CivilizationInfo): Int {