From 28934bc7b64be632fba0d2538387821f4054048d Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Tue, 16 Dec 2003 02:58:55 +0000 Subject: [PATCH] Re: #U800: possible bug regarding pits 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 | 1 + src/sit.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index c0cbdfff4..9232ae518 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -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 diff --git a/src/sit.c b/src/sit.c index 22f622718..4280136b9 100644 --- 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); -- 2.40.0