Fixed unassigning extra specialists, and activate that at the end of each turn
This commit is contained in:
parent
3f97daf1da
commit
1564502fc2
2 changed files with 11 additions and 10 deletions
|
@ -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())
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue