Fixed crash when a worker tries to build a cached improvement that it can't build (#10854)

* Worker won't try to build the cached improvement that it can't build

* Accounted for the repair case as well
This commit is contained in:
Oskar Niesen 2024-01-04 01:04:05 -06:00 committed by GitHub
parent 1a0bdff019
commit fa9d7e1ca7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -564,7 +564,9 @@ class WorkerAutomation(
}
}
}
// A better tile than this unit can build might have been stored in the cache
if (!rank.repairImprovment!! && (rank.bestImprovement == null ||
!unit.canBuildImprovement(rank.bestImprovement!!, tile))) return -100f
return rank.improvementPriority!!
}