diff --git a/core/src/com/unciv/ui/cityscreen/CityTileGroup.kt b/core/src/com/unciv/ui/cityscreen/CityTileGroup.kt index 90135cce..236519d6 100644 --- a/core/src/com/unciv/ui/cityscreen/CityTileGroup.kt +++ b/core/src/com/unciv/ui/cityscreen/CityTileGroup.kt @@ -20,7 +20,7 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo) : TileGroup( } fun update() { - super.update(true) + super.update(true,true) updatePopulationImage() if (improvementImage != null) improvementImage!!.setColor(1f, 1f, 1f, 0.5f) diff --git a/core/src/com/unciv/ui/tilegroups/TileGroup.kt b/core/src/com/unciv/ui/tilegroups/TileGroup.kt index 8e3a846b..e96ee690 100644 --- a/core/src/com/unciv/ui/tilegroups/TileGroup.kt +++ b/core/src/com/unciv/ui/tilegroups/TileGroup.kt @@ -107,7 +107,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() { } - open fun update(isViewable: Boolean) { + open fun update(isViewable: Boolean, showResourcesAndImprovements:Boolean) { hideCircle() if (!tileInfo.tileMap.gameInfo.getPlayerCivilization().exploredTiles.contains(tileInfo.position) && !UnCivGame.Current.viewEntireMapForDebug) { @@ -119,8 +119,8 @@ open class TileGroup(var tileInfo: TileInfo) : Group() { updateCityImage() updateTileColor(isViewable) - updateResourceImage(isViewable) - updateImprovementImage(isViewable) + updateResourceImage(isViewable,showResourcesAndImprovements) + updateImprovementImage(isViewable,showResourcesAndImprovements) civilianUnitImage = newUnitImage(tileInfo.civilianUnit, civilianUnitImage, isViewable, -20f) @@ -272,13 +272,13 @@ open class TileGroup(var tileInfo: TileInfo) : Group() { } } - private fun updateImprovementImage(viewable: Boolean) { + private fun updateImprovementImage(viewable: Boolean, showResourcesAndImprovements: Boolean) { if (improvementImage != null) { improvementImage!!.remove() improvementImage = null } - if (tileInfo.improvement != null && UnCivGame.Current.settings.showResourcesAndImprovements) { + if (tileInfo.improvement != null && showResourcesAndImprovements) { improvementImage = ImageGetter.getImprovementIcon(tileInfo.improvement!!) addActor(improvementImage) improvementImage!!.run { @@ -293,8 +293,8 @@ open class TileGroup(var tileInfo: TileInfo) : Group() { } } - private fun updateResourceImage(viewable: Boolean) { - val shouldDisplayResource = UnCivGame.Current.settings.showResourcesAndImprovements + private fun updateResourceImage(viewable: Boolean, showResourcesAndImprovements: Boolean) { + val shouldDisplayResource = showResourcesAndImprovements && tileInfo.hasViewableResource(tileInfo.tileMap.gameInfo.getPlayerCivilization()) if (resourceImage != null && !shouldDisplayResource) { diff --git a/core/src/com/unciv/ui/tilegroups/WorldTileGroup.kt b/core/src/com/unciv/ui/tilegroups/WorldTileGroup.kt index 793c1ca4..4bc9874f 100644 --- a/core/src/com/unciv/ui/tilegroups/WorldTileGroup.kt +++ b/core/src/com/unciv/ui/tilegroups/WorldTileGroup.kt @@ -39,7 +39,7 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) { } - override fun update(isViewable: Boolean) { + fun update(isViewable: Boolean) { val city = tileInfo.getCity() removePopulationIcon() @@ -51,7 +51,8 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) { || UnCivGame.Current.viewEntireMapForDebug) updateCityButton(city, isViewable || UnCivGame.Current.viewEntireMapForDebug) // needs to be before the update so the units will be above the city button - super.update(isViewable || UnCivGame.Current.viewEntireMapForDebug) + super.update(isViewable || UnCivGame.Current.viewEntireMapForDebug, + UnCivGame.Current.settings.showResourcesAndImprovements) yieldGroup.isVisible = !UnCivGame.Current.settings.showResourcesAndImprovements if(yieldGroup.isVisible)