mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-15 18:28:42 +07:00
Clarify/optimize the role of the inProgressConstructions validator (#2433)
This commit is contained in:
@ -238,6 +238,7 @@ class CityConstructions {
|
||||
|
||||
fun endTurn(cityStats: Stats) {
|
||||
validateConstructionQueue()
|
||||
validateInProgressConstructions()
|
||||
|
||||
if(getConstruction(currentConstructionFromQueue) !is PerpetualConstruction)
|
||||
addProductionPoints(cityStats.production.roundToInt())
|
||||
@ -252,8 +253,12 @@ class CityConstructions {
|
||||
if (getConstruction(construction).isBuildable(this))
|
||||
constructionQueue.add(construction)
|
||||
}
|
||||
}
|
||||
|
||||
private fun validateInProgressConstructions() {
|
||||
// remove obsolete stuff from in progress constructions - happens often and leaves clutter in memory and save files
|
||||
// should have NO visible consequences - any accumulated points that may be reused later should stay (nukes when manhattan project city lost, nat wonder when conquered an empty city...)
|
||||
// Needs only be called once in a while - endTurn is enough
|
||||
val inProgressSnapshot = inProgressConstructions.keys.filter { it != currentConstructionFromQueue }
|
||||
for (constructionName in inProgressSnapshot) {
|
||||
val rejectionReason: String =
|
||||
|
Reference in New Issue
Block a user