mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-26 21:35:14 -04:00
Game can handle ongoing constructions "disappearing" between mod versions
This commit is contained in:
parent
a8e0f270a0
commit
088c716321
@ -347,12 +347,18 @@ class GameInfo {
|
|||||||
if (!ruleSet.buildings.containsKey(building))
|
if (!ruleSet.buildings.containsKey(building))
|
||||||
city.cityConstructions.builtBuildings.remove(building)
|
city.cityConstructions.builtBuildings.remove(building)
|
||||||
|
|
||||||
|
fun isInvalidConstruction(construction: String) = !ruleSet.buildings.containsKey(construction) && !ruleSet.units.containsKey(construction)
|
||||||
|
&& !PerpetualConstruction.perpetualConstructionsMap.containsKey(construction)
|
||||||
|
|
||||||
// Remove invalid buildings or units from the queue - don't just check buildings and units because it might be a special construction as well
|
// Remove invalid buildings or units from the queue - don't just check buildings and units because it might be a special construction as well
|
||||||
for (construction in city.cityConstructions.constructionQueue.toList()) {
|
for (construction in city.cityConstructions.constructionQueue.toList()) {
|
||||||
if (!ruleSet.buildings.containsKey(construction) && !ruleSet.units.containsKey(construction)
|
if (isInvalidConstruction(construction))
|
||||||
&& !PerpetualConstruction.perpetualConstructionsMap.containsKey(construction))
|
|
||||||
city.cityConstructions.constructionQueue.remove(construction)
|
city.cityConstructions.constructionQueue.remove(construction)
|
||||||
}
|
}
|
||||||
|
// And from being in progess
|
||||||
|
for (construction in city.cityConstructions.inProgressConstructions.keys.toList())
|
||||||
|
if (isInvalidConstruction(construction))
|
||||||
|
city.cityConstructions.inProgressConstructions.remove(construction)
|
||||||
}
|
}
|
||||||
for (civinfo in civilizations) {
|
for (civinfo in civilizations) {
|
||||||
for (tech in civinfo.tech.techsResearched.toList())
|
for (tech in civinfo.tech.techsResearched.toList())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user