Merge branch 'master' into actions-arithmetic
[open-adventure.git] / main.c
diff --git a/main.c b/main.c
index 1c1b299017a91b740e9b8def7cef69d04eb1ac09..fbd7de04dd5cd7d69fce6cd65d1578759c5984f5 100644 (file)
--- a/main.c
+++ b/main.c
@@ -49,7 +49,6 @@ bool editline = true;
 bool prompt = true;
 
 extern void initialise();
-extern void score(long);
 extern int action(FILE *, long, long, long);
 
 void sig_handler(int signo)
@@ -141,7 +140,7 @@ int main(int argc, char *argv[])
            break;
     }
     /* show score and exit */
-    score(1);
+    score(quitgame);
 }
 
 static bool fallback_handler(char *buf)
@@ -249,8 +248,8 @@ static void checkhints(FILE *cmdin)
                SETPRM(1,HINTS[hint][2],HINTS[hint][2]);
                RSPEAK(HINT_COST);
                game.hinted[hint]=YES(cmdin,WANT_HINT,HINTS[hint][4],OK_MAN);
-               if (game.hinted[hint] && game.limit > 30)
-                   game.limit=game.limit+30*HINTS[hint][2];
+               if (game.hinted[hint] && game.limit > WARNTIME)
+                   game.limit += WARNTIME*HINTS[hint][2];
            }
        }
     }
@@ -475,13 +474,13 @@ static void croak(FILE *cmdin)
        /*  He died during closing time.  No resurrection.  Tally up a
         *  death and exit. */
        RSPEAK(DEATH_CLOSING);
-       score(0);
+       score(endgame);
     } else {
        /* FIXME: Arithmetic on message numbers */
        if (!YES(cmdin,WATCH_IT+game.numdie*2,WHICH_WAY+game.numdie*2,OK_MAN))
-           score(0);
+           score(endgame);
        if (game.numdie == MAXDIE)
-           score(0);
+           score(endgame);
        game.place[WATER]=0;
        game.place[OIL]=0;
        if (TOTING(LAMP))
@@ -832,7 +831,7 @@ static void lampcheck(void)
      *  Second is for other cases of lamp dying.  12400 is when it
      *  goes out.  Even then, he can explore outside for a while
      *  if desired. */
-    if (game.limit<=30 && HERE(BATTER) && game.prop[BATTER]==0 && HERE(LAMP))
+    if (game.limit <= WARNTIME && HERE(BATTER) && game.prop[BATTER]==0 && HERE(LAMP))
     {
        RSPEAK(REPLACE_BATTERIES);
        game.prop[BATTER]=1;
@@ -845,7 +844,7 @@ static void lampcheck(void)
        game.prop[LAMP]=0;
        if (HERE(LAMP))
            RSPEAK(LAMP_OUT);
-    } else if (game.limit <= 30) {
+    } else if (game.limit <= WARNTIME) {
        if (!game.lmwarn && HERE(LAMP)) {
            game.lmwarn=true;
            int spk=GET_BATTERIES;
@@ -1059,7 +1058,7 @@ static bool do_command(FILE *cmdin)
        if (i == -1) {
            /* Gee, I don't understand. */
            if (fallback_handler(rawbuf))
-               return true;
+               continue;
            SETPRM(1,WD1,WD1X);
            RSPEAK(DONT_KNOW);
            goto L2600;
@@ -1107,7 +1106,7 @@ static bool do_command(FILE *cmdin)
        case GO_DWARFWAKE:
            /*  Oh dear, he's disturbed the dwarves. */
            RSPEAK(DWARVES_AWAKEN);
-           score(0);
+           score(endgame);
            return true;
        default:
            BUG(99);