mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-22 10:54:19 -04:00
Roads are not shown on non-visible tiles
This commit is contained in:
parent
c049593c5c
commit
90dd2e0ea1
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user