From a246baa333f9c847169b846e33048a93156cd267 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Fri, 23 Jun 2023 10:17:45 +0300 Subject: [PATCH] Resolved #9638 - Removing old buildings on enemy capital (when not last city) no longer crashes --- .../logic/city/managers/CityInfoConquestFunctions.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/com/unciv/logic/city/managers/CityInfoConquestFunctions.kt b/core/src/com/unciv/logic/city/managers/CityInfoConquestFunctions.kt index e877269e12..70e189a898 100644 --- a/core/src/com/unciv/logic/city/managers/CityInfoConquestFunctions.kt +++ b/core/src/com/unciv/logic/city/managers/CityInfoConquestFunctions.kt @@ -289,16 +289,16 @@ class CityInfoConquestFunctions(val city: City){ // Stop WLTKD if it's still going resetWLTKD() - // Remove their free buildings from this city and remove free buildings provided by the city from their cities - removeBuildingsOnMoveToCiv(oldCiv) - - // Place palace for newCiv if this is the only city they have - // This needs to happen _before_ free buildings are added, as sometimes these should - // only be placed in the capital, and then there needs to be a capital. + // 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) } + // Remove their free buildings from this city and remove free buildings provided by the city from their cities + removeBuildingsOnMoveToCiv(oldCiv) + // Add our free buildings to this city and add free buildings provided by the city to other cities civ.civConstructions.tryAddFreeBuildings()