From 5807957d328ea643374f685754bfb98434d51846 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 28 Nov 2019 22:21:39 +0200 Subject: [PATCH] Resolved #1369 - nuking capitals no longer crashes the game --- core/src/com/unciv/logic/city/CityInfo.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/city/CityInfo.kt b/core/src/com/unciv/logic/city/CityInfo.kt index 56c0a89d..a3fce4e2 100644 --- a/core/src/com/unciv/logic/city/CityInfo.kt +++ b/core/src/com/unciv/logic/city/CityInfo.kt @@ -287,8 +287,6 @@ class CityInfo { if (population.population <= 0) { // there are strange cases where we geet to -1 civInfo.addNotification("[$name] has been razed to the ground!", location, Color.RED) destroyCity() - if (isCapital() && civInfo.cities.isNotEmpty()) // Yes, we actually razed the capital. Some people do this. - civInfo.cities.first().cityConstructions.addBuilding("Palace") } else {//if not razed yet: if (population.foodStored >= population.getFoodToNextPopulation()) {//if surplus in the granary... population.foodStored = population.getFoodToNextPopulation() - 1//...reduce below the new growth treshold @@ -315,6 +313,9 @@ class CityInfo { civInfo.cities = civInfo.cities.toMutableList().apply { remove(this@CityInfo) } getTiles().forEach { expansion.relinquishOwnership(it) } getCenterTile().improvement="City ruins" + + if (isCapital() && civInfo.cities.isNotEmpty()) // Move the capital if destroyed (by a nuke or by razing) + civInfo.cities.first().cityConstructions.addBuilding("Palace") } fun annexCity() {