diff --git a/core/src/com/unciv/logic/city/CityInfo.kt b/core/src/com/unciv/logic/city/CityInfo.kt index d848057113..4d091ab05d 100644 --- a/core/src/com/unciv/logic/city/CityInfo.kt +++ b/core/src/com/unciv/logic/city/CityInfo.kt @@ -332,12 +332,12 @@ class CityInfo { expansion.nextTurn(stats.culture) if (isBeingRazed) { population.population-- - if (population.population <= 0) { // there are strange cases where we geet to -1 + if (population.population <= 0) { // there are strange cases where we get to -1 civInfo.addNotification("[$name] has been razed to the ground!", location, Color.RED) destroyCity() - } 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 { //if not razed yet: + if (population.foodStored >= population.getFoodToNextPopulation()) { //if surplus in the granary... + population.foodStored = population.getFoodToNextPopulation() - 1 //...reduce below the new growth threshold } } } else population.nextTurn(foodForNextTurn()) diff --git a/core/src/com/unciv/logic/city/PopulationManager.kt b/core/src/com/unciv/logic/city/PopulationManager.kt index b6ec88cfee..c69757e998 100644 --- a/core/src/com/unciv/logic/city/PopulationManager.kt +++ b/core/src/com/unciv/logic/city/PopulationManager.kt @@ -116,6 +116,13 @@ class PopulationManager { cityInfo.workedTiles = cityInfo.workedTiles.withoutItem(tile.position) } + // unassign specialists that cannot be (e.g. the city was captured and one of the specialist buildings was destroyed) + val maxSpecialists = getMaxSpecialists().toHashMap() + val specialistsHashmap = specialists.toHashMap() + for(entry in maxSpecialists) + if(specialistsHashmap[entry.key]!! > entry.value) + specialists.add(entry.key,maxSpecialists[entry.key]!! - specialistsHashmap[entry.key]!!) + while (getFreePopulation()<0) { //evaluate tiles val worstWorkedTile: TileInfo? = if(cityInfo.workedTiles.isEmpty()) null @@ -148,12 +155,6 @@ class PopulationManager { } } - // unassign specialists that cannot be (e.g. the city was captured and one of the specialist buildings was destroyed) - val maxSpecialists = getMaxSpecialists().toHashMap() - val specialistsHashmap = specialists.toHashMap() - for(entry in maxSpecialists) - if(specialistsHashmap[entry.key]!! > entry.value) - specialists.add(entry.key,specialistsHashmap[entry.key]!! - maxSpecialists[entry.key]!!) } fun getMaxSpecialists(): Stats {