]> granicus.if.org Git - nethack/commitdiff
pit access
authornethack.rankin <nethack.rankin>
Sun, 4 Jan 2004 08:54:16 +0000 (08:54 +0000)
committernethack.rankin <nethack.rankin>
Sun, 4 Jan 2004 08:54:16 +0000 (08:54 +0000)
     Fix the recently reported problem:

" If there is a corpse in a pit, you have to enter the pit in order to pick
" it up, however you are can eat it without being in the pit.

If pit bottoms aren't reachable, then can_reach_floor() needs to know
about it.  I suspect that this change is likely to create some other
bugs though.

doc/fixes34.4
src/engrave.c
src/hack.c
src/pickup.c

index 8d98d78625b41cf8bd05c99d7a4d121c5b991752..b4de9d8d201c043ea5ae324477eb3ea78568aff9 100644 (file)
@@ -11,6 +11,8 @@ fix message when pushing a boulder into a pool while riding
 plural of "Nazgul" is "Nazgul" not "Nazguls"
 trap messages referring to named steed were ackwardly worded when hallucination
        overrode use of the name
+some actions such as eating corpses off the floor didn't check whether hero
+       could reach the bottom of a pit
 
 
 Platform- and/or Interface-Specific Fixes
index 080dc1d8572c3b8da18b7f5ca02c2b4a9d63a177..aa36bbe8fca4e5403c4c8d514af022e8e8531985 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)engrave.c  3.4     2001/11/04      */
+/*     SCCS Id: @(#)engrave.c  3.4     2004/01/03      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -132,12 +132,18 @@ unsigned seed;            /* for semi-controlled randomization */
 boolean
 can_reach_floor()
 {
-       return (boolean)(!u.uswallow &&
+       struct trap *t;
+
+       if (u.uswallow) return FALSE;
 #ifdef STEED
-                       /* Restricted/unskilled riders can't reach the floor */
-                       !(u.usteed && P_SKILL(P_RIDING) < P_BASIC) &&
+       /* Restricted/unskilled riders can't reach the floor */
+       if (u.usteed && P_SKILL(P_RIDING) < P_BASIC) return FALSE;
 #endif
-                        (!Levitation ||
+       if ((t = t_at(u.ux, u.uy)) != 0 && uteetering_at_seen_pit(t) &&
+               !Flying)
+           return FALSE;
+
+       return (boolean)((!Levitation ||
                          Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)) &&
                         (!u.uundetected || !is_hider(youmonst.data) ||
                          u.umonnum == PM_TRAPPER));
index 4431e679d8f73a66ee8e0db40dc845ec9a08e960..0e809d911bba3bc582b45f19174a6c420ab4be92 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)hack.c     3.4     2003/04/30      */
+/*     SCCS Id: @(#)hack.c     3.4     2004/01/03      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1913,8 +1913,8 @@ dopickup()
            }
        }
        if (is_lava(u.ux, u.uy)) {
-           if (Wwalking || is_floater(youmonst.data) || is_clinger(youmonst.data)
-                       || (Flying && !Breathless)) {
+           if (Wwalking || is_floater(youmonst.data) ||
+                   is_clinger(youmonst.data) || (Flying && !Breathless)) {
                You_cant("reach the bottom to pick things up.");
                return(0);
            } else if (!likes_lava(youmonst.data)) {
@@ -1922,29 +1922,21 @@ dopickup()
                return(0);
            }
        }
-       if(!OBJ_AT(u.ux, u.uy)) {
-               There("is nothing here to pick up.");
-               return(0);
+       if (!OBJ_AT(u.ux, u.uy)) {
+           There("is nothing here to pick up.");
+           return 0;
        }
        if (!can_reach_floor()) {
+           if (traphere && uteetering_at_seen_pit(traphere))
+               You("cannot reach the bottom of the pit.");
 #ifdef STEED
-               if (u.usteed && P_SKILL(P_RIDING) < P_BASIC)
-                   You("aren't skilled enough to reach from %s.",
-                       y_monnam(u.usteed));
-               else
+           else if (u.usteed && P_SKILL(P_RIDING) < P_BASIC)
+               You("aren't skilled enough to reach from %s.",
+                   y_monnam(u.usteed));
 #endif
+           else
                You("cannot reach the %s.", surface(u.ux,u.uy));
-               return(0);
-       }
-
-       if (traphere && uteetering_at_seen_pit(traphere)) {
-               /* Allow pickup from holes and trap doors that you escaped from
-                * because that stuff is teetering on the edge just like you, but
-                * not pits, because there is an elevation discrepancy with stuff
-                * in pits.
-                */
-               You("cannot reach the bottom of the pit.");
-               return(0);
+           return 0;
        }
 
        return (pickup(-count));
index b93a89fb55192d09826143d27656a69974eb8743..23cb0272bb02abc3d8aec8cf9d41aa557447affd 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)pickup.c   3.4     2003/07/27      */
+/*     SCCS Id: @(#)pickup.c   3.4     2004/01/03      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -408,19 +408,12 @@ int what;         /* should be a long */
 
                /* no pickup if levitating & not on air or water level */
                if (!can_reach_floor()) {
-                   if ((multi && !context.run) || (autopickup && !flags.pickup))
+                   if ((multi && !context.run) ||
+                           (autopickup && !flags.pickup) ||
+                           (ttmp && uteetering_at_seen_pit(ttmp)))
                        read_engr_at(u.ux, u.uy);
                    return (0);
                }
-               if (ttmp && uteetering_at_seen_pit(ttmp)) {
-                   /* Allow pickup from holes and trap doors that you escaped
-                    * from because that stuff is teetering on the edge just
-                    * like you, but not pits, because there is an elevation
-                    * discrepancy with stuff in pits.
-                    */
-                    read_engr_at(u.ux, u.uy);
-                    return(0);
-               }
                /* multi && !context.run means they are in the middle of some other
                 * action, or possibly paralyzed, sleeping, etc.... and they just
                 * teleported onto the object.  They shouldn't pick it up.