Skip to content

Commit

Permalink
use range check for physical enum
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon 'Sze' L. Schlee authored and Fulgen301 committed Sep 17, 2024
1 parent 624101e commit e8f76c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/C4HudBars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ void C4HudBarsUniquifier::ProcessHudBar(std::int32_t &valueIndex, const C4HudBar

C4Value physical{bar[C4VString("physical")]};
auto _physical = static_cast<C4HudBarDef::Physical>(physical.getInt());
if (_physical & ~C4HudBarDef::EBP_All) error("physical", physical);
if (C4HudBarDef::EBP_First <= _physical && _physical <= C4HudBarDef::EBP_Last) error("physical", physical);

C4Value hide{bar[C4VString("hide")]};
auto _hide = C4HudBarDef::EBH_Empty;
Expand Down
3 changes: 2 additions & 1 deletion src/C4HudBars.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class C4HudBarDef
EBP_Energy = 1,
EBP_Magic = 2,
EBP_Breath = 3,
EBP_All = EBP_Energy | EBP_Magic | EBP_Breath
EBP_First = EBP_None,
EBP_Last = EBP_Breath
};

enum Hide
Expand Down

0 comments on commit e8f76c4

Please sign in to comment.