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