From 42a9c3af57659da6b153db0a798b6a998c99d84b Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 28 Jun 2023 10:27:09 +0300 Subject: [PATCH] Resolved #9679 - 'liberate city and resurrect civ' no longer crashes Kudos @SomeTroglodyte and @random271 for locating the problem :) --- .../unciv/logic/city/managers/CityInfoConquestFunctions.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/src/com/unciv/logic/city/managers/CityInfoConquestFunctions.kt b/core/src/com/unciv/logic/city/managers/CityInfoConquestFunctions.kt index e171adcefb..521de001c0 100644 --- a/core/src/com/unciv/logic/city/managers/CityInfoConquestFunctions.kt +++ b/core/src/com/unciv/logic/city/managers/CityInfoConquestFunctions.kt @@ -72,7 +72,8 @@ class CityInfoConquestFunctions(val city: City){ for (building in cityConstructions.getBuiltBuildings()) { // Remove national wonders - if (building.isNationalWonder && !building.hasUnique(UniqueType.NotDestroyedWhenCityCaptured)) + if (building.isNationalWonder && !building.hasUnique(UniqueType.NotDestroyedWhenCityCaptured) + && building.name != capitalCityIndicator()) // If we have just made this city the capital, don't remove that cityConstructions.removeBuilding(building.name) // Check if we exceed MaxNumberBuildable for any buildings @@ -292,9 +293,7 @@ class CityInfoConquestFunctions(val city: City){ // Place palace for newCiv if this is the only city they have. // This needs to happen _before_ buildings are added or removed, // as any building change triggers a reevaluation of stats which assumes there to be a capital - if (newCiv.cities.size == 1) { - newCiv.moveCapitalTo(this) - } + if (newCiv.cities.size == 1) newCiv.moveCapitalTo(this) // Remove their free buildings from this city and remove free buildings provided by the city from their cities removeBuildingsOnMoveToCiv(oldCiv)