Fix GitLab issue #69: repeated knive caveat message
authorEric S. Raymond <esr@thyrsus.com>
Tue, 25 Jun 2024 17:23:21 +0000 (13:23 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 25 Jun 2024 20:42:14 +0000 (16:42 -0400)
NEWS.adoc
main.c
notes.adoc
tests/knife.chk

index 624f6cefb32fa12f0be323c8a28f856f7ced18ba..28dd0189c25af1de1bf1271d608fd5d27eaf4474 100644 (file)
--- a/NEWS.adoc
+++ b/NEWS.adoc
@@ -2,6 +2,9 @@
 // SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
 // SPDX-License-Identifier: CC-BY-4.0
 
+Repository head::
+  Ensore that the KNIVES_VANISH message can't issue twice.
+
 1.18: 2024-02-15::
   Bring the manual page fully up to date.
 
diff --git a/main.c b/main.c
index 7f5d8a1f8b9b979d01a20097d3c0e720d7ea954c..6d904f297734fe78e1f27d334d596769d8cdbb51 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1280,11 +1280,13 @@ static bool do_command(void) {
                                }
                        }
 
-                       /* Check to see if the room is dark. If the knife is
-                        * here, and it's dark, the knife permanently disappears
-                        */
+                       /* Check to see if the room is dark. */
                        game.wzdark = DARK(game.loc);
-                       if (game.knfloc != LOC_NOWHERE &&
+                    
+                       /* If the knife is not here it permanently disappears.
+                       * Possibly this should fire if the knife is here but
+                       * the room is dark? */
+                       if (game.knfloc > LOC_NOWHERE &&
                            game.knfloc != game.loc) {
                                game.knfloc = LOC_NOWHERE;
                        }
index b970e7cdffca285a800627faab2c1515fdc2f6d2..833682c8476cd20817bfe181d1dafc255db75b13 100644 (file)
@@ -78,7 +78,11 @@ Bug fixes:
   "eying" for "eyeing", "thresholds" for "threshholds".
 
 * Under odd circumstances (dropping rug or vase outdoors) the game could
-  formerly say "floor" when it should say "ground" (or "dirt", or something).
+  formerly say "floor" when it should say "ground" (or "dirt", or
+  something).
+
+* The "knives vanish" message could formerly be emitted when "I see no
+  knife here." would be appropriate.
 
 Enhancements:
 
index 0c150ec41a20a992266338ca7e60b16fdbb7fbf2..76a3b6b8ab1e57d8bdc8cb06ab1fc93ebb9cd147 100644 (file)
@@ -369,7 +369,7 @@ A crystal bridge spans the fissure.
 
 > get knife
 
-The dwarves' knives vanish as they strike the walls of the cave.
+I see no knife here.
 
 > quit