From 84902b7957f527f3424acde1d7207238960db577 Mon Sep 17 00:00:00 2001 From: SomeTroglodyte <63000004+SomeTroglodyte@users.noreply.github.com> Date: Sat, 24 Feb 2024 21:38:02 +0100 Subject: [PATCH] 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 --- core/src/com/unciv/models/ruleset/nation/Nation.kt | 4 +++- core/src/com/unciv/ui/components/widgets/ExpanderTab.kt | 2 +- .../unciv/ui/screens/overviewscreen/StatsOverviewTab.kt | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/core/src/com/unciv/models/ruleset/nation/Nation.kt b/core/src/com/unciv/models/ruleset/nation/Nation.kt index e25cfd6ef4..a4d62265cd 100644 --- a/core/src/com/unciv/models/ruleset/nation/Nation.kt +++ b/core/src/com/unciv/models/ruleset/nation/Nation.kt @@ -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)) + } } } diff --git a/core/src/com/unciv/ui/components/widgets/ExpanderTab.kt b/core/src/com/unciv/ui/components/widgets/ExpanderTab.kt index 7bd01e9433..d03b51081c 100644 --- a/core/src/com/unciv/ui/components/widgets/ExpanderTab.kt +++ b/core/src/com/unciv/ui/components/widgets/ExpanderTab.kt @@ -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 diff --git a/core/src/com/unciv/ui/screens/overviewscreen/StatsOverviewTab.kt b/core/src/com/unciv/ui/screens/overviewscreen/StatsOverviewTab.kt index 23fac93c26..7e45bb7d03 100644 --- a/core/src/com/unciv/ui/screens/overviewscreen/StatsOverviewTab.kt +++ b/core/src/com/unciv/ui/screens/overviewscreen/StatsOverviewTab.kt @@ -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() }