mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-30 14:48:56 +07:00
When capturing a city, the expansion of that city is reset.
This leaves a situation where previously worked tiles are outside of the new borders, and so the population that was working there needs to be reassigned.
This commit is contained in:
@ -131,6 +131,11 @@ class Battle(val gameInfo:GameInfo) {
|
||||
city.getCenterTile().unit = null
|
||||
city.expansion.cultureStored = 0;
|
||||
city.expansion.reset()
|
||||
|
||||
// now that the tiles have changed, we need to reassign population
|
||||
city.workedTiles.filterNot { city.tiles.contains(it) }
|
||||
.forEach { city.workedTiles.remove(it); city.population.autoAssignPopulation() }
|
||||
|
||||
if(city.cityConstructions.isBuilt("Palace")){
|
||||
city.cityConstructions.builtBuildings.remove("Palace")
|
||||
if(enemyCiv.cities.isEmpty()) {
|
||||
|
@ -100,7 +100,7 @@ class CityInfo {
|
||||
if (listOf("Forest", "Jungle", "Marsh").contains(tile.terrainFeature))
|
||||
tile.terrainFeature = null
|
||||
|
||||
population.autoAssignWorker()
|
||||
population.autoAssignPopulation()
|
||||
cityStats.update()
|
||||
}
|
||||
|
||||
|
@ -54,12 +54,12 @@ class PopulationManager {
|
||||
foodStored -= getFoodToNextPopulation()
|
||||
if (cityInfo.buildingUniques.contains("FoodCarriesOver")) foodStored += (0.4f * getFoodToNextPopulation()).toInt() // Aqueduct special
|
||||
population++
|
||||
autoAssignWorker()
|
||||
autoAssignPopulation()
|
||||
cityInfo.civInfo.addNotification(cityInfo.name + " has grown!", cityInfo.location)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun autoAssignWorker() {
|
||||
internal fun autoAssignPopulation() {
|
||||
val toWork: TileInfo? = cityInfo.getTiles()
|
||||
.filterNot { cityInfo.workedTiles.contains(it.position) || cityInfo.location==it.position}
|
||||
.maxBy { Automation().rankTile(it,cityInfo.civInfo) }
|
||||
|
Reference in New Issue
Block a user