Improve test coverage.
[open-adventure.git] / main.c
diff --git a/main.c b/main.c
index dd9d5c1ffae9f836a9f494d6f724d43d6a7607a0..c18803605493f35f506df5262185652e47fbaa9c 100644 (file)
--- a/main.c
+++ b/main.c
@@ -470,7 +470,7 @@ static bool dwarfmove(void)
 /*  "You're dead, Jim."
  *
  *  If the current loc is zero, it means the clown got himself killed.
- *  We'll allow this maxdie times.  MAXDIE is automatically set based
+ *  We'll allow this maxdie times.  maximum_deaths is automatically set based
  *  on the number of snide messages available.  Each death results in
  *  a message (81, 83, etc.)  which offers reincarnation; if accepted,
  *  this results in message 82, 84, etc.  The last time, if he wants
@@ -490,6 +490,8 @@ static bool dwarfmove(void)
 static void croak(void)
 /*  Okay, he's dead.  Let's get on with it. */
 {
+    const char* query = obituaries[game.numdie].query;
+    const char* yes_response = obituaries[game.numdie].yes_response;
     ++game.numdie;
     if (game.closng) {
         /*  He died during closing time.  No resurrection.  Tally up a
@@ -497,8 +499,7 @@ static void croak(void)
         RSPEAK(DEATH_CLOSING);
         terminate(endgame);
     }
-    /* FIXME: Arithmetic on message numbers */
-    else if (game.numdie == MAXDIE || !YES(arbitrary_messages[WATCH_IT + game.numdie * 2], arbitrary_messages[WHICH_WAY + game.numdie * 2], arbitrary_messages[OK_MAN]))
+    else if (game.numdie == maximum_deaths || !YES(query, yes_response, arbitrary_messages[OK_MAN]))
         terminate(endgame);
     else {
         game.place[WATER] = game.place[OIL] = NOWHERE;