From 2fa3228148932a0bedda5d465f73056d88bc2850 Mon Sep 17 00:00:00 2001 From: Xander Lenstra <71121390+xlenstra@users.noreply.github.com> Date: Mon, 6 Dec 2021 10:54:10 +0100 Subject: [PATCH] Fixed a crash that occasionally happened when liberating a city to a dead civ (#5762) * Fixed a crash that occasionally happened when liberating a city to a dead civ * Added descriptive comment --- core/src/com/unciv/logic/city/CityInfoConquestFunctions.kt | 7 +++++-- core/src/com/unciv/models/ruleset/unique/UniqueType.kt | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/logic/city/CityInfoConquestFunctions.kt b/core/src/com/unciv/logic/city/CityInfoConquestFunctions.kt index 08c9eddde3..a00e8a453c 100644 --- a/core/src/com/unciv/logic/city/CityInfoConquestFunctions.kt +++ b/core/src/com/unciv/logic/city/CityInfoConquestFunctions.kt @@ -274,14 +274,17 @@ class CityInfoConquestFunctions(val city: CityInfo){ // 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 - civInfo.civConstructions.tryAddFreeBuildings() // Place palace for newCiv if this is the only city they have + // This needs to happen _before_ free buildings are added, as somtimes these should + // only be placed in the capital, and then there needs to be a capital. if (newCivInfo.cities.count() == 1) { cityConstructions.addBuilding(capitalCityIndicator) } + // Add our free buildings to this city and add free buildings provided by the city to other cities + civInfo.civConstructions.tryAddFreeBuildings() + isBeingRazed = false // Transfer unique buildings diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt index 215cd343f9..2a831686d6 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt @@ -94,7 +94,7 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget, val flags: @Deprecated("As of 3.17.1", ReplaceWith("[amount]% [stat] [in all cities] "), DeprecationLevel.WARNING) StatPercentBonusCitiesDeprecatedWhileEmpireHappy("[amount]% [stat] while the empire is happy", UniqueTarget.Global), - StatPercentFromReligionFollowers("[amount]% [stat] from every follower, up to [amount]%", UniqueTarget.FollowerBelief, UniqueTarget.Global), + StatPercentFromReligionFollowers("[amount]% [stat] from every follower, up to [amount]%", UniqueTarget.FollowerBelief), //endregion Stat providing uniques