Commenting and cleanups
[open-adventure.git] / misc.c
diff --git a/misc.c b/misc.c
index 6132b92150bd36756d56bdbab8bd1a02d5fad41d..36339289ad71b8af759dc7738fe6a78e5a32318e 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -511,6 +511,7 @@ static void tokenize(char* raw, command_t *cmd)
     /* populate command with parsed vocabulary metadata */
     get_vocab_metadata(cmd->word[0].raw, &(cmd->word[0].id), &(cmd->word[0].type));
     get_vocab_metadata(cmd->word[1].raw, &(cmd->word[1].id), &(cmd->word[1].type));
+    cmd->state = TOKENIZED;
 }
 
 bool get_command_input(command_t *command)
@@ -551,9 +552,21 @@ bool get_command_input(command_t *command)
            command->word[1].id);
 #endif
 
+    command->state = GIVEN;
     return true;
 }
 
+void clear_command(command_t *cmd)
+/* Resets the state of the command to empty */
+{
+    cmd->verb = ACT_NULL;
+    cmd->part = unknown;
+    game.oldobj = cmd->obj;
+    cmd->obj = NO_OBJECT;
+    cmd->state = EMPTY;
+}
+
+
 void juggle(obj_t object)
 /*  Juggle an object by picking it up and putting it down again, the purpose
  *  being to get the object to the front of the chain of things at its loc. */