From 09462cff679ab75558a48c43a666dc8d6004edc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Fri, 21 Apr 2023 18:38:46 +0200 Subject: [PATCH] Use `KEY_FIRST` and `KEY_UNKNOWN` instead of `0` --- src/engine/client/input.cpp | 4 ++-- src/game/client/components/binds.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/client/input.cpp b/src/engine/client/input.cpp index be20cf022..72931a86b 100644 --- a/src/engine/client/input.cpp +++ b/src/engine/client/input.cpp @@ -335,7 +335,7 @@ void CInput::Clear() bool CInput::KeyState(int Key) const { - if(Key < 0 || Key >= KEY_LAST) + if(Key < KEY_FIRST || Key >= KEY_LAST) return false; return m_aInputState[Key]; } @@ -618,7 +618,7 @@ int CInput::Update() } case SDL_TEXTINPUT: m_EditingTextLen = -1; - AddEvent(Event.text.text, 0, IInput::FLAG_TEXT); + AddEvent(Event.text.text, KEY_UNKNOWN, IInput::FLAG_TEXT); break; // handle keys case SDL_KEYDOWN: diff --git a/src/game/client/components/binds.cpp b/src/game/client/components/binds.cpp index 97ec13dd2..3080fa710 100644 --- a/src/game/client/components/binds.cpp +++ b/src/game/client/components/binds.cpp @@ -126,7 +126,7 @@ int CBinds::GetModifierMaskOfKey(int Key) bool CBinds::OnInput(const IInput::CEvent &Event) { // don't handle invalid events - if(Event.m_Key <= 0 || Event.m_Key >= KEY_LAST) + if(Event.m_Key <= KEY_FIRST || Event.m_Key >= KEY_LAST) return false; int Mask = GetModifierMask(Input());