From 932966dd97f8ffbcbb1ac69fac9fe817682d829b Mon Sep 17 00:00:00 2001 From: Tedster59 Date: Wed, 10 Jul 2024 16:47:08 -0400 Subject: [PATCH] Update ShowPromotionUI to not cast as directly Updates the function to cast only to UIArmory_Promotion instead of its subclasses. Also adds missing brackets to if/else statements. --- .../XComGame/Classes/XComHQPresentationLayer.uc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/X2WOTCCommunityHighlander/Src/XComGame/Classes/XComHQPresentationLayer.uc b/X2WOTCCommunityHighlander/Src/XComGame/Classes/XComHQPresentationLayer.uc index dbaa89662..c7964bf7d 100644 --- a/X2WOTCCommunityHighlander/Src/XComGame/Classes/XComHQPresentationLayer.uc +++ b/X2WOTCCommunityHighlander/Src/XComGame/Classes/XComHQPresentationLayer.uc @@ -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);