home · contact · privacy
Use command IDs from command DB as what is recorded in record file.
[plomrogue] / src / command_db.c
index cbf6959e87322ff24a9a2d7e392160482450332f..2a37b405e505326f7e6faf8293211ee44ff825d2 100644 (file)
@@ -25,6 +25,41 @@ static void copy_tokenized_string(struct World * world,
 
 
 
+extern uint8_t is_command_id_shortdsc(struct World * world,
+                                      uint8_t id, char * shortdsc)
+{
+    struct Command * cmd_ptr = world->cmd_db->cmds;
+    while (1)
+    {
+        if (id == cmd_ptr->id)
+        {
+            if (strcmp(shortdsc, cmd_ptr->dsc_short))
+            {
+                return 0;
+            }
+            return 1;
+        }
+        cmd_ptr = &cmd_ptr[1];
+    }
+}
+
+
+
+extern uint8_t get_command_id(struct World * world, 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(struct World * world, char * dsc_short)
 {
     struct Command * cmd_ptr = world->cmd_db->cmds;