mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 01:29:50 +00:00
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:
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);
|
||||
|
||||
Reference in New Issue
Block a user