Skip to content

Commit

Permalink
Update ShowPromotionUI to not cast as directly
Browse files Browse the repository at this point in the history
Updates the function to cast only to UIArmory_Promotion instead of its subclasses.
Also adds missing brackets to if/else statements.
  • Loading branch information
Tedster59 authored and Iridar committed Jul 15, 2024
1 parent cc1ce8a commit 932966d
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1497,16 +1497,27 @@ function ShowPromotionUI(StateObjectReference UnitRef, optional bool bInstantTra

UnitState = XComGameState_Unit(`XCOMHISTORY.GetGameStateForObjectID(UnitRef.ObjectID));

/// HL-Docs: ref:Bugfixes; issue:1356
/// ShowPromotionUI now casts the spawned promotion screen to UIArmory_Promotion instead of its subclasses

// Start Issue #600: Replaced class literals with the local variables
if (UnitState.IsResistanceHero() || ScreenStack.IsInStack(class'UIFacility_TrainingCenter'))
PromotionUI = UIArmory_PromotionHero(ScreenStack.Push(
{
// Issue #1356 - Cast to UIArmory_Promotion instead of UIArmory_PromotionHero
PromotionUI = UIArmory_Promotion(ScreenStack.Push(
Spawn(TriggerOverridePromotionUIClass(eCHLPST_Hero), self), Get3DMovie()));
}
else if (UnitState.GetSoldierClassTemplateName() == 'PsiOperative')
PromotionUI = UIArmory_PromotionPsiOp(ScreenStack.Push(
{
// Issue #1356 - Cast to UIArmory_Promotion instead of UIArmory_PromotionPsiOp
PromotionUI = UIArmory_Promotion(ScreenStack.Push(
Spawn(TriggerOverridePromotionUIClass(eCHLPST_PsiOp), self), Get3DMovie()));
}
else
{
PromotionUI = UIArmory_Promotion(ScreenStack.Push(
Spawn(TriggerOverridePromotionUIClass(eCHLPST_Standard), self), Get3DMovie()));
}
// End Issue #600

PromotionUI.InitPromotion(UnitRef, bInstantTransition);
Expand Down

0 comments on commit 932966d

Please sign in to comment.