Don't use flags; use a bool

This commit is contained in:
Zach Fox 2018-06-27 14:59:46 -07:00
parent 2347634d72
commit 8ba184db6a
2 changed files with 6 additions and 6 deletions

View file

@ -93,22 +93,22 @@ void OverlayConductor::update(float dt) {
bool shouldRecenter = false; bool shouldRecenter = false;
if (_flags & SuppressedByHead) { if (_suppressedByHead) {
if (isAtRest) { if (isAtRest) {
_flags &= ~SuppressedByHead; _suppressedByHead = false;
shouldRecenter = true; shouldRecenter = true;
} }
} else { } else {
if (_hmdMode && headOutsideOverlay()) { if (_hmdMode && headOutsideOverlay()) {
_flags |= SuppressedByHead; _suppressedByHead = true;
} }
} }
bool targetVisible = Menu::getInstance()->isOptionChecked(MenuOption::Overlays) && (0 == (_flags & SuppressedByHead)); bool targetVisible = Menu::getInstance()->isOptionChecked(MenuOption::Overlays) && !_suppressedByHead;
if (targetVisible != currentVisible) { if (targetVisible != currentVisible) {
offscreenUi->setPinned(!targetVisible); offscreenUi->setPinned(!targetVisible);
} }
if (shouldRecenter && !_flags) { if (shouldRecenter && !_suppressedByHead) {
centerUI(); centerUI();
} }
} }

View file

@ -29,7 +29,7 @@ private:
SuppressedByHead = 0x01 SuppressedByHead = 0x01
}; };
uint8_t _flags { SuppressedByHead }; bool _suppressedByHead { false };
bool _hmdMode { false }; bool _hmdMode { false };
// used by updateAvatarIsAtRest // used by updateAvatarIsAtRest