From: Christian Heller Date: Wed, 22 Jan 2014 00:04:28 +0000 (+0100) Subject: Removed unused client command id. X-Git-Tag: tce~884 X-Git-Url: https://plomlompom.com/repos/%7B%7Bitem_name%7D%7D?a=commitdiff_plain;h=8226d2e4e1aaaeb3b843b4eb9a178d71cc7896e1;p=plomrogue Removed unused client command id. --- diff --git a/confclient/commands b/confclient/commands index 9368f0b..19559de 100644 --- a/confclient/commands +++ b/confclient/commands @@ -1,51 +1,51 @@ -1 quit quit -2 wait wait / next turn -3 player_u player up -4 player_d player down -5 player_l player left -6 player_r player right -7 to_g_keywin toggle global keys window -8 to_mapwin toggle map window -9 to_infowin toggle info window -10 to_logwin toggle log window -11 to_wg_keywin toggle window geometry keys window -12 to_wk_keywin toggle window keybinding keys window -13 cyc_win_f cycle window selection forwards -14 winconf toggle window configuration view -15 cyc_win_b cycle window selection backwards -16 scrl_l scroll pad left -17 scrl_r scroll pad right -18 g_keys_d global keybindings nav down -19 g_keys_u global keybindings nav up -20 g_keys_m global keybindings modify -21 shift_f shift window forwards -22 shift_b shift window backwards -23 grow_h grow window horizontally -24 shri_h shrink window horizontally -25 grow_v grow window vertically -26 shri_v shrink window vertically -27 to_height_t toggle window height type -28 to_width_t toggle window width type -29 w_keys_d win keys nav down -30 w_keys_u win keys nav up -31 w_keys_m win keys mod -32 wg_keys_d win geometry config keybindings nav down -33 wg_keys_u win geometry config keybindings nav up -34 wg_keys_m win geometry config keybindings modify -35 wk_keys_d win keybindings config keybindings nav down -36 wk_keys_u win keybindings config keybindings nav up -37 wk_keys_m win keybindings config keybindings modify -38 reload_conf reload windows and keybindings configuration -39 save_conf save windows and keybindings -41 map_u map up -42 map_d map down -43 map_l map left -44 map_r map right -45 map_c map center player -46 to_a_keywin toggle view of available keybindings -46 to_inv toggle inventory window -47 drop drop object from inventory -48 pick pick up object from ground -49 inv_d inventory selection down -50 inv_u inventory selection up -51 use use selected inventory object +quit quit +wait wait / next turn +player_u player up +player_d player down +player_l player left +player_r player right +to_g_keywin toggle global keys window +to_mapwin toggle map window +to_infowin toggle info window +to_logwin toggle log window +to_wg_keywin toggle window geometry keys window +to_wk_keywin toggle window keybinding keys window +cyc_win_f cycle window selection forwards +winconf toggle window configuration view +cyc_win_b cycle window selection backwards +scrl_l scroll pad left +scrl_r scroll pad right +g_keys_d global keybindings nav down +g_keys_u global keybindings nav up +g_keys_m global keybindings modify +shift_f shift window forwards +shift_b shift window backwards +grow_h grow window horizontally +shri_h shrink window horizontally +grow_v grow window vertically +shri_v shrink window vertically +to_height_t toggle window height type +to_width_t toggle window width type +w_keys_d win keys nav down +w_keys_u win keys nav up +w_keys_m win keys mod +wg_keys_d win geometry config keybindings nav down +wg_keys_u win geometry config keybindings nav up +wg_keys_m win geometry config keybindings modify +wk_keys_d win keybindings config keybindings nav down +wk_keys_u win keybindings config keybindings nav up +wk_keys_m win keybindings config keybindings modify +reload_conf reload windows and keybindings configuration +save_conf save windows and keybindings +map_u map up +map_d map down +map_l map left +map_r map right +map_c map center player +to_a_keywin toggle view of available keybindings +to_inv toggle inventory window +drop drop object from inventory +pick pick up object from ground +inv_d inventory selection down +inv_u inventory selection up +use use selected inventory object diff --git a/src/client/command_db.c b/src/client/command_db.c index 846f87f..e9478c6 100644 --- a/src/client/command_db.c +++ b/src/client/command_db.c @@ -4,7 +4,7 @@ #include /* uint8_t, uint32_t */ #include /* FILE */ #include /* free() */ -#include /* memcpy(), strlen(), strtok(), strcmp() */ +#include /* memcpy(), strlen(), strtok() */ #include "../common/readwrite.h" /* try_fopen(), try_fclose(), try_fgets() * textfile_sizes() */ @@ -14,36 +14,21 @@ -/* Build string pointed to by "ch_ptr" from next token delimited by "delim". */ -static void copy_tokenized_string(char ** ch_ptr, char * delim); +/* Point "ch_ptr" to next strtok() string in "line" delimited by "delim".*/ +static void copy_tokenized_string(char * line, char ** ch_ptr, char * delim); -static void copy_tokenized_string(char ** ch_ptr, char * delim) +static void copy_tokenized_string(char * line, char ** ch_ptr, char * delim) { char * f_name = "copy_tokenized_string()"; - char * dsc_ptr = strtok(NULL, delim); + char * dsc_ptr = strtok(line, delim); * ch_ptr = try_malloc(strlen(dsc_ptr) + 1, f_name); memcpy(* ch_ptr, dsc_ptr, strlen(dsc_ptr) + 1); } -extern uint8_t get_command_id(char * dsc_short) -{ - struct Command * cmd_ptr = world.cmd_db.cmds; - while (1) - { - if (0 == strcmp(dsc_short, cmd_ptr->dsc_short)) - { - return cmd_ptr->id; - } - cmd_ptr = &cmd_ptr[1]; - } -} - - - extern char * get_command_longdsc(char * dsc_short) { struct Command * cmd_ptr = world.cmd_db.cmds; @@ -75,9 +60,8 @@ extern void init_command_db() { break; } - world.cmd_db.cmds[i].id = atoi(strtok(line, " ")); - copy_tokenized_string(&world.cmd_db.cmds[i].dsc_short, " "); - copy_tokenized_string(&world.cmd_db.cmds[i].dsc_long, "\n"); + copy_tokenized_string(line, &world.cmd_db.cmds[i].dsc_short, " "); + copy_tokenized_string(NULL, &world.cmd_db.cmds[i].dsc_long, "\n"); i++; } try_fclose(file, f_name); diff --git a/src/client/command_db.h b/src/client/command_db.h index 0d4ffba..9ed55d9 100644 --- a/src/client/command_db.h +++ b/src/client/command_db.h @@ -15,7 +15,6 @@ struct Command { char * dsc_short; /* short string name of command to be used internally */ char * dsc_long; /* long string description of command for the user */ - uint8_t id; /* unique identifier of command */ }; struct CommandDB @@ -26,9 +25,6 @@ struct CommandDB -/* Give short description of command ("dsc_short"), get its ID. */ -extern uint8_t get_command_id(char * dsc_short); - /* Give short description of command ("dsc_short"), get long description. */ extern char * get_command_longdsc(char * dsc_short); diff --git a/src/client/control.c b/src/client/control.c index bdbdfec..5585ded 100644 --- a/src/client/control.c +++ b/src/client/control.c @@ -4,7 +4,6 @@ #include /* uint8_t, uint16_t */ #include /* sprintf() */ #include /* strlen(), strcmp() */ -#include "command_db.h" /* get_command_id() */ #include "io.h" /* try_send() */ #include "keybindings.h" /* struct KeyBindingDB, get_command_to_keycode(), * get_keycode_to_command(), mod_selected_keyb(),