Fix a few applications of the "hidden from users" modifer (#11186)

* Respect hidden modifier in a nation's unique improvements display

* Respect hidden modifier in the Unhappiness stat overview

* No auto-icons for an ExpanderTab title
This commit is contained in:
SomeTroglodyte 2024-02-24 21:38:02 +01:00 committed by GitHub
parent 6092702f96
commit 84902b7957
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 5 deletions

View File

@ -253,8 +253,10 @@ class Nation : RulesetObject() {
)
}
}
for (unique in improvement.uniques)
for (unique in improvement.uniqueObjects) {
if (unique.isHiddenToUsers()) continue
yield(FormattedLine(unique, indent = 1))
}
}
}

View File

@ -54,7 +54,7 @@ class ExpanderTab(
}
val header = Table(skin) // Header with label and icon, touchable to show/hide
private val headerLabel = title.toLabel(fontSize = fontSize)
private val headerLabel = title.toLabel(fontSize = fontSize, hideIcons = true)
private val headerIcon = ImageGetter.getImage(arrowImage)
private val contentWrapper = Table() // Wrapper for innerTable, this is what will be shown/hidden

View File

@ -137,10 +137,11 @@ class StatsOverviewTab(
uniques = sequenceOf(
UniqueType.ConditionalBetweenHappiness,
UniqueType.ConditionalBelowHappiness
).flatMap { conditional ->
viewingPlayer.getTriggeredUniques(conditional)
).flatMap { conditionalType ->
viewingPlayer.getTriggeredUniques(conditionalType)
.sortedBy { it.type } // otherwise order might change as a HashMap is involved
}.toSet()
}.filterNot { it.isHiddenToUsers() }
.toSet()
show = uniques.isNotEmpty()
}