perf: Don't update city stats at *end turn* when unassigning extra population (won't affect anything until next turn where we'll recalc anyway)

This commit is contained in:
yairm210
2024-09-08 01:11:29 +03:00
parent d59816af0f
commit 333b1b194f
3 changed files with 3 additions and 5 deletions

View File

@ -411,8 +411,7 @@ class City : IsPartOfGameInfoSerialization, INamed {
hasSoldBuildingThisTurn = true
population.unassignExtraPopulation() // If the building provided specialists, release them to other work
population.autoAssignPopulation()
cityStats.update()
population.autoAssignPopulation() // also updates city stats
civ.cache.updateCivResources() // this building could be a resource-requiring one
}

View File

@ -131,6 +131,7 @@ class CityPopulationManager : IsPartOfGameInfoSerialization {
val freePopulation = getFreePopulation()
if (freePopulation < 0) {
unassignExtraPopulation()
city.cityStats.update()
} else {
autoAssignPopulation()
}
@ -267,8 +268,6 @@ class CityPopulationManager : IsPartOfGameInfoSerialization {
}
}
}
city.cityStats.update()
}
fun getMaxSpecialists(): Counter<String> {

View File

@ -536,7 +536,7 @@ class Civilization : IsPartOfGameInfoSerialization {
yieldAll(religionManager.religion!!.founderBeliefUniqueMap.getMatchingUniques(uniqueType, stateForConditionals))
yieldAll(getCivResourceSupply().asSequence()
.filter { it.amount > 0 }
.filter { it.amount > 0 && it.resource.uniques.isNotEmpty() }
.flatMap { it.resource.getMatchingUniques(uniqueType, stateForConditionals) }
)