diff options
Diffstat (limited to 'src/game/client')
| -rw-r--r-- | src/game/client/gc_console.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/game/client/gc_console.cpp b/src/game/client/gc_console.cpp index 90fc8afc..935aac91 100644 --- a/src/game/client/gc_console.cpp +++ b/src/game/client/gc_console.cpp @@ -456,12 +456,25 @@ bool console_input_cli(INPUT_EVENT e, void *user_data) return true; } +static bool console_execute_event(INPUT_EVENT e) +{ + // don't handle invalid events and keys that arn't set to anything + if(e.key <= 0 || e.key >= KEY_LAST || keybindings[e.key][0] == 0) + return false; + + int stroke = 0; + if(e.flags&INPFLAG_PRESS) + stroke = 1; + console_execute_line_stroked(stroke, keybindings[e.key]); + return true; +} + bool console_input_special_binds(INPUT_EVENT e, void *user_data) { // only handle function keys if(e.key < KEY_F1 || e.key > KEY_F25) return false; - return console_input_normal_binds(e, user_data); + return console_execute_event(e); } bool console_input_normal_binds(INPUT_EVENT e, void *user_data) @@ -469,16 +482,7 @@ bool console_input_normal_binds(INPUT_EVENT e, void *user_data) // need to be ingame for these binds if(client_state() != CLIENTSTATE_ONLINE) return false; - - // don't handle invalid events and keys that arn't set to anything - if(e.key <= 0 || e.key >= KEY_LAST || keybindings[e.key][0] == 0) - return false; - - int stroke = 0; - if(e.flags&INPFLAG_PRESS) - stroke = 1; - console_execute_line_stroked(stroke, keybindings[e.key]); - return true; + return console_execute_event(e); } void console_toggle(int type) |