Magic-number elimination.
[open-adventure.git] / actions.c
index 0a5b8edb30ba09bcbb50c55ded35b0eec4a5a464..95a94b821d15c888041e288d483e42933e6559b7 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -166,10 +166,9 @@ static int attack(struct command_t *command)
 
 static int bigwords(token_t foo)
 /*  FEE FIE FOE FOO (AND FUM).  Advance to next state if given in proper order.
- *  Look up foo in section 3 of vocab to determine which word we've got.  Last
- *  word zips the eggs back to the giant room (unless already there). */
+ *  Look up foo in special section of vocab to determine which word we've got.
+ *  Last word zips the eggs back to the giant room (unless already there). */
 {
-    //int k = vocab(foo, 3);
     char word[6];
     packed_to_token(foo, word);
     int k = (int) get_special_vocab_id(word);
@@ -362,7 +361,7 @@ static int vcarry(token_t verb, token_t obj)
     if (obj == BOTTLE && LIQUID() != 0)
         game.place[LIQUID()] = CARRIED;
     if (GSTONE(obj) && game.prop[obj] != 0) {
-        game.prop[obj] = 0;
+        game.prop[obj] = STATE_GROUND;
         game.prop[CAVITY] = CAVITY_EMPTY;
     }
     rspeak(OK_MAN);
@@ -640,7 +639,7 @@ int fill(token_t verb, token_t obj)
         return (discard(verb, obj, true));
     } else if (obj == URN) {
         spk = FULL_URN;
-        if (game.prop[URN] != 0) {
+        if (game.prop[URN] != URN_EMPTY) {
             rspeak(spk);
             return GO_CLEAROBJ;
         }
@@ -653,7 +652,7 @@ int fill(token_t verb, token_t obj)
         game.place[k] = LOC_NOWHERE;
         game.prop[BOTTLE] = EMPTY_BOTTLE;
         if (k == OIL)
-            game.prop[URN] = 1;
+            game.prop[URN] = URN_DARK;
         spk = WATER_URN + game.prop[URN];
         rspeak(spk);
         return GO_CLEAROBJ;
@@ -665,7 +664,7 @@ int fill(token_t verb, token_t obj)
     spk = BOTTLED_WATER;
     if (LIQLOC(game.loc) == 0)
         spk = NO_LIQUID;
-    if (HERE(URN) && game.prop[URN] != 0)
+    if (HERE(URN) && game.prop[URN] != URN_EMPTY)
         spk = URN_NOPOUR;
     if (LIQUID() != 0)
         spk = BOTTLE_FULL;
@@ -975,7 +974,7 @@ static int rub(token_t verb, token_t obj)
     if (obj == URN && game.prop[URN] == URN_LIT) {
         DESTROY(URN);
         drop(AMBER, game.loc);
-        game.prop[AMBER] = 1;
+        game.prop[AMBER] = AMBER_IN_ROCK;
         --game.tally;
         drop(CAVITY, game.loc);
         spk = URN_GENIES;
@@ -993,12 +992,11 @@ static int say(struct command_t *command)
         b = command->wd2x;
         command->wd1 = command->wd2;
     }
-    //int wd = vocab(command->wd1, -1);
     char word1[6];
     packed_to_token(command->wd1, word1);
     int wd = (int) get_vocab_id(word1);
     /* FIXME: magic numbers */
-    if (wd == XYZZY || wd == PLUGH || wd == PLOVER || wd == ACTION_WORD(GIANTWORDS) || wd == ACTION_WORD(PART)) {
+    if (wd == MOTION_WORD(XYZZY) || wd == MOTION_WORD(PLUGH) || wd == MOTION_WORD(PLOVER) || wd == ACTION_WORD(GIANTWORDS) || wd == ACTION_WORD(PART)) {
         /* FIXME: scribbles on the interpreter's command block */
         wordclear(&command->wd2);
         return GO_LOOKUP;