Resolved #13043 - Remove great person point accumulation for units no longer available in this ruleset

This commit is contained in:
yairm210 2025-03-09 12:26:23 +02:00
parent 9317e896e9
commit 78f6c8c602

View File

@ -27,6 +27,7 @@ object BackwardCompatibility {
tileMap.removeMissingTerrainModReferences(ruleset)
removeUnitsAndPromotions()
removeMissingGreatPersonPoints()
// Mod decided you can't repair things anymore - get rid of old pillaged improvements
removeOldPillagedImprovements()
@ -57,6 +58,18 @@ object BackwardCompatibility {
}
}
private fun GameInfo.removeMissingGreatPersonPoints() {
for (civ in civilizations) {
// Don't remove the 'points to next' counters, since pools do not necessarily correspond to unit names
for (key in civ.greatPeople.greatGeneralPointsCounter.keys.toList())
if (!ruleset.units.containsKey(key))
civ.greatPeople.greatGeneralPointsCounter.remove(key)
for (key in civ.greatPeople.greatPersonPointsCounter.keys.toList())
if (!ruleset.units.containsKey(key))
civ.greatPeople.greatPersonPointsCounter.remove(key)
}
}
private fun GameInfo.removeOldPillagedImprovements() {
if (!ruleset.tileImprovements.containsKey(Constants.repair))
for (tile in tileMap.values) {