Typedefify command_t; simplify code accordingly.
[open-adventure.git] / main.c
diff --git a/main.c b/main.c
index ba2f7d7597668f7c2eeb84292c76d6f41a405650..17a5e4371ebdf6a66315b23991d9953669999342 100644 (file)
--- a/main.c
+++ b/main.c
@@ -968,7 +968,7 @@ static void listobjects(void)
 static bool do_command()
 /* Get and execute a command */
 {
-    static struct command_t command;
+    static command_t command;
 
     /*  Can't leave cave once it's closing (except by main office). */
     if (OUTSID(game.newloc) && game.newloc != 0 && game.closng) {
@@ -1051,8 +1051,8 @@ Lclearobj:
             game.knfloc = 0;
 
        /* Preserve state from last command for reuse when required */
-       struct command_t preserve;
-       memcpy(&preserve, &command, sizeof(struct command_t));
+       command_t preserve;
+       memcpy(&preserve, &command, sizeof(command_t));
 
        // Get command input from user
         if (!get_command_input(&command))
@@ -1168,12 +1168,8 @@ Lookup:
             continue;  /* back to top of main interpreter loop */
         case GO_WORD2:
             /* Get second word for analysis. */
-            command.word[0].id = command.word[1].id;
-            command.word[0].type = command.word[1].type;
-            strncpy(command.word[0].raw, command.word[1].raw, LINESIZE - 1);
-            command.word[1].id = WORD_EMPTY;
-            command.word[1].type = NO_WORD_TYPE;
-            command.word[1].raw[0] = '\0';
+           command.word[0] = command.word[1];
+           command.word[1] = empty_command_word;
             goto Lookup;
         case GO_UNKNOWN:
             /*  Random intransitive verbs come here.  Clear obj just in case