Always mark 'PromotedEntity' on transform

If the new entity did not have Promotion, we would fail to do so.
Not doing this caused ghost units to appear when promoting inside a GarrisonHolder.

Fixes #7472, reported by Langbart.
This commit is contained in:
freagarach
2025-01-09 20:35:20 +01:00
committed by Lancelot de Ferrière
parent 4be8e0bcfb
commit 1d6f7f3837
@@ -85,12 +85,13 @@ function ChangeEntityTemplate(oldEnt, newTemplate)
cmpNewHealth.SetHitpoints(cmpNewHealth.GetMaxHitpoints() * healthLevel);
}
let cmpPromotion = Engine.QueryInterface(oldEnt, IID_Promotion);
let cmpNewPromotion = Engine.QueryInterface(newEnt, IID_Promotion);
if (cmpPromotion && cmpNewPromotion)
const cmpPromotion = Engine.QueryInterface(oldEnt, IID_Promotion);
if (cmpPromotion)
{
cmpPromotion.SetPromotedEntity(newEnt);
cmpNewPromotion.IncreaseXp(cmpPromotion.GetCurrentXp());
const cmpNewPromotion = Engine.QueryInterface(newEnt, IID_Promotion);
if (cmpNewPromotion)
cmpNewPromotion.IncreaseXp(cmpPromotion.GetCurrentXp());
}
let cmpResGatherer = Engine.QueryInterface(oldEnt, IID_ResourceGatherer);