Improve test coverage.
[open-adventure.git] / actions.c
index 1938d24be054ce6c904e8d0d7247013f23e39c70..4798d7d77150238647b95d8f2ebc4a68b459a299 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -153,7 +153,7 @@ static int bivalve(token_t verb, token_t obj)
     bool is_oyster = (obj == OYSTER);
     spk = is_oyster ? OYSTER_OPENS : PEARL_FALLS;
     if (TOTING(obj))spk = is_oyster ? DROP_OYSTER : DROP_CLAM;
-    if (!TOTING(TRIDNT))spk = is_oyster ? OYSTER_OPENER : CLAM_OPENER;
+    if (!TOTING(TRIDENT))spk = is_oyster ? OYSTER_OPENER : CLAM_OPENER;
     if (verb == LOCK)spk = HUH_MAN;
     if (spk == PEARL_FALLS) {
         DESTROY(CLAM);
@@ -346,7 +346,7 @@ static int discard(token_t verb, token_t obj, bool just_do_it)
             RSPEAK(GEM_FITS);
             game.prop[obj] = 1;
             game.prop[CAVITY] = 0;
-            if (HERE(RUG) && ((obj == EMRALD && game.prop[RUG] != 2) || (obj == RUBY &&
+            if (HERE(RUG) && ((obj == EMERALD && game.prop[RUG] != 2) || (obj == RUBY &&
                               game.prop[RUG] == 2))) {
                 spk = RUG_RISES;
                 if (TOTING(RUG))spk = RUG_WIGGLES;
@@ -361,8 +361,8 @@ static int discard(token_t verb, token_t obj, bool just_do_it)
             }
         } else if (obj == COINS && HERE(VEND)) {
             DESTROY(COINS);
-            DROP(BATTER, game.loc);
-            PSPEAK(BATTER, 0);
+            DROP(BATTERY, game.loc);
+            PSPEAK(BATTERY, 0);
             return GO_CLEAROBJ;
         } else if (obj == BIRD && AT(DRAGON) && game.prop[DRAGON] == 0) {
             RSPEAK(BIRD_BURNT);
@@ -462,7 +462,7 @@ static int extinguish(token_t verb, int obj)
         game.prop[LAMP] = 0;
         RSPEAK(LAMP_OFF);
         spk = DARK(game.loc) ? PITCH_DARK : NO_MESSAGE;
-    } else if (obj == DRAGON || obj == VOLCAN)
+    } else if (obj == DRAGON || obj == VOLCANO)
         spk = BEYOND_POWER;
     RSPEAK(spk);
     return GO_CLEAROBJ;
@@ -789,15 +789,15 @@ static int pour(token_t verb, token_t obj)
     }
 }
 
