From 42624f5bac7574b1f81af0dc0d6611f9fca415d2 Mon Sep 17 00:00:00 2001 From: Am-per-Sand <40436282+Am-per-Sand@users.noreply.github.com> Date: Mon, 22 Apr 2019 19:35:46 +0200 Subject: [PATCH] Fix negative turnsToNewPopulation while razing Now when razing, city's food storage is carried over from the stage when city's population was +1 larger and FoodToNextPopulation was respectively larger. If a player would like to stop razing, such city would spring up immediately growing next turn or further on. Another side effect is negative turnsToNewPopulation in the city screen. The same surplus cut off could be done to production if a Great Engineer speeds wonder production the same way and if negative turnsToComplete is possible (but have not spotted this line yet). --- core/src/com/unciv/logic/city/CityInfo.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/city/CityInfo.kt b/core/src/com/unciv/logic/city/CityInfo.kt index 18b8f865..c6f0a266 100644 --- a/core/src/com/unciv/logic/city/CityInfo.kt +++ b/core/src/com/unciv/logic/city/CityInfo.kt @@ -217,7 +217,10 @@ class CityInfo { 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 + } } else population.nextTurn(stats.food) @@ -285,4 +288,4 @@ class CityInfo { hasSoldBuildingThisTurn=true } //endregion -} \ No newline at end of file +}