Hiding resources and improvements in the world screen no loger affects the city screens

This commit is contained in:
Yair Morgenstern 2018-11-13 21:17:01 +02:00
parent 42e6ab1c65
commit 2b2f8affd8
3 changed files with 11 additions and 10 deletions

View file

@ -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)

View file

@ -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) {

View file

@ -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)