Console: Make State enum an enum class

Makes the enum strongly typed and impervious to implicit conversions.
This commit is contained in:
Lioncash 2019-10-21 01:53:03 -04:00
parent 12d6a5ce05
commit a0e6ec0de7
2 changed files with 3 additions and 2 deletions

View File

@ -55,7 +55,7 @@ public:
Fatal /**< Non-recoverable error message (Kept for compatibility with logvisor) */ Fatal /**< Non-recoverable error message (Kept for compatibility with logvisor) */
}; };
enum State { Closed, Closing, Opened, Opening }; enum class State { Closed, Closing, Opened, Opening };
private: private:
CVarManager* m_cvarMgr = nullptr; CVarManager* m_cvarMgr = nullptr;

View File

@ -242,8 +242,9 @@ void Console::handleCharCode(unsigned long chr, boo::EModifierKey /*mod*/, bool
} }
void Console::handleSpecialKeyDown(boo::ESpecialKey sp, boo::EModifierKey mod, bool /*repeat*/) { void Console::handleSpecialKeyDown(boo::ESpecialKey sp, boo::EModifierKey mod, bool /*repeat*/) {
if (m_state != Opened) if (m_state != State::Opened) {
return; return;
}
switch (sp) { switch (sp) {
case boo::ESpecialKey::Insert: case boo::ESpecialKey::Insert: