home · contact · privacy
Removed unused client command id.
[plomrogue] / src / client / command_db.c
index 846f87ff579483e55ff355d6fb78213f0c57b644..e9478c60d284f805843a2a307033d25eae87a3cd 100644 (file)
@@ -4,7 +4,7 @@
 #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;
@@ -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);