mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 17:48:19 +00:00
Add assertions to CBinds::Bind
and Get
functions
This commit is contained in:
parent
8fd40efe36
commit
9f6cb92cb9
|
@ -51,8 +51,8 @@ CBinds::~CBinds()
|
||||||
|
|
||||||
void CBinds::Bind(int KeyId, const char *pStr, bool FreeOnly, int ModifierCombination)
|
void CBinds::Bind(int KeyId, const char *pStr, bool FreeOnly, int ModifierCombination)
|
||||||
{
|
{
|
||||||
if(KeyId < 0 || KeyId >= KEY_LAST)
|
dbg_assert(KeyId >= KEY_FIRST && KeyId < KEY_LAST, "KeyId invalid");
|
||||||
return;
|
dbg_assert(ModifierCombination >= MODIFIER_NONE && ModifierCombination < MODIFIER_COMBINATION_COUNT, "ModifierCombination invalid");
|
||||||
|
|
||||||
if(FreeOnly && Get(KeyId, ModifierCombination)[0])
|
if(FreeOnly && Get(KeyId, ModifierCombination)[0])
|
||||||
return;
|
return;
|
||||||
|
@ -189,9 +189,9 @@ void CBinds::UnbindAll()
|
||||||
|
|
||||||
const char *CBinds::Get(int KeyId, int ModifierCombination)
|
const char *CBinds::Get(int KeyId, int ModifierCombination)
|
||||||
{
|
{
|
||||||
if(KeyId > 0 && KeyId < KEY_LAST && m_aapKeyBindings[ModifierCombination][KeyId])
|
dbg_assert(KeyId >= KEY_FIRST && KeyId < KEY_LAST, "KeyId invalid");
|
||||||
return m_aapKeyBindings[ModifierCombination][KeyId];
|
dbg_assert(ModifierCombination >= MODIFIER_NONE && ModifierCombination < MODIFIER_COMBINATION_COUNT, "ModifierCombination invalid");
|
||||||
return "";
|
return m_aapKeyBindings[ModifierCombination][KeyId] ? m_aapKeyBindings[ModifierCombination][KeyId] : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBinds::GetKey(const char *pBindStr, char *pBuf, size_t BufSize)
|
void CBinds::GetKey(const char *pBindStr, char *pBuf, size_t BufSize)
|
||||||
|
|
Loading…
Reference in a new issue