]> granicus.if.org Git - nethack/commitdiff
#U632: Objects in Pits (game behavior)
authornethack.allison <nethack.allison>
Sun, 7 Sep 2003 17:25:50 +0000 (17:25 +0000)
committernethack.allison <nethack.allison>
Sun, 7 Sep 2003 17:25:50 +0000 (17:25 +0000)
<Someone> submitted the following bug report:
> An object and a pit are occupying the same square. I try to kick
> the object out of the square, but "You can't kick something
> that's in a pit!"
>
> I step into the square and escape the pit, but I can pick up the
> object, so maybe it's not in the pit after all.
>

This patch does *not* address this part of the bug report:
> If it's in the pit and it's a cockatrice corpse, should I die
> from landing on it when I fall into the pit?

doc/fixes34.3
src/do.c
src/hack.c
src/pickup.c

index f3cfcb50088d270d28733e0ef0f5d798e4b3dc4d..f2e318e035071691fc1ffa069cae92492adbc360 100644 (file)
@@ -8,6 +8,9 @@ grammar, spelling and other typos
 student statues were converted to valkyries, not archeologists
 fix typo in bustling town down stairs declaration
 you could exceed the limits on nazgul and erinys counts via bones files
+fix inconsistency where you can't kick something out of a pit, but you can
+       escape the pit and still pick it up; items are now assumed to be at 
+       the bottom of pit
 
 
 Platform- and/or Interface-Specific Fixes
index 0bd93348cfec0d0491e63cbd1c40fa12a2988c90..fa29321332e1f6fd105eeebc865c684f3ea3c08a 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -195,6 +195,19 @@ const char *verb;
                    newsym(x, y);
                }
                water_damage(obj, FALSE, FALSE);
+       } else if (u.ux == x && u.uy == y &&
+               (!u.utrap || u.utrap && u.utraptype != TT_PIT) &&
+               (t = t_at(x,y)) != 0 && t->tseen &&
+                       (t->ttyp==PIT || t->ttyp==SPIKED_PIT)) {
+               static const char * const the_your[2] = { "the", "your" };
+               /* you escaped a pit and are standing on the precipice */
+               if (Blind && flags.soundok)
+                       You_hear("%s %s downwards.",
+                               The(xname(obj)), otense(obj, "tumble"));
+               else
+                       pline("%s %s into %s pit.",
+                               The(xname(obj)), otense(obj, "tumble"),
+                               the_your[t->madeby_u]);
        }
        return FALSE;
 }
index a719972174076eaa6a95023aed79baa0375d55ca..a5a48938b79858abbf6de3dbb0ac4bb24bf45936 100644 (file)
@@ -1421,7 +1421,6 @@ void
 spoteffects(pick)
 boolean pick;
 {
-       register struct trap *trap;
        register struct monst *mtmp;
 
        if(u.uinwater) {
@@ -1479,11 +1478,16 @@ stillinwater:;
        if(IS_SINK(levl[u.ux][u.uy].typ) && Levitation)
                dosinkfall();
 #endif
-       if (pick && !in_steed_dismounting)
-               (void) pickup(1);
-       /* if dismounting, we'll check again later */
-       if ((trap = t_at(u.ux,u.uy)) != 0 && !in_steed_dismounting)
-               dotrap(trap, 0);        /* fall into pit, arrow trap, etc. */
+       if (!in_steed_dismounting) { /* if dismounting, we'll check again later */
+               struct trap *trap = t_at(u.ux, u.uy);
+               boolean pit;
+               pit = (trap && (trap->ttyp == PIT || trap->ttyp == SPIKED_PIT));
+               if (trap && pit)
+                       dotrap(trap, 0);        /* fall into pit */
+               if (pick) (void) pickup(1);
+               if (trap && !pit)
+                       dotrap(trap, 0);        /* fall into arrow trap, etc. */
+       }
        if((mtmp = m_at(u.ux, u.uy)) && !u.uswallow) {
                mtmp->mundetected = mtmp->msleeping = 0;
                switch(mtmp->data->mlet) {
@@ -1792,7 +1796,8 @@ int
 dopickup()
 {
        int count;
-       /* awful kludge to work around parse()'s pre-decrement */
+       struct trap *traphere = t_at(u.ux, u.uy);
+       /* awful kludge to work around parse()'s pre-decrement */
        count = (multi || (save_cm && *save_cm == ',')) ? multi + 1 : 0;
        multi = 0;      /* always reset */
        /* uswallow case added by GAN 01/29/87 */
@@ -1845,6 +1850,20 @@ dopickup()
                You("cannot reach the %s.", surface(u.ux,u.uy));
                return(0);
        }
+
+       if (traphere && traphere->tseen) {
+               /* 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.
+                */
+               if ((traphere->ttyp == PIT || traphere->ttyp == SPIKED_PIT) &&
+                    (!u.utrap || (u.utrap && u.utraptype != TT_PIT))) {
+                       You("cannot reach the bottom of the pit.");
+                       return(0);
+               }
+       }
+
        return (pickup(-count));
 }
 
index c1fc58e8d7d2948cc412b134f5cfdf8120acc733..ef4d5eb621198df678bf55c71f05e5104421be09 100644 (file)
@@ -398,6 +398,7 @@ int what;           /* should be a long */
            count = 0;
 
        if (!u.uswallow) {
+               struct trap *ttmp = t_at(u.ux, u.uy);
                /* no auto-pick if no-pick move, nothing there, or in a pool */
                if (autopickup && (flags.nopick || !OBJ_AT(u.ux, u.uy) ||
                        (is_pool(u.ux, u.uy) && !Underwater) || is_lava(u.ux, u.uy))) {
@@ -411,7 +412,18 @@ int what;          /* should be a long */
                        read_engr_at(u.ux, u.uy);
                    return (0);
                }
-
+               if (ttmp && ttmp->tseen) {
+                   /* 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.
+                    */
+                   if ((ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT) &&
+                       (!u.utrap || (u.utrap && u.utraptype != TT_PIT))) {
+                       read_engr_at(u.ux, u.uy);
+                       return(0);
+                   }
+               }
                /* multi && !flags.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.