diff --git a/core/src/com/unciv/logic/map/mapunit/UnitMovement.kt b/core/src/com/unciv/logic/map/mapunit/UnitMovement.kt index 374ec00a62..bc9adca295 100644 --- a/core/src/com/unciv/logic/map/mapunit/UnitMovement.kt +++ b/core/src/com/unciv/logic/map/mapunit/UnitMovement.kt @@ -63,6 +63,8 @@ class UnitMovement(val unit: MapUnit) { // when entering territory of a city state val areConnectedByRoad = from.hasConnection(civInfo) && to.hasConnection(civInfo) + // You might think "wait doesn't isAdjacentToRiver() call isConnectedByRiver() anyway, why have those checks?" + // The answer is that the isAdjacentToRiver values are CACHED per tile, but the isConnectedByRiver are not - this is an efficiency optimization val areConnectedByRiver = from.isAdjacentToRiver() && to.isAdjacentToRiver() && from.isConnectedByRiver(to) diff --git a/core/src/com/unciv/logic/map/tile/Tile.kt b/core/src/com/unciv/logic/map/tile/Tile.kt index 5cb1264b76..69eb9e48ee 100644 --- a/core/src/com/unciv/logic/map/tile/Tile.kt +++ b/core/src/com/unciv/logic/map/tile/Tile.kt @@ -673,7 +673,11 @@ open class Tile : IsPartOfGameInfoSerialization { } @delegate:Transient - private val isAdjacentToRiverLazy by lazy { neighbors.any { isConnectedByRiver(it) } } + private val isAdjacentToRiverLazy by lazy { + // These are so if you add a river at the bottom of the map (no neighboring tile to be connected to) + // that tile is still considered adjacent to river + hasBottomLeftRiver || hasBottomRiver || hasBottomRightRiver + || neighbors.any { isConnectedByRiver(it) } } fun isAdjacentToRiver() = isAdjacentToRiverLazy /**