From 0e612ac574cd903d6c9ec7f2f2a9c1814826b963 Mon Sep 17 00:00:00 2001 From: yairm210 Date: Mon, 16 Sep 2024 04:29:25 +0300 Subject: [PATCH] Solve self-introduced bug in unit movement. Thank G-d (literaly) for ConsoleLauncher, may his name (G-d's) be blessed --- .../unciv/logic/map/mapunit/movement/UnitMovement.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/com/unciv/logic/map/mapunit/movement/UnitMovement.kt b/core/src/com/unciv/logic/map/mapunit/movement/UnitMovement.kt index 26808a0f43..8ef6d550f7 100644 --- a/core/src/com/unciv/logic/map/mapunit/movement/UnitMovement.kt +++ b/core/src/com/unciv/logic/map/mapunit/movement/UnitMovement.kt @@ -44,7 +44,8 @@ class UnitMovement(val unit: MapUnit) { // If I can't move my only option is to stay... if (unitMovement == 0f || unit.cache.cannotMove) return distanceToTiles // If our escort can't move, ditto - if (includeOtherEscortUnit && unit.getOtherEscortUnit()?.currentMovement == 0f) return distanceToTiles + if (includeOtherEscortUnit && unit.isEscorting() + && unit.getOtherEscortUnit()?.currentMovement == 0f) return distanceToTiles var tilesToCheck = listOf(unitTile) @@ -703,10 +704,10 @@ class UnitMovement(val unit: MapUnit) { movementCostCache: HashMap, Float> = HashMap(), includeOtherEscortUnit: Boolean = true ): PathsToTilesWithinTurn { - val cacheResults = pathfindingCache.getDistanceToTiles(considerZoneOfControl) - if (cacheResults != null) { - return cacheResults - } +// val cacheResults = pathfindingCache.getDistanceToTiles(considerZoneOfControl) +// if (cacheResults != null) { +// return cacheResults +// } val distanceToTiles = getDistanceToTilesAtPosition( unit.currentTile.position, unit.currentMovement,