Resolved #9679 - 'liberate city and resurrect civ' no longer crashes

Kudos @SomeTroglodyte and @random271 for locating the problem :)
This commit is contained in:
Yair Morgenstern
2023-06-28 10:27:09 +03:00
parent a6e4b72cf4
commit 42a9c3af57

View File

@ -72,7 +72,8 @@ class CityInfoConquestFunctions(val city: City){
for (building in cityConstructions.getBuiltBuildings()) { for (building in cityConstructions.getBuiltBuildings()) {
// Remove national wonders // 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) cityConstructions.removeBuilding(building.name)
// Check if we exceed MaxNumberBuildable for any buildings // 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. // Place palace for newCiv if this is the only city they have.
// This needs to happen _before_ buildings are added or removed, // 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 // as any building change triggers a reevaluation of stats which assumes there to be a capital
if (newCiv.cities.size == 1) { if (newCiv.cities.size == 1) newCiv.moveCapitalTo(this)
newCiv.moveCapitalTo(this)
}
// Remove their free buildings from this city and remove free buildings provided by the city from their cities // Remove their free buildings from this city and remove free buildings provided by the city from their cities
removeBuildingsOnMoveToCiv(oldCiv) removeBuildingsOnMoveToCiv(oldCiv)