From 8e9cd174dc33bd9198a53cc9c1007c14a6690286 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 26 May 2020 16:35:01 +0300 Subject: [PATCH] 3.8.12-patch1 Added case where worker that needs to ru away has nowhere to move to --- buildSrc/src/main/kotlin/BuildConfig.kt | 4 ++-- core/src/com/unciv/logic/automation/WorkerAutomation.kt | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/kotlin/BuildConfig.kt b/buildSrc/src/main/kotlin/BuildConfig.kt index 38d449a1a8..12226ca2d1 100644 --- a/buildSrc/src/main/kotlin/BuildConfig.kt +++ b/buildSrc/src/main/kotlin/BuildConfig.kt @@ -3,8 +3,8 @@ package com.unciv.build object BuildConfig { const val kotlinVersion = "1.3.71" const val appName = "Unciv" - const val appCodeNumber = 431 - const val appVersion = "3.8.12" + const val appCodeNumber = 432 + const val appVersion = "3.8.12-patch1" const val gdxVersion = "1.9.10" const val roboVMVersion = "2.3.1" diff --git a/core/src/com/unciv/logic/automation/WorkerAutomation.kt b/core/src/com/unciv/logic/automation/WorkerAutomation.kt index 7f17dfe823..9aee7e88a0 100644 --- a/core/src/com/unciv/logic/automation/WorkerAutomation.kt +++ b/core/src/com/unciv/logic/automation/WorkerAutomation.kt @@ -77,7 +77,8 @@ class WorkerAutomation(val unit: MapUnit) { return } val tileFurthestFromEnemy = reachableTiles.keys.filter { unit.movement.canMoveTo(it) } - .maxBy(this::countDistanceToClosestEnemy)!! + .maxBy(this::countDistanceToClosestEnemy) + if(tileFurthestFromEnemy==null) return // can't move anywhere! unit.movement.moveToTile(tileFurthestFromEnemy) }