]> granicus.if.org Git - nethack/commitdiff
sleep vs sounds
authornethack.rankin <nethack.rankin>
Sun, 13 Oct 2002 10:13:38 +0000 (10:13 +0000)
committernethack.rankin <nethack.rankin>
Sun, 13 Oct 2002 10:13:38 +0000 (10:13 +0000)
     Handle sleeping consistently; of the nine places fall_asleep
is being called, only one of the them actually affected sounds.
The two cases where sleep is used to penalize overexertion aren't
affected.

src/timeout.c
src/trap.c

index a73a0d4b746ee863fcaba1702d32886b53cdb4f9..dd013883db57c25ac3f77c64d8e198c5aa7b78bd 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)timeout.c  3.4     2000/09/28      */
+/*     SCCS Id: @(#)timeout.c  3.4     2002/10/12      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -367,6 +367,13 @@ boolean wakeup_msg;
 {
        stop_occupation();
        nomul(how_long);
+       /* generally don't notice sounds while sleeping */
+       if (wakeup_msg && multi == how_long) {
+           /* caller can follow with a direct call to Hear_again() if
+              there's a need to override this when wakeup_msg is true */
+           flags.soundok = 0;
+           afternmv = Hear_again;      /* this won't give any messages */
+       }
        /* early wakeup from combat won't be possible until next monster turn */
        u.usleep = monstermoves;
        nomovemsg = wakeup_msg ? "You wake up." : You_can_move_again;
index 321f39631171ee5a6b696f87ab00c190d6ecc067..1b635664915df07f0d6d0ca34599b4044fb91944 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)trap.c     3.4     2002/08/29      */
+/*     SCCS Id: @(#)trap.c     3.4     2002/10/12      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -685,9 +685,7 @@ unsigned trflags;
                    break;
                }
                pline("A cloud of gas puts you to sleep!");
-               flags.soundok = 0;
                fall_asleep(-rnd(25), TRUE);
-               afternmv = Hear_again;
 #ifdef STEED
                (void) steedintrap(trap, (struct obj *)0);
 #endif