]> granicus.if.org Git - nethack/commitdiff
fix #Q251 - reading engravings while asleep
authornethack.rankin <nethack.rankin>
Sat, 4 Feb 2006 04:06:16 +0000 (04:06 +0000)
committernethack.rankin <nethack.rankin>
Sat, 4 Feb 2006 04:06:16 +0000 (04:06 +0000)
     From a bug report, floating down onto an engraving
due to levitation timeout would yield "You read: <engraving text>" even if
you were asleep at the time.  Random teleport while asleep could produce a
similar result.  The problem was actually a little bigger:  you'd also get
"You see <object> here" if there was an object instead of or in addition to
an engraving.

doc/fixes35.0
src/pickup.c

index 8a8b85e502999bbbba9811aef3e67b86f29a8571..1b56640b5b6aac2b1684339e26218a5eed15dd76 100644 (file)
@@ -113,6 +113,8 @@ reduced message verbosity when monster with multiple attacks missed wildly
 zapping a never seen wand while blinded won't make the wand a discovery
 zapping an unID'd wand of teleportation at self will discover it (usually)
 zapping unlocking magic at self while punished will remove attached chain
+don't see objects or read engraving when hero changes location (random
+       teleport) or position (levitation timeout) while asleep or fainted
 
 
 Platform- and/or Interface-Specific Fixes
index 049ad7383eec8b6fb5145dc957b298452af8f763..2d16574188e67ae97347deb91d69d67eecd1cee8 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)pickup.c   3.5     2005/12/07      */
+/*     SCCS Id: @(#)pickup.c   3.5     2006/02/03      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -424,6 +424,13 @@ int what;          /* should be a long */
        struct obj *objchain;
        int traverse_how;
 
+       /* we might have arrived here while fainted or sleeping, via
+          random teleport or levitation timeout; if so, skip check_here
+          and read_engr_at in addition to bypassing autopickup itself
+          [probably ought to check whether hero is using a cockatrice
+          corpse for a pillow here... (also at initial faint/sleep)] */
+       if (autopickup && multi < 0 && unconscious()) return 0;
+
        if (what < 0)           /* pick N of something */
            count = -what;
        else                    /* pick anything */