From 62ce65ec1aae40ed5f75ab0c6c9c977575111e16 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 19 Mar 2024 23:52:34 +0200 Subject: [PATCH] Resolved #11339 - Fixed ruleset-dependant building filter activating *when initializing ruleset* --- core/src/com/unciv/models/ruleset/Building.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/models/ruleset/Building.kt b/core/src/com/unciv/models/ruleset/Building.kt index 78abe29b08..ce956e5c3e 100644 --- a/core/src/com/unciv/models/ruleset/Building.kt +++ b/core/src/com/unciv/models/ruleset/Building.kt @@ -517,8 +517,9 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction { replaces -> true else -> { if (uniques.contains(filter)) return true - for (requiredTech: String in requiredTechs()) - if (ruleset.technologies[requiredTech]?.matchesFilter(filter) == true) return true + if (::ruleset.isInitialized) // False when loading ruleset and checking buildingsToRemove + for (requiredTech: String in requiredTechs()) + if (ruleset.technologies[requiredTech]?.matchesFilter(filter) == true) return true val stat = Stat.safeValueOf(filter) return (stat != null && isStatRelated(stat)) }