-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
#include <stdint.h> /* uint8_t, uint32_t */
#include <stdio.h> /* FILE */
#include <stdlib.h> /* free() */
-#include <string.h> /* memcpy(), strlen(), strtok(), strcmp() */
+#include <string.h> /* memcpy(), strlen(), strtok() */
#include "../common/readwrite.h" /* try_fopen(), try_fclose(), try_fgets()
* textfile_sizes()
*/
-/* 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;
{
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);