From e58dd7c1f6b0d812698fb97e7276c4df7be5cdde Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 4 Sep 2023 16:42:21 +0300 Subject: [PATCH] Buildings missing from ruleset are removed from loaded games *properly* --- core/src/com/unciv/logic/BackwardCompatibility.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/logic/BackwardCompatibility.kt b/core/src/com/unciv/logic/BackwardCompatibility.kt index b7e16ec90b..9558d86bc7 100644 --- a/core/src/com/unciv/logic/BackwardCompatibility.kt +++ b/core/src/com/unciv/logic/BackwardCompatibility.kt @@ -66,9 +66,9 @@ object BackwardCompatibility { private fun GameInfo.handleMissingReferencesForEachCity() { for (city in civilizations.asSequence().flatMap { it.cities.asSequence() }) { - for (building in city.cityConstructions.getBuiltBuildings()) { - if (!ruleset.buildings.containsKey(building.name)) - city.cityConstructions.removeBuilding(building) + for (building in city.cityConstructions.builtBuildings.toList()) { + if (!ruleset.buildings.containsKey(building)) + city.cityConstructions.builtBuildings.remove(building) } fun isInvalidConstruction(construction: String) =