mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-26 23:58:43 +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) {
|
fun endTurn(cityStats: Stats) {
|
||||||
validateConstructionQueue()
|
validateConstructionQueue()
|
||||||
|
validateInProgressConstructions()
|
||||||
|
|
||||||
if(getConstruction(currentConstructionFromQueue) !is PerpetualConstruction)
|
if(getConstruction(currentConstructionFromQueue) !is PerpetualConstruction)
|
||||||
addProductionPoints(cityStats.production.roundToInt())
|
addProductionPoints(cityStats.production.roundToInt())
|
||||||
@ -252,8 +253,12 @@ class CityConstructions {
|
|||||||
if (getConstruction(construction).isBuildable(this))
|
if (getConstruction(construction).isBuildable(this))
|
||||||
constructionQueue.add(construction)
|
constructionQueue.add(construction)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun validateInProgressConstructions() {
|
||||||
// remove obsolete stuff from in progress constructions - happens often and leaves clutter in memory and save files
|
// 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...)
|
// 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 }
|
val inProgressSnapshot = inProgressConstructions.keys.filter { it != currentConstructionFromQueue }
|
||||||
for (constructionName in inProgressSnapshot) {
|
for (constructionName in inProgressSnapshot) {
|
||||||
val rejectionReason: String =
|
val rejectionReason: String =
|
||||||
|
Reference in New Issue
Block a user