Test coverage - failure to fill
[open-adventure.git] / actions.c
index cc252b577f82a74ee7afdfffa9e59bf917f48fde..2a223bc9a9e40b42626530ee93d8820937d1d0db 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -5,16 +5,11 @@
 #include "newdb.h"
 
 /* Limit visibility of ugly globals.  Eventually these should go away. */
-extern long WD1, WD1X, WD2, WD2X;
+extern token_t WD1, WD1X, WD2, WD2X;
 
-/*
- * Action handlers.  Eventually we'll do lookup through a method table
- * that calls these.
- */
-
-static int fill(token_t verb, token_t);
+static int fill(token_t, token_t);
 
-static int attack(FILE *input, long verb, token_t obj)
+static int attack(FILE *input, token_t verb, token_t obj)
 /*  Attack.  Assume target if unambiguous.  "Throw" also links here.
  *  Attackable objects fall into two categories: enemies (snake,
  *  dwarf, etc.)  and others (bird, clam, machine).  Ambiguous if 2
@@ -87,7 +82,7 @@ static int attack(FILE *input, long verb, token_t obj)
          *  too.  Then do a null motion to get new description. */
         RSPEAK(BARE_HANDS_QUERY);
         GETIN(input, &WD1, &WD1X, &WD2, &WD2X);
-        if (WD1 != MAKEWD(25) && WD1 != MAKEWD(250519))
+        if (WD1 != MAKEWD(WORD_YINIT) && WD1 != MAKEWD(WORD_YES))
             return GO_CHECKFOO;
         PSPEAK(DRAGON, 3);
         game.prop[DRAGON] = 1;
@@ -110,7 +105,7 @@ static int attack(FILE *input, long verb, token_t obj)
     return GO_CLEAROBJ;
 }
 
-static int bigwords(long foo)
+static int bigwords(token_t foo)
 /*  FEE FIE FOE FOO (AND FUM).  Advance to next state if given in proper order.
  *  Look up WD1 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). */
@@ -1000,7 +995,7 @@ static int wave(token_t verb, token_t obj)
     }
 }
 
-int action(FILE *input, enum speechpart part, long verb, token_t obj)
+int action(FILE *input, enum speechpart part, token_t verb, token_t obj)
 /*  Analyse a verb.  Remember what it was, go back for object if second word
  *  unless verb is "say", which snarfs arbitrary second word.
  */
@@ -1059,7 +1054,8 @@ int action(FILE *input, enum speechpart part, long verb, token_t obj)
 
     switch (part) {
     case intransitive:
-        if (WD2 > 0 && verb != SAY) return (2800);
+        if (WD2 > 0 && verb != SAY)
+           return GO_WORD2;
         if (verb == SAY)obj = WD2;
         if (obj == 0 || obj == INTRANSITIVE) {
             /*  Analyse an intransitive verb (ie, no object given yet). */