From 9a1b4d021e360c48e3fb885a9975077063f8e012 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 28 Feb 2023 15:06:06 -0500 Subject: [PATCH] Improve message emission when player wins. --- score.c | 9 ++++++--- tests/cheatresume.chk | 3 ++- tests/cheatresume2.chk | 3 --- tests/win430.chk | 3 ++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/score.c b/score.c index 4331f7f..7e6b28c 100644 --- 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); } diff --git a/tests/cheatresume.chk b/tests/cheatresume.chk index e11a776..5ca8d1b 100644 --- a/tests/cheatresume.chk +++ b/tests/cheatresume.chk @@ -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!! diff --git a/tests/cheatresume2.chk b/tests/cheatresume2.chk index 086e3d8..d698a26 100644 --- a/tests/cheatresume2.chk +++ b/tests/cheatresume2.chk @@ -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!! diff --git a/tests/win430.chk b/tests/win430.chk index 64883bb..a8e15a6 100644 --- a/tests/win430.chk +++ b/tests/win430.chk @@ -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!! -- 2.31.1