From: Christian Heller Date: Wed, 22 Jan 2014 05:20:35 +0000 (+0100) Subject: Client: Optimized order in which the command matching list is run through. X-Git-Tag: tce~880 X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bprefix%7D%7D/%7B%7Bdb.prefix%7D%7D/static/todo?a=commitdiff_plain;h=f23a01df6711bdad4ef638161ff26204075b23d3;p=plomrogue Client: Optimized order in which the command matching list is run through. --- diff --git a/src/client/control.c b/src/client/control.c index 906cf29..4c512dc 100644 --- a/src/client/control.c +++ b/src/client/control.c @@ -81,10 +81,15 @@ static uint8_t try_2args(struct Command * command, char * match, static uint8_t try_client_commands(struct Command * command) { - return ( try_0args(command, "winconf", toggle_winconfig) - || try_0args(command, "reload_conf", reload_interface_conf) - || try_0args(command, "save_conf", save_interface_conf) - || try_0args(command, "map_c", map_center) + return ( try_0args(command, "map_c", map_center) + || try_1args(command, "map_u", map_scroll, 'N') + || try_1args(command, "map_d", map_scroll, 'S') + || try_1args(command, "map_r", map_scroll, 'E') + || try_1args(command, "map_l", map_scroll, 'W') + || try_1args(command, "inv_u", nav_inventory, 'u') + || try_1args(command, "inv_d", nav_inventory, 'd') + || try_1args(command, "cyc_win_f", cycle_active_win, 'f') + || try_1args(command, "cyc_win_b", cycle_active_win, 'b') || try_1args(command, "scrl_r", scroll_pad, '+') || try_1args(command, "scrl_l", scroll_pad, '-') || try_1args(command, "to_a_keywin", toggle_window, 'k') @@ -95,34 +100,29 @@ static uint8_t try_client_commands(struct Command * command) || try_1args(command, "to_infowin", toggle_window, 'i') || try_1args(command, "to_inv", toggle_window, 'c') || try_1args(command, "to_logwin", toggle_window, 'l') - || try_1args(command, "cyc_win_f", cycle_active_win, 'f') - || try_1args(command, "cyc_win_b", cycle_active_win, 'b') - || try_1args(command, "inv_u", nav_inventory, 'u') - || try_1args(command, "inv_d", nav_inventory, 'd') - || try_1args(command, "map_u", map_scroll, 'N') - || try_1args(command, "map_d", map_scroll, 'S') - || try_1args(command, "map_r", map_scroll, 'E') - || try_1args(command, "map_l", map_scroll, 'W') - || try_1args(command, "to_height_t", toggle_win_size_type, 'y') - || try_1args(command, "to_width_t", toggle_win_size_type, 'x') + || try_0args(command, "winconf", toggle_winconfig) || try_1args(command, "grow_h", growshrink_active_window, '*') || try_1args(command, "shri_h", growshrink_active_window, '_') || try_1args(command, "grow_v", growshrink_active_window, '+') || try_1args(command, "shri_v", growshrink_active_window, '-') + || try_1args(command, "to_height_t", toggle_win_size_type, 'y') + || try_1args(command, "to_width_t", toggle_win_size_type, 'x') || try_1args(command, "shift_f", shift_active_win, 'f') || try_1args(command, "shift_b", shift_active_win, 'b') + || try_0args(command, "reload_conf", reload_interface_conf) + || try_0args(command, "save_conf", save_interface_conf) || try_1args(command, "g_keys_m", mod_selected_keyb, 'G') - || try_1args(command, "wg_keys_m", mod_selected_keyb, 'g') - || try_1args(command, "wk_keys_m", mod_selected_keyb, 'k') + || try_2args(command, "g_keys_u", move_keyb_selection, 'G', 'u') + || try_2args(command, "g_keys_d", move_keyb_selection, 'G', 'd') || try_1args(command, "w_keys_m", mod_selected_keyb, 'w') + || try_2args(command, "w_keys_u", move_keyb_selection, 'w', 'u') + || try_2args(command, "w_keys_d", move_keyb_selection, 'w', 'd') + || try_1args(command, "wg_keys_m", mod_selected_keyb, 'g') || try_2args(command, "wg_keys_u", move_keyb_selection, 'g', 'u') || try_2args(command, "wg_keys_d", move_keyb_selection, 'g', 'd') + || try_1args(command, "wk_keys_m", mod_selected_keyb, 'k') || try_2args(command, "wk_keys_u", move_keyb_selection, 'k', 'u') - || try_2args(command, "wk_keys_d", move_keyb_selection, 'k', 'd') - || try_2args(command, "w_keys_u", move_keyb_selection, 'w', 'u') - || try_2args(command, "w_keys_d", move_keyb_selection, 'w', 'd') - || try_2args(command, "g_keys_u", move_keyb_selection, 'G', 'u') - || try_2args(command, "g_keys_d", move_keyb_selection, 'G', 'd')); + || try_2args(command, "wk_keys_d", move_keyb_selection, 'k', 'd')); } @@ -169,17 +169,17 @@ extern uint8_t try_key(uint16_t key) } if (command) { - if (try_client_commands(command)) + if (try_server_commands(command)) { return 1; } - else if (!strcmp("quit", command->dsc_short)) + else if (try_client_commands(command)) { - return 2; + return 1; } - else if (try_server_commands(command)) + else if (!strcmp("quit", command->dsc_short)) { - return 1; + return 2; } } return 0;