perf: Don't update civ stats on auto assign population

This commit is contained in:
yairm210
2024-06-28 16:13:04 +03:00
parent 02737eb031
commit 98a3ec7805
2 changed files with 4 additions and 2 deletions

View File

@ -469,7 +469,9 @@ object UnitAutomation {
// this can be sped up if we check each layer separately
val unitDistanceToTiles = unit.movement.getDistanceToTilesAtPosition(
unit.getTile().position,
unit.getMaxMovement() * CLOSE_ENEMY_TURNS_AWAY_LIMIT
unit.getMaxMovement() * CLOSE_ENEMY_TURNS_AWAY_LIMIT,
// Consider ZoC is expensive - we just want to find the closest, not the exact movement we'll need to get there
false,
)
var closeEnemies = TargetHelper.getAttackableEnemies(
unit,

View File

@ -145,7 +145,7 @@ class CityPopulationManager : IsPartOfGameInfoSerialization {
/** Only assigns free population */
internal fun autoAssignPopulation() {
city.cityStats.update() // calculate current stats with current assignments
city.cityStats.update(updateCivStats = false) // calculate current stats with current assignments
val freePopulation = getFreePopulation()
if (freePopulation <= 0) return