Skip to content

Commit

Permalink
Make UIAvengerHUD::UpdateResources account for potential MCOs
Browse files Browse the repository at this point in the history
  • Loading branch information
remcoros authored Sep 18, 2023
1 parent b1da083 commit 4836b6f
Showing 1 changed file with 54 additions and 40 deletions.
94 changes: 54 additions & 40 deletions X2WOTCCommunityHighlander/Src/XComGame/Classes/UIAvengerHUD.uc
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,14 @@ simulated function UpdateResources()

CurrentScreen = `SCREENSTACK.GetCurrentScreen();

switch( CurrentScreen.Class )
// Start Issue #361: replaced 'switch' on CurrentScreen.Class to 'if' wih casting checks to support MCOs
if (UIFacilityGrid(CurrentScreen) != none)
{
case class'UIFacilityGrid':
UpdateDefaultResources();
UpdateStaff();
break;
case class'UIStrategyMap':
}
else if (UIStrategyMap(CurrentScreen) != none)
{
UpdateMonthlySupplies();
UpdateSupplies();
UpdateIntel();
Expand All @@ -139,82 +140,93 @@ simulated function UpdateResources()
UpdateScientistScore();
UpdateEngineerScore();
UpdateResContacts();
break;
case class'UIBlackMarket_Buy':
}
else if (UIBlackMarket_Buy(CurrentScreen) != none)
{
UpdateMonthlySupplies();
UpdateSupplies();
UpdateIntel();
UpdateEleriumCrystals();
UpdateAlienAlloys();
UpdateScientistScore();
UpdateEngineerScore();
break;
case class'UIBlackMarket_Sell':
}
else if (UIBlackMarket_Sell(CurrentScreen) != none)
{
UpdateMonthlySupplies();
UpdateSupplies();
break;
case class'UIResistanceGoods':
}
else if (UIResistanceGoods(CurrentScreen) != none)
{
UpdateMonthlySupplies();
UpdateSupplies();
UpdateScientistScore();
UpdateEngineerScore();
break;
case class'UIAdventOperations':
}
else if (UIAdventOperations(CurrentScreen) != none)
{
UpdateMonthlySupplies();
UpdateSupplies();
UpdateIntel();
break;
case class'UIChooseProject':
}
else if (UIChooseProject(CurrentScreen) != none)
{
UpdateMonthlySupplies();
UpdateSupplies();
UpdateEleriumCores();
UpdateEleriumCrystals();
UpdateAlienAlloys();
UpdateEngineerScore();
break;
case class'UIOfficerTrainingSchool':
case class'UIRecruitSoldiers':
}
else if (UIOfficerTrainingSchool(CurrentScreen) != none || UIRecruitSoldiers(CurrentScreen) != none)
{
UpdateMonthlySupplies();
UpdateSupplies();
break;
case class'UIBuildFacilities':
case class'UIChooseFacility':
}
else if (UIBuildFacilities(CurrentScreen) != none || UIChooseFacility(CurrentScreen) != none)
{
UpdateMonthlySupplies();
UpdateSupplies();
UpdatePower();
break;
case class'UIFacilityUpgrade':
case class'UIChooseUpgrade':
}
else if (UIFacilityUpgrade(CurrentScreen) != none || UIChooseUpgrade(CurrentScreen) != none)
{
UpdateMonthlySupplies();
UpdateSupplies();
UpdateEleriumCrystals();
UpdateAlienAlloys();
UpdatePower();
break;
case class'UIInventory_BuildItems':
}
else if (UIInventory_BuildItems(CurrentScreen) != none)
{
UpdateMonthlySupplies();
UpdateSupplies();
UpdateEleriumCrystals();
UpdateAlienAlloys();
UpdateEngineerScore();
break;
case class'UIChooseResearch':
}
else if (UIChooseResearch(CurrentScreen) != none)
{
UpdateIntel();
UpdateEleriumCrystals();
UpdateAlienAlloys();
UpdateScientistScore();
UpdateEngineerScore();
break;
case class'UIFacility_Labs':
}
else if (UIFacility_Labs(CurrentScreen) != none)
{
UpdateScientistScore();
break;
case class'UIFacility_PowerGenerator':
}
else if (UIFacility_PowerGenerator(CurrentScreen) != none)
{
UpdatePower();
break;
case class'UIFacility_ResistanceComms':
}
else if (UIFacility_ResistanceComms(CurrentScreen) != none)
{
UpdateResContacts();
break;
case class'UIAlert':
}
else if (UIAlert(CurrentScreen) != none)
{
if (UIAlert(CurrentScreen).eAlertName == 'eAlert_Contact')
{
UpdateIntel();
Expand All @@ -227,17 +239,19 @@ simulated function UpdateResources()
{
HideResources();
}
break;
case class'UICovertActions':
}
else if (UICovertActions(CurrentScreen) != none)
{
UpdateSupplies();
UpdateIntel();
UpdateAlienAlloys();
UpdateEleriumCrystals();
break;
default:
}
else
{
HideResources();
break;
}
// End Issue #361

// Issue #174 Start
// Add event hook. Mods should register for this event with an ELD_Immediate listener (for example using CHEventListenerTemplate)
Expand Down

0 comments on commit 4836b6f

Please sign in to comment.