From 22be1c92e6a23fbd8693bb2771348caca14b9e8e Mon Sep 17 00:00:00 2001 From: Xander Lenstra <71121390+xlenstra@users.noreply.github.com> Date: Sun, 22 Aug 2021 13:07:50 +0200 Subject: [PATCH] Fixes bug where upgrading units would no longer provide their default upgrades (#4948) --- core/src/com/unciv/logic/map/MapUnit.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/logic/map/MapUnit.kt b/core/src/com/unciv/logic/map/MapUnit.kt index 252aba1efb..b5e29f5652 100644 --- a/core/src/com/unciv/logic/map/MapUnit.kt +++ b/core/src/com/unciv/logic/map/MapUnit.kt @@ -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