Improve message emission when player wins.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 28 Feb 2023 20:06:06 +0000 (15:06 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 28 Feb 2023 20:10:54 +0000 (15:10 -0500)
score.c
tests/cheatresume.chk
tests/cheatresume2.chk
tests/win430.chk

diff --git a/score.c b/score.c
index 4331f7f93bfecd6485eaa71e2c8fef1730a71c8e..7e6b28c26ae9ee02a96f3d596983f39a6abae393 100644 (file)
--- a/score.c
+++ b/score.c
@@ -126,13 +126,16 @@ void terminate(enum termination mode)
     for (int i = 1; i <= (int)NCLASSES; i++) {
         if (classes[i].threshold >= points) {
             speak(classes[i].message);
-            int nxt = classes[i].threshold + 1 - points;
-            rspeak(NEXT_HIGHER, nxt, nxt);
+           if (i < (int)NCLASSES) {
+               int nxt = classes[i].threshold + 1 - points;
+               rspeak(NEXT_HIGHER, nxt, nxt);
+           } else {
+               rspeak(NO_HIGHER);
+           }
             exit(EXIT_SUCCESS);
         }
     }
     rspeak(OFF_SCALE);
-    rspeak(NO_HIGHER);
     exit(EXIT_SUCCESS);
 }
 
index e11a7766e21528cae2d04aed314f7042e16cc490..5ca8d1b7af2250ffd3f1c04baf845af7a9bbc365 100644 (file)
@@ -23,4 +23,5 @@ You scored 9031 out of a possible 430, using 0 turns.
 It may interest you to know that the Dungeon-Master himself has, to
 my knowledge, never achieved this threshold in fewer than 330 turns.'
 
-To achieve the next higher rating, you need 969 more points.
+To achieve the next higher rating would be a neat trick!
+Congratulations!!
index 086e3d8bc083cfdfeaa2f01e52f4a5e8784be528..d698a26ca55d5ccb1385b144ed30414cb0d9542c 100644 (file)
@@ -19,6 +19,3 @@ Now let's see you do it without suspending in mid-Adventure.
 You scored 10031 out of a possible 430, using 0 turns.
 
 You just went off my scale!!
-
-To achieve the next higher rating would be a neat trick!
-Congratulations!!
index 64883bb888d1e5baed853562bcdfbf052d7b9320..a8e15a641dcc0d5b63203957852b0a892bece4ba 100644 (file)
@@ -2104,4 +2104,5 @@ You scored 430 out of a possible 430, using 349 turns.
 It may interest you to know that the Dungeon-Master himself has, to
 my knowledge, never achieved this threshold in fewer than 330 turns.'
 
-To achieve the next higher rating, you need 9570 more points.
+To achieve the next higher rating would be a neat trick!
+Congratulations!!