Address Gitlanb issue #54: listen command not showing all sounds
authorEric S. Raymond <esr@thyrsus.com>
Wed, 6 Apr 2022 11:49:42 +0000 (07:49 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 6 Apr 2022 11:49:42 +0000 (07:49 -0400)
actions.c
tests/defeat.chk

index d5cb410bcd8df4db87d5d8ec7a10aa69587053d9..09f7836b616fa9727ee7235c0338ff645e1bdc77 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -925,12 +925,13 @@ static phase_codes_t light(verb_t verb, obj_t obj)
 static phase_codes_t listen(void)
 /*  Listen.  Intransitive only.  Print stuff based on object sound proprties. */
 {
 static phase_codes_t listen(void)
 /*  Listen.  Intransitive only.  Print stuff based on object sound proprties. */
 {
+    bool soundlatch = false;
     vocab_t sound = locations[game.loc].sound;
     if (sound != SILENT) {
         rspeak(sound);
         if (!locations[game.loc].loud)
             rspeak(NO_MESSAGE);
     vocab_t sound = locations[game.loc].sound;
     if (sound != SILENT) {
         rspeak(sound);
         if (!locations[game.loc].loud)
             rspeak(NO_MESSAGE);
-        return GO_CLEAROBJ;
+        soundlatch = true;
     }
     for (obj_t i = 1; i <= NOBJECTS; i++) {
         if (!HERE(i) ||
     }
     for (obj_t i = 1; i <= NOBJECTS; i++) {
         if (!HERE(i) ||
@@ -949,9 +950,10 @@ static phase_codes_t listen(void)
         rspeak(NO_MESSAGE);
         if (i == BIRD && mi == BIRD_ENDSTATE)
             DESTROY(BIRD);
         rspeak(NO_MESSAGE);
         if (i == BIRD && mi == BIRD_ENDSTATE)
             DESTROY(BIRD);
-        return GO_CLEAROBJ;
+        soundlatch = true;
     }
     }
-    rspeak(ALL_SILENT);
+    if (!soundlatch)
+       rspeak(ALL_SILENT);
     return GO_CLEAROBJ;
 }
 
     return GO_CLEAROBJ;
 }
 
index 4e57e3345e13f3875dab85e3a0c9071b519fea28..055ea6a5c6f12fcb4d0805dd88963f2af294ffa2 100644 (file)
@@ -3014,6 +3014,8 @@ There is an enormous oyster here with its shell tightly closed.
 You can hear the murmuring of the beanstalks and the snoring of the
 dwarves.
 
 You can hear the murmuring of the beanstalks and the snoring of the
 dwarves.
 
+Even though it's an oyster, the critter's as tight-mouthed as a clam.
+
 > blast rod
 
 There is a loud explosion, and a twenty-foot hole appears in the far
 > blast rod
 
 There is a loud explosion, and a twenty-foot hole appears in the far