mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 09:38:19 +00:00
Fix key names for composite binds with multiple modifiers
This was only affecting the key names displayed in the voting HUD, e.g. with `bind "ctrl+alt+f3" "vote yes"` the voting HUD previously showed `+f3` as the key name.
This commit is contained in:
parent
d2222f55e7
commit
8fd40efe36
|
@ -196,21 +196,18 @@ const char *CBinds::Get(int KeyId, int ModifierCombination)
|
||||||
|
|
||||||
void CBinds::GetKey(const char *pBindStr, char *pBuf, size_t BufSize)
|
void CBinds::GetKey(const char *pBindStr, char *pBuf, size_t BufSize)
|
||||||
{
|
{
|
||||||
pBuf[0] = 0;
|
pBuf[0] = '\0';
|
||||||
for(int Mod = 0; Mod < MODIFIER_COMBINATION_COUNT; Mod++)
|
for(int Modifier = MODIFIER_NONE; Modifier < MODIFIER_COMBINATION_COUNT; Modifier++)
|
||||||
{
|
{
|
||||||
for(int KeyId = 0; KeyId < KEY_LAST; KeyId++)
|
for(int KeyId = KEY_FIRST; KeyId < KEY_LAST; KeyId++)
|
||||||
{
|
{
|
||||||
const char *pBind = Get(KeyId, Mod);
|
const char *pBind = Get(KeyId, Modifier);
|
||||||
if(!pBind[0])
|
if(!pBind[0])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(str_comp(pBind, pBindStr) == 0)
|
if(str_comp(pBind, pBindStr) == 0)
|
||||||
{
|
{
|
||||||
if(Mod)
|
str_format(pBuf, BufSize, "%s%s", GetKeyBindModifiersName(Modifier), Input()->KeyName(KeyId));
|
||||||
str_format(pBuf, BufSize, "%s+%s", GetModifierName(Mod), Input()->KeyName(KeyId));
|
|
||||||
else
|
|
||||||
str_copy(pBuf, Input()->KeyName(KeyId), BufSize);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue