- || try_1args(command, "w_keys_m", wrap_mod_selected_keyb, 'w')
- || try_2args(command, "w_keys_u", wrap_mv_kb_mod, 'w', 'u')
- || try_2args(command, "w_keys_d", wrap_mv_kb_mod, 'w', 'd')
- || try_2args(command, "g_keys_u", wrap_mv_kb_mod, 'G', 'u')
- || try_2args(command, "g_keys_d", wrap_mv_kb_mod, 'G', 'd')
- || try_2args(command, "wg_keys_u", wrap_mv_kb_mod, 'g', 'u')
- || try_2args(command, "wg_keys_d", wrap_mv_kb_mod, 'g', 'd')
- || try_2args(command, "wk_keys_u", wrap_mv_kb_mod, 'k', 'u')
- || try_2args(command, "wk_keys_d", wrap_mv_kb_mod, 'k', 'd'));
+ || 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_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'));
+}
+
+
+
+static uint8_t set_string_if_char_match(char c, char c_to_match,
+ char ** string, char * string_to_set)
+{
+ if (c == c_to_match)
+ {
+ *string = string_to_set;
+ return 1;
+ }
+ return 0;
+}
+
+
+
+static char * build_server_message_with_argument(struct Command * cmd)
+{
+ char * f_name = "build_server_message_with_argument()";
+ uint8_t command_size = strlen(cmd->server_msg);
+ char * arg_str;
+ uint8_t arg_size;
+ if ('i' == cmd->arg)
+ {
+ arg_size = 3;
+ arg_str = try_malloc(arg_size + 1, f_name);
+ int test = sprintf(arg_str, "%d",world.player_inventory_select);
+ exit_trouble(test < 0, f_name, "sprintf()");
+ }
+ else if ( set_string_if_char_match(cmd->arg, 'd', &arg_str, "east")
+ || set_string_if_char_match(cmd->arg, 'c', &arg_str, "south-east")
+ || set_string_if_char_match(cmd->arg, 'x', &arg_str, "south-west")
+ || set_string_if_char_match(cmd->arg, 's', &arg_str, "west")
+ || set_string_if_char_match(cmd->arg, 'w', &arg_str, "north-west")
+ || set_string_if_char_match(cmd->arg, 'e', &arg_str, "north-east"))
+ {
+ arg_size = strlen(arg_str);
+ }
+ else
+ {
+ exit_err(1, "Illegal server command argument.");
+ }
+ char * msg = try_malloc(command_size + 1 + arg_size + 1, f_name);
+ int test = sprintf(msg, "%s %s", cmd->server_msg, arg_str);
+ exit_trouble(test < 0, f_name, "sprintf()");
+ if ('i' == cmd->arg)
+ {
+ free(arg_str);
+ }
+ return msg;