diff --git a/core/src/com/unciv/ui/components/widgets/ExpanderTab.kt b/core/src/com/unciv/ui/components/widgets/ExpanderTab.kt index d03b51081c..ae5e091d90 100644 --- a/core/src/com/unciv/ui/components/widgets/ExpanderTab.kt +++ b/core/src/com/unciv/ui/components/widgets/ExpanderTab.kt @@ -32,7 +32,7 @@ import com.unciv.ui.screens.basescreen.BaseScreen * @param initContent Optional lambda with [innerTable] as parameter, to help initialize content. */ class ExpanderTab( - title: String, + val title: String, fontSize: Int = Constants.headingFontSize, icon: Actor? = null, startsOutOpened: Boolean = true, diff --git a/core/src/com/unciv/ui/popups/options/ModCheckTab.kt b/core/src/com/unciv/ui/popups/options/ModCheckTab.kt index 3bebda5713..d6c02f2de9 100644 --- a/core/src/com/unciv/ui/popups/options/ModCheckTab.kt +++ b/core/src/com/unciv/ui/popups/options/ModCheckTab.kt @@ -78,6 +78,9 @@ class ModCheckTab( modCheckFirstRun = false if (modCheckBaseSelect == null) return + val openedExpanderTitles = modCheckResultTable.children.filterIsInstance() + .filter { it.isOpen }.map { it.title }.toSet() + modCheckResultTable.clear() val rulesetErrors = RulesetCache.loadRulesets() @@ -92,7 +95,7 @@ class ModCheckTab( modCheckBaseSelect!!.isDisabled = true Concurrency.run("ModChecker") { - for (mod in RulesetCache.values.sortedBy { it.name }) { + for (mod in RulesetCache.values.sortedBy { it.name }.sortedByDescending { it.name in openedExpanderTitles }) { if (base != MOD_CHECK_WITHOUT_BASE && mod.modOptions.isBaseRuleset) continue val modLinks = @@ -121,7 +124,7 @@ class ModCheckTab( .apply { color = Color.BLACK } .surroundWithCircle(30f, color = iconColor) - val expanderTab = ExpanderTab(mod.name, icon = icon, startsOutOpened = false) { + val expanderTab = ExpanderTab(mod.name, icon = icon, startsOutOpened = mod.name in openedExpanderTitles) { it.defaults().align(Align.left) if (!noProblem && mod.folderLocation != null) { val replaceableUniques = getDeprecatedReplaceableUniques(mod)