Fix broken key helper in callvote popup

This commit is contained in:
Jordy Ruiz 2018-12-05 16:02:10 +01:00
parent 834a433ca8
commit 583e37f418
2 changed files with 8 additions and 4 deletions

View file

@ -160,9 +160,9 @@ const char *CBinds::Get(int KeyID, int Modifier)
return ""; return "";
} }
void CBinds::GetKey(const char *pBindStr, char aBuf[64], unsigned BufSize) void CBinds::GetKey(const char *pBindStr, char aKey[64], unsigned BufSize)
{ {
aBuf[0] = 0; aKey[0] = 0;
for(int KeyID = 0; KeyID < KEY_LAST; KeyID++) for(int KeyID = 0; KeyID < KEY_LAST; KeyID++)
{ {
for(int m = 0; m < MODIFIER_COUNT; m++) for(int m = 0; m < MODIFIER_COUNT; m++)
@ -172,9 +172,13 @@ void CBinds::GetKey(const char *pBindStr, char aBuf[64], unsigned BufSize)
continue; continue;
if(str_comp(pBind, pBindStr) == 0) if(str_comp(pBind, pBindStr) == 0)
str_format(aBuf, BufSize, "key %s%s not found", Input()->KeyName(KeyID), GetModifierName(m)); {
str_format(aKey, BufSize, "%s%s", GetModifierName(m), Input()->KeyName(KeyID));
return;
}
} }
} }
str_copy(aKey, "key not found", BufSize);
} }
void CBinds::SetDefaults() void CBinds::SetDefaults()

View file

@ -42,7 +42,7 @@ public:
void SetDefaults(); void SetDefaults();
void UnbindAll(); void UnbindAll();
const char *Get(int KeyID, int Modifier); const char *Get(int KeyID, int Modifier);
void GetKey(const char *pBindStr, char aBuf[64], unsigned BufSize); void GetKey(const char *pBindStr, char aKey[64], unsigned BufSize);
static const char *GetModifierName(int m); static const char *GetModifierName(int m);
static int GetModifierMask(IInput *i); static int GetModifierMask(IInput *i);
static int GetModifierMaskOfKey(int Key); static int GetModifierMaskOfKey(int Key);