From f01b6b665f44ddaf257374e10afb76235e9d3a86 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 23 May 2018 00:42:33 +0300 Subject: [PATCH] Can no longer walk through enemy units =) --- core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt index 386918a7e6..0a69c8164e 100644 --- a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt +++ b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt @@ -36,9 +36,9 @@ class UnitMovementAlgorithms(val unit:MapUnit) { for (neighbor in tileToCheck.neighbors) { var totalDistanceToTile:Float - if (neighbor.getOwner() != unit.civInfo - && neighbor.isCityCenter()) - totalDistanceToTile = unitMovement // Enemy city, can't move through it - we'll be "stuck" there + if ((neighbor.getOwner() != unit.civInfo && neighbor.isCityCenter())// Enemy city, + || neighbor.unit!=null && neighbor.unit!!.civInfo!=unit.civInfo) // Enemy unit + totalDistanceToTile = unitMovement // can't move through it - we'll be "stuck" there else { val distanceBetweenTiles = getMovementCostBetweenAdjacentTiles(tileToCheck, neighbor)