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).
This commit is contained in:
Am-per-Sand 2019-04-22 19:35:46 +02:00 committed by Yair Morgenstern
parent 0e8decfd07
commit 42624f5bac

View file

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