From fc81d7dda349d4198d0d0558f9f9a54d300f836d Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 22 May 2023 14:02:28 +0300 Subject: [PATCH] Units that can enter foreign lands without open borders are not expelled on open borders end --- core/src/com/unciv/logic/map/mapunit/UnitMovement.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/com/unciv/logic/map/mapunit/UnitMovement.kt b/core/src/com/unciv/logic/map/mapunit/UnitMovement.kt index b53452cea5..5bf17eb6aa 100644 --- a/core/src/com/unciv/logic/map/mapunit/UnitMovement.kt +++ b/core/src/com/unciv/logic/map/mapunit/UnitMovement.kt @@ -454,6 +454,8 @@ class UnitMovement(val unit: MapUnit) { var allowedTile: Tile? = null var distance = 0 // When we didn't limit the allowed distance the game would sometimes spend a whole minute looking for a suitable tile. + + if (canPassThrough(unit.getTile())) return // This unit can stay here - e.g. it has "May enter foreign tiles without open borders" while (allowedTile == null && distance < 5) { distance++ allowedTile = unit.getTile().getTilesAtDistance(distance)