Address Gitlanb issue #54: listen command not showing all sounds
[open-adventure.git] / actions.c
index 3946b0e7268a0539e9a7b39fd19fccf9b3995bbb..09f7836b616fa9727ee7235c0338ff645e1bdc77 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -845,15 +845,20 @@ static phase_codes_t fly(verb_t verb, obj_t obj)
         rspeak(RUG_NOTHING1);
         return GO_CLEAROBJ;
     }
-    game.oldlc2 = game.oldloc;
-    game.oldloc = game.loc;
 
-    if (game.prop[SAPPH] == STATE_NOTFOUND) {
-        game.newloc = game.place[SAPPH];
+    if (game.loc == LOC_CLIFF) {
+       game.oldlc2 = game.oldloc;
+       game.oldloc = game.loc;
+        game.newloc = LOC_LEDGE;
         rspeak(RUG_GOES);
-    } else {
+    } else if (game.loc == LOC_LEDGE) {
+       game.oldlc2 = game.oldloc;
+       game.oldloc = game.loc;
         game.newloc = LOC_CLIFF;
         rspeak(RUG_RETURNS);
+    } else {
+       /* should never happen */
+       rspeak(NOTHING_HAPPENS);
     }
     return GO_TERMINATE;
 }
@@ -920,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. */
 {
+    bool soundlatch = false;
     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) ||
@@ -944,9 +950,10 @@ static phase_codes_t listen(void)
         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;
 }