Fixed goldkeys.cfg parser to accept characters which conflicts with the hashed values

This commit is contained in:
Alexander S. Aganichev 2002-06-16 10:13:02 +00:00
parent d6142085f7
commit 7373e3e991

View File

@ -986,17 +986,7 @@ int ReadKeysCfg(int force) {
continue;
}
*ptr++ = NUL;
keycmd = SwitchKeyDefs(strCrc16(strupr(ptr2)), &keytype);
if(keycmd) {
if(keytype) {
std::cout << "* " << cfgname << ": Invalid key \"" << ptr2 << "\" in line " << line << "." << std::endl;
SayBibi();
cfgerrors++;
continue;
}
keyval = keycmd;
}
else { // Either straight Key or $Key
// If either straight Key or $Key do not make lookup by CRC
if(*ptr2 == '$') {
uint _keyval = 0;
sscanf(ptr2+1, "%4x", &_keyval);
@ -1005,11 +995,14 @@ int ReadKeysCfg(int force) {
else if(strlen(ptr2) == 1)
keyval = (gkey)tolower(*ptr2); // Always convert to lowercase internally
else {
keycmd = SwitchKeyDefs(strCrc16(strupr(ptr2)), &keytype);
if(not keycmd or keytype) {
std::cout << "* " << cfgname << ": Invalid key \"" << ptr2 << "\" in line " << line << "." << std::endl;
SayBibi();
cfgerrors++;
continue;
}
keyval = keycmd;
}
ptr = strskip_wht(ptr);
ptr2 = ptr;