mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -04:00
Remove "last seen improvements" that are no longer valid improvements in mods
This commit is contained in:
parent
bfbd0ced32
commit
9b9f31995a
@ -30,6 +30,7 @@ object BackwardCompatibility {
|
|||||||
|
|
||||||
// Mod decided you can't repair things anymore - get rid of old pillaged improvements
|
// Mod decided you can't repair things anymore - get rid of old pillaged improvements
|
||||||
removeOldPillagedImprovements()
|
removeOldPillagedImprovements()
|
||||||
|
removeMissingLastSeenImprovements()
|
||||||
|
|
||||||
handleMissingReferencesForEachCity()
|
handleMissingReferencesForEachCity()
|
||||||
|
|
||||||
@ -69,6 +70,13 @@ object BackwardCompatibility {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun GameInfo.removeMissingLastSeenImprovements() {
|
||||||
|
for (civ in civilizations)
|
||||||
|
for ((vector,improvementName) in civ.lastSeenImprovement.toList())
|
||||||
|
if (!ruleset.tileImprovements.containsKey(improvementName))
|
||||||
|
civ.lastSeenImprovement.remove(vector)
|
||||||
|
}
|
||||||
|
|
||||||
private fun GameInfo.handleMissingReferencesForEachCity() {
|
private fun GameInfo.handleMissingReferencesForEachCity() {
|
||||||
for (city in civilizations.asSequence().flatMap { it.cities.asSequence() }) {
|
for (city in civilizations.asSequence().flatMap { it.cities.asSequence() }) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user