When binding a key, take care of processing one-to-many binds properly in menu.

This means that the "Keyboard Setup" should now properly reflect the bindings,
except in the theoretical case of one gamefunc being bound more than two keys.
(What was fixed is the one key to many gamefuncs case.)

git-svn-id: https://svn.eduke32.com/eduke32@3126 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-11-06 23:06:40 +00:00
parent 27c0c9c342
commit 935f3ec50d

View file

@ -1012,16 +1012,32 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm)
KeyBindings[ConsoleKeys[i].id].key=ConsoleKeys[i].name;
// populate the keyboard config menu based on the bind
if (!Bstrncasecmp(tempbuf, "gamefunc_", 9))
{
j = CONFIG_FunctionNameToNum(tempbuf+9);
char *cp = tempbuf;
if (j != -1)
// Populate the keyboard config menu based on the bind.
// Take care of processing one-to-many bindings properly, too.
while ((cp = Bstrstr(cp, "gamefunc_")))
{
ud.config.KeyboardKeys[j][1] = ud.config.KeyboardKeys[j][0];
ud.config.KeyboardKeys[j][0] = ConsoleKeys[i].id;
char *semi;
cp += 9; // skip the "gamefunc_"
semi = Bstrchr(cp, ';');
if (semi)
*semi = 0;
j = CONFIG_FunctionNameToNum(cp);
if (semi)
cp = semi+1;
if (j != -1)
{
ud.config.KeyboardKeys[j][1] = ud.config.KeyboardKeys[j][0];
ud.config.KeyboardKeys[j][0] = ConsoleKeys[i].id;
// CONTROL_MapKey(j, ConsoleKeys[i].id, ud.config.KeyboardKeys[j][0]);
}
}
}