From e0392d69c4eee473d023e6c8b5436b8db02d687c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 14 Mar 2020 17:59:39 -0400 Subject: [PATCH] CHudEnergyInterface: Make use of std::array where applicable --- Runtime/GuiSys/CHudEnergyInterface.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Runtime/GuiSys/CHudEnergyInterface.cpp b/Runtime/GuiSys/CHudEnergyInterface.cpp index f56fa4513..e664f2bed 100644 --- a/Runtime/GuiSys/CHudEnergyInterface.cpp +++ b/Runtime/GuiSys/CHudEnergyInterface.cpp @@ -1,5 +1,7 @@ #include "Runtime/GuiSys/CHudEnergyInterface.hpp" +#include + #include "Runtime/GameGlobalObjects.hpp" #include "Runtime/Audio/CSfxManager.hpp" #include "Runtime/GuiSys/CAuiEnergyBarT01.hpp" @@ -10,12 +12,15 @@ namespace urde { -static const CAuiEnergyBarT01::FCoordFunc CoordFuncs[] = { +constexpr std::array CoordFuncs{ CHudEnergyInterface::CombatEnergyCoordFunc, CHudEnergyInterface::CombatEnergyCoordFunc, - CHudEnergyInterface::XRayEnergyCoordFunc, CHudEnergyInterface::ThermalEnergyCoordFunc, - CHudEnergyInterface::BallEnergyCoordFunc}; + CHudEnergyInterface::XRayEnergyCoordFunc, CHudEnergyInterface::ThermalEnergyCoordFunc, + CHudEnergyInterface::BallEnergyCoordFunc, +}; -static const float Tesselations[] = {0.2f, 0.2f, 0.1f, 0.2f, 1.f}; +constexpr std::array Tesselations{ + 0.2f, 0.2f, 0.1f, 0.2f, 1.f, +}; CHudEnergyInterface::CHudEnergyInterface(CGuiFrame& selHud, float tankEnergy, int totalEnergyTanks, int numTanksFilled, bool energyLow, EHudType hudType) @@ -33,8 +38,8 @@ CHudEnergyInterface::CHudEnergyInterface(CGuiFrame& selHud, float tankEnergy, in x28_textpane_energywarning = static_cast(selHud.FindWidget("textpane_energywarning")); x2c_energybart01_energybar = static_cast(selHud.FindWidget("energybart01_energybar")); - x2c_energybart01_energybar->SetCoordFunc(CoordFuncs[int(hudType)]); - x2c_energybart01_energybar->SetTesselation(Tesselations[int(hudType)]); + x2c_energybart01_energybar->SetCoordFunc(CoordFuncs[size_t(hudType)]); + x2c_energybart01_energybar->SetTesselation(Tesselations[size_t(hudType)]); ITweakGuiColors::VisorEnergyBarColors barColors = g_tweakGuiColors->GetVisorEnergyBarColors(int(hudType)); ITweakGuiColors::VisorEnergyInitColors initColors = g_tweakGuiColors->GetVisorEnergyInitColors(int(hudType));