Fixes bug where upgrading units would no longer provide their default upgrades (#4948)

This commit is contained in:
Xander Lenstra
2021-08-22 13:07:50 +02:00
committed by GitHub
parent 33cba2eea9
commit 22be1c92e6

View File

@ -229,6 +229,10 @@ class MapUnit {
newUnit.currentMovement = currentMovement
newUnit.attacksThisTurn = attacksThisTurn
newUnit.isTransported = isTransported
for (promotion in newUnit.promotions.promotions)
if (promotion !in promotions.promotions)
promotions.addPromotion(promotion, isFree = true)
newUnit.promotions = promotions.clone()
newUnit.updateUniques()
@ -723,7 +727,7 @@ class MapUnit {
fun removeFromTile() = currentTile.removeUnit(this)
fun moveThroughTile(tile: TileInfo) {
// addPromotion requires currentTile to be valid because it accesses ruleset through it
// addPromotion requires currentTile to be valid because it accesses ruleset through it.
// getAncientRuinBonus, if it places a new unit, does too
currentTile = tile