From 90dd2e0ea13b0f8fd3ce563fea94d3a3a8be2853 Mon Sep 17 00:00:00 2001 From: yairm210 Date: Thu, 4 Sep 2025 21:43:56 +0300 Subject: [PATCH] Roads are not shown on non-visible tiles --- .../ui/components/tilegroups/layers/TileLayerFeatures.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/ui/components/tilegroups/layers/TileLayerFeatures.kt b/core/src/com/unciv/ui/components/tilegroups/layers/TileLayerFeatures.kt index c66bbef3b8..5fa6e1c833 100644 --- a/core/src/com/unciv/ui/components/tilegroups/layers/TileLayerFeatures.kt +++ b/core/src/com/unciv/ui/components/tilegroups/layers/TileLayerFeatures.kt @@ -25,18 +25,20 @@ class TileLayerFeatures(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup override fun hit(x: Float, y: Float, touchable: Boolean): Actor? = null override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha) - private fun updateRoadImages() { + private fun updateRoadImages(viewingCiv: Civilization?) { if (tileGroup.isForMapEditorIcon) return val tile = tileGroup.tile + val isTileVisible = viewingCiv == null || tile.isVisible(viewingCiv) for (neighbor in tile.neighbors) { val roadImage = roadImages[neighbor] ?: RoadImage() .also { roadImages[neighbor] = it } val roadStatus = when { + !isTileVisible && viewingCiv != null && !neighbor.isVisible(viewingCiv) -> RoadStatus.None // don't show roads on non-visible tiles tile.roadStatus == RoadStatus.None || neighbor.roadStatus === RoadStatus.None -> RoadStatus.None tile.roadStatus == RoadStatus.Road || neighbor.roadStatus === RoadStatus.Road -> RoadStatus.Road else -> RoadStatus.Railroad @@ -73,7 +75,7 @@ class TileLayerFeatures(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup } override fun doUpdate(viewingCiv: Civilization?, localUniqueCache: LocalUniqueCache) { - updateRoadImages() + updateRoadImages(viewingCiv) } fun dim() {