mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-10 07:16:54 +07:00
Make sure units always have starting promotions. (#6051)
This commit is contained in:
parent
6a5d44c3e9
commit
88ecbc26b2
@ -130,4 +130,15 @@ object BackwardCompatibility {
|
||||
civilizations.flatMap { civ -> civ.diplomacy.values }.forEach { it.replaceFlag() }
|
||||
}
|
||||
|
||||
}
|
||||
/** Make sure all MapUnits have the starting promotions that they're supposed to. */
|
||||
fun GameInfo.guaranteeUnitPromotions() {
|
||||
for (tileInfo in tileMap.values) for (unit in tileInfo.getUnits()) {
|
||||
for (startingPromo in unit.baseUnit.promotions) {
|
||||
if (startingPromo !in unit.promotions.promotions) {
|
||||
unit.promotions.addPromotion(startingPromo, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.unciv.logic
|
||||
|
||||
import com.unciv.Constants
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.logic.BackwardCompatibility.guaranteeUnitPromotions
|
||||
import com.unciv.logic.BackwardCompatibility.removeMissingModReferences
|
||||
import com.unciv.logic.automation.NextTurnAutomation
|
||||
import com.unciv.logic.civilization.*
|
||||
@ -452,6 +453,8 @@ class GameInfo {
|
||||
.flatMap { it.getResourceRequirements().keys } )
|
||||
|
||||
barbarians.setTransients(this)
|
||||
|
||||
guaranteeUnitPromotions()
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
Loading…
Reference in New Issue
Block a user