]> granicus.if.org Git - nethack/commitdiff
Re: #U800: possible bug regarding pits
authornethack.allison <nethack.allison>
Tue, 16 Dec 2003 02:58:55 +0000 (02:58 +0000)
committernethack.allison <nethack.allison>
Tue, 16 Dec 2003 02:58:55 +0000 (02:58 +0000)
<email deleted> wrote:
> Not sure what exactly should occur, but this seems funny: If
> you escape a pit and there is an object in the pit, you can
> not reach it to pick it up. Nor can you go down into the pit
> to get it, but sitting gives the message "you sit on the
> (object) it's not very comfortable. How can the character sit
> on it if it's in the bottom of the pit?

doc/fixes34.4
src/sit.c

index c0cbdfff4a416a38f554d99d54949cc4dcaeed3e..9232ae518473b953d96c222c42439b0730a672ee 100644 (file)
@@ -6,6 +6,7 @@ fix "You hear The food ration tumbles downwards" for blinded pit dropping
 silver arrows weren't causing silver damage on some silver-haters when wielded
 wizard mode: avoid division by 0 crash for level teleport in the endgame if
        confusion overrides teleport control
+don't #sit on an object in a pit if you're only on the precipice
 
 
 Platform- and/or Interface-Specific Fixes
index 22f6227183ae18154501a1f0165b9f77d30064bd..4280136b94521c40634bb1b8e6cae299b638b062 100644 (file)
--- a/src/sit.c
+++ b/src/sit.c
@@ -39,7 +39,7 @@ int
 dosit()
 {
        static const char sit_message[] = "sit on the %s.";
-       register struct trap *trap;
+       register struct trap *trap = t_at(u.ux,u.uy);
        register int typ = levl[u.ux][u.uy].typ;
 
 
@@ -63,7 +63,11 @@ dosit()
            goto in_water;
        }
 
-       if(OBJ_AT(u.ux, u.uy)) {
+       if (OBJ_AT(u.ux, u.uy) && 
+          /* ensure we're not standing on the precipice */
+          !((!u.utrap || u.utraptype != TT_PIT) &&
+            (trap && trap->tseen &&
+            (trap->ttyp==PIT || trap->ttyp==SPIKED_PIT)))) {
            register struct obj *obj;
 
            obj = level.objects[u.ux][u.uy];
@@ -71,7 +75,7 @@ dosit()
            if (!(Is_box(obj) || objects[obj->otyp].oc_material == CLOTH))
                pline("It's not very comfortable...");
 
-       } else if ((trap = t_at(u.ux, u.uy)) != 0 ||
+       } else if (trap != 0 ||
                   (u.utrap && (u.utraptype >= TT_LAVA))) {
 
            if (u.utrap) {
@@ -80,7 +84,7 @@ dosit()
                    You_cant("sit down with your %s in the bear trap.", body_part(FOOT));
                    u.utrap++;
                } else if(u.utraptype == TT_PIT) {
-                   if(trap->ttyp == SPIKED_PIT) {
+                   if(trap && trap->ttyp == SPIKED_PIT) {
                        You("sit down on a spike.  Ouch!");
                        losehp(Half_physical_damage ? rn2(2) : 1,
                                "sitting on an iron spike", KILLED_BY);