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
This commit is contained in:
Xander Lenstra 2021-12-06 10:54:10 +01:00 committed by GitHub
parent 10be481524
commit 2fa3228148
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -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

View File

@ -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] <while the empire is happy>"), 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