From 583e37f418811626d9c3a91942fe095e252d2044 Mon Sep 17 00:00:00 2001 From: Jordy Ruiz Date: Wed, 5 Dec 2018 16:02:10 +0100 Subject: [PATCH] Fix broken key helper in callvote popup --- src/game/client/components/binds.cpp | 10 +++++++--- src/game/client/components/binds.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/game/client/components/binds.cpp b/src/game/client/components/binds.cpp index a83ac5dce..9ef227fae 100644 --- a/src/game/client/components/binds.cpp +++ b/src/game/client/components/binds.cpp @@ -160,9 +160,9 @@ const char *CBinds::Get(int KeyID, int Modifier) 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 m = 0; m < MODIFIER_COUNT; m++) @@ -172,9 +172,13 @@ void CBinds::GetKey(const char *pBindStr, char aBuf[64], unsigned BufSize) continue; 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() diff --git a/src/game/client/components/binds.h b/src/game/client/components/binds.h index d24189745..5a38707b4 100644 --- a/src/game/client/components/binds.h +++ b/src/game/client/components/binds.h @@ -42,7 +42,7 @@ public: void SetDefaults(); void UnbindAll(); 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 int GetModifierMask(IInput *i); static int GetModifierMaskOfKey(int Key);