[Change] Improved the keybind loading system somewhat.
This commit is contained in:
parent
770bad9ecc
commit
cdd5549ad3
@ -276,7 +276,7 @@ int conf_loadConfig(const char* file) {
|
||||
mod = NULL;
|
||||
lua_remove(L, -1);
|
||||
|
||||
if((key != SDLK_UNKNOWN) && (str != NULL)) {
|
||||
if(str != NULL) {
|
||||
/* Then the keybind is valid. Get the type. */
|
||||
if(strcmp(str, "null") ==0) type = KEYBIND_NULL;
|
||||
else if(strcmp(str, "keyboard") ==0) type = KEYBIND_KEYBOARD;
|
||||
@ -308,7 +308,7 @@ int conf_loadConfig(const char* file) {
|
||||
/* Set the keybind. */
|
||||
input_setKeybind((char*)keybindNames[i], type, key, m, reverse);
|
||||
} else {
|
||||
WARN("Malformed keybind in %s", file);
|
||||
WARN("Malformed keybind for %s in '%s'", keybindNames[i], file);
|
||||
}
|
||||
|
||||
/* Clean up after table crap. */
|
||||
|
@ -220,9 +220,15 @@ static void input_keyConvDestroy(void) {
|
||||
*/
|
||||
SDLKey input_keyConv(char* name) {
|
||||
SDLKey k;
|
||||
size_t l;
|
||||
char buf[2];
|
||||
|
||||
l = strlen(name);
|
||||
buf[0] = tolower(name[0]);
|
||||
buf[1] = '\0';
|
||||
|
||||
for(k = SDLK_FIRST; k < SDLK_LAST; k++)
|
||||
if(strcmp(name, keyconv[k])==0)
|
||||
if(strcmp((l==1) ? buf : name, keyconv[k])==0)
|
||||
return k;
|
||||
|
||||
WARN("Keyname '%s' doesn't match any key.", name);
|
||||
|
Loading…
Reference in New Issue
Block a user