Page 1 of 1

/bind some_key Num_+ not allowed with current parsing code

Posted: Tue Mar 16, 2004 3:05 am
by dweomer
Doing a /bind action_fade num_+ results in an "Invalid key combination" error message. However, this is a valid keycode name that I believe is used internally by the client. There are 2 ways to fix this, one is to make this somewhat ugly change to MQ2Main/MQ2Utilities.cpp:ParseKeyCombo at roughly line 2183

Code: Select all

for (unsigned long i=0 ; gDiKeyID[i].Id ; i++)
{
	[color=red]if ((!stricmp(text,gDiKeyID[i].szName))||(!stricmp(text,"num_")&&!stricmp("num_+",gDiKeyID[i].szName)))[/color]
	{
		Ret.Data[3]=(char)gDiKeyID[i].Id;
		break;
	}
}
Which has the potentially disconcerting side effect of allowing a mistype of num_ to be mistaken as num_+. The other fix is to disallow the + as a valid token delimiter which would in turn invalidate any configs with key combinations using + as a delimiter. (example: configs generated by /dumpbinds). To avoid the side-effect in the first solution I suppose one could write an ugly special condition check (before the input string is tokenized) for any substrings matching num_+ that do not have a corresponding substring match of num_++ at the very same index, ugh.

Well, I'll leave this to you Lax (or whomever).

Posted: Tue Mar 16, 2004 3:13 am
by Lax
Ahh another unexpected problem :)
dikeys.h

Code: Select all

	{"Num_Enter",	156},
	{"Num_Del",	83},
[color=red]
	{"Num_Slash",	181},
	{"Num_Minus",	74},
	{"Num_Plus",	78},
	{"Num_Asterisk",	55},
[/color]
That'll do. I've made that change and it's going to be in cvs.

Posted: Tue Mar 16, 2004 3:19 am
by dweomer
My laziness doth show :(

Although am glad that it was an easier fix!