-static int quit(FILE *input)
+static int quit(void)
 /*  Quit.  Intransitive only.  Verify intent and exit if that's what he wants. */
 {
-    if (YES(input, REALLY_QUIT, OK_MAN, OK_MAN))
+    if (YES(arbitrary_messages[REALLY_QUIT], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
         terminate(quitgame);
     return GO_CLEAROBJ;
 }
 
-static int read(FILE *input, token_t verb, token_t obj)
+static int read(token_t verb, token_t obj)
 /*  Read.  Print stuff based on objtxt.  Oyster (?) is special case. */
 {
     int spk = ACTSPK[verb];
@@ -820,7 +820,7 @@ static int read(FILE *input, token_t verb, token_t obj)
         return GO_CLEAROBJ;
     }
     if (obj == OYSTER && !game.clshnt) {
-        game.clshnt = YES(input, CLUE_QUERY, WAYOUT_CLUE, OK_MAN);
+        game.clshnt = YES(arbitrary_messages[CLUE_QUERY], arbitrary_messages[WAYOUT_CLUE], arbitrary_messages[OK_MAN]);
         return GO_CLEAROBJ;
     }
     PSPEAK(obj, OBJTXT[obj] + game.prop[obj]);
@@ -969,7 +969,7 @@ static int wave(token_t verb, token_t obj)
     if ((!TOTING(obj)) && (obj != ROD || !TOTING(ROD2)))spk = ARENT_CARRYING;
     if (obj != ROD ||
         !TOTING(obj) ||
-        (!HERE(BIRD) && (game.closng || !AT(FISSUR)))) {
+        (!HERE(BIRD) && (game.closng || !AT(FISSURE)))) {
         RSPEAK(spk);
         return GO_CLEAROBJ;
     }
@@ -986,13 +986,13 @@ static int wave(token_t verb, token_t obj)
             RSPEAK(spk);
             return GO_DWARFWAKE;
         }
-        if (game.closng || !AT(FISSUR)) {
+        if (game.closng || !AT(FISSURE)) {
             RSPEAK(spk);
             return GO_CLEAROBJ;
         }
         if (HERE(BIRD))RSPEAK(spk);
-        game.prop[FISSUR] = 1 - game.prop[FISSUR];
-        PSPEAK(FISSUR, 2 - game.prop[FISSUR]);
+        game.prop[FISSURE] = 1 - game.prop[FISSURE];
+        PSPEAK(FISSURE, 2 - game.prop[FISSURE]);
         return GO_CLEAROBJ;
     }
 }
@@ -1100,7 +1100,7 @@ int action(FILE *input, enum speechpart part, long verb, token_t obj)
             case 16: /* TOSS  */
                 return GO_UNKNOWN;
             case 17: /* QUIT  */
-                return quit(input);
+                return quit();
             case 18: /* FIND  */
                 return GO_UNKNOWN;
             case 19: /* INVEN */
@@ -1113,22 +1113,22 @@ int action(FILE *input, enum speechpart part, long verb, token_t obj)
                 blast();
                 return GO_CLEAROBJ;
             case 23: /* SCOR  */
-               score(scoregame);
-               return GO_CLEAROBJ;
+                score(scoregame);
+                return GO_CLEAROBJ;
             case 24: /* FOO   */
                 return bigwords(WD1);
             case 25: /* BRIEF */
                 return brief();
             case 26: /* READ  */
-                return read(input, verb, INTRANSITIVE);
+                return read(verb, INTRANSITIVE);
             case 27: /* BREAK */
                 return GO_UNKNOWN;
             case 28: /* WAKE  */
                 return GO_UNKNOWN;
             case 29: /* SUSP  */
-                return suspend(input);
+                return suspend();
             case 30: /* RESU  */
-                return resume(input);
+                return resume();
             case 31: /* FLY   */
                 return fly(verb, INTRANSITIVE);
             case 32: /* LISTE */
@@ -1136,7 +1136,7 @@ int action(FILE *input, enum speechpart part, long verb, token_t obj)
             case 33: /* ZZZZ  */
                 return reservoir();
             }
-            BUG(23);
+            BUG(INTRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST);
         }
     /* FALLTHRU */
     case transitive:
@@ -1210,7 +1210,7 @@ int action(FILE *input, enum speechpart part, long verb, token_t obj)
             return GO_CLEAROBJ;
         }
         case 26: /* READ  */
-            return read(input, verb, obj);
+            return read(verb, obj);
         case 27: /* BREAK */
             return vbreak(verb, obj);
         case 28: /* WAKE  */
@@ -1232,13 +1232,13 @@ int action(FILE *input, enum speechpart part, long verb, token_t obj)
         case 33: /* ZZZZ  */
             return reservoir();
         }
-        BUG(24);
+        BUG(TRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST);
     case unknown:
         /* Unknown verb, couldn't deduce object - might need hint */
         SETPRM(1, WD1, WD1X);
         RSPEAK(WHAT_DO);
         return GO_CHECKHINT;
     default:
-        BUG(99);
+        BUG(SPEECHPART_NOT_TRANSITIVE_OR_INTRANSITIVE_OR_UNKNOWN);
     }
 }