diff --git a/core/src/com/unciv/logic/civilization/transients/CivInfoTransientCache.kt b/core/src/com/unciv/logic/civilization/transients/CivInfoTransientCache.kt index 9a65983151..4f249126d8 100644 --- a/core/src/com/unciv/logic/civilization/transients/CivInfoTransientCache.kt +++ b/core/src/com/unciv/logic/civilization/transients/CivInfoTransientCache.kt @@ -138,7 +138,7 @@ class CivInfoTransientCache(val civInfo: Civilization) { civInfo.viewableInvisibleUnitsTiles = newViewableInvisibleTiles } - private var ourTilesAndNeighboringTiles: Set = HashSet() + var ourTilesAndNeighboringTiles: Set = HashSet() /** Our tiles update pretty infrequently - most 'viewable tile' changes are due to unit movements, * which means we can store this separately and use it 'as is' so we don't need to find the neighboring tiles every time diff --git a/core/src/com/unciv/logic/map/mapunit/MapUnit.kt b/core/src/com/unciv/logic/map/mapunit/MapUnit.kt index fb4e4c1bfc..e09215204e 100644 --- a/core/src/com/unciv/logic/map/mapunit/MapUnit.kt +++ b/core/src/com/unciv/logic/map/mapunit/MapUnit.kt @@ -307,7 +307,10 @@ class MapUnit : IsPartOfGameInfoSerialization { } // Set equality automatically determines if anything changed - https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-abstract-set/equals.html - if (updateCivViewableTiles && oldViewableTiles != viewableTiles) + if (updateCivViewableTiles && oldViewableTiles != viewableTiles + // Don't bother updating if all previous and current viewable tiles are within our borders + && (oldViewableTiles.any { it !in civ.cache.ourTilesAndNeighboringTiles } + || viewableTiles.any { it !in civ.cache.ourTilesAndNeighboringTiles })) civ.cache.updateViewableTiles(explorerPosition) }