From: PatR Date: Tue, 19 Apr 2016 18:30:11 +0000 (-0700) Subject: fix deleting worn obj (uchain) impossibility X-Git-Tag: NetHack-3.6.1_RC01~821 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=daee9f3e7c25c68e932c1111bcf0f7ce451cd95e;p=nethack fix deleting worn obj (uchain) impossibility ... when exploding chest trap destroys uchain without using unpunish() to un-wear it first. The '!carried(uball)' clause should be applied to the uball->ox,oy test only, not to both uchain->ox,oy and uball->ox,oy. --- diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 93a7da565..b0ae56088 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -213,6 +213,7 @@ for menustyle traditional, 'D' followed by (B|U|C|X)&m presented a menu of for menustyles traditional or combination, 'A' (or object ID) followed by i displayed an inventory of everything rather than just worn items (or not fully identified items) +exploding chest trap would destroy uchain while still worn if uball carried post-3.6.0: fix "object lost" panic during pickup caused by sortloot revamp post-3.6.0: more sortloot revisions diff --git a/src/trap.c b/src/trap.c index 7e6987a8f..acaa63862 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 trap.c $NHDT-Date: 1457570259 2016/03/10 00:37:39 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.262 $ */ +/* NetHack 3.6 trap.c $NHDT-Date: 1461090580 2016/04/19 18:29:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.266 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -4619,16 +4619,11 @@ boolean disarm; loss += stolen_value(obj, ox, oy, (boolean) shkp->mpeaceful, TRUE); delete_contents(obj); - /* we're about to delete all things at this location, - * which could include the ball & chain. - * If we attempt to call unpunish() in the - * for-loop below we can end up with otmp2 - * being invalid once the chain is gone. - * Deal with ball & chain right now instead. - */ - if (Punished && !carried(uball) - && ((uchain->ox == u.ux && uchain->oy == u.uy) - || (uball->ox == u.ux && uball->oy == u.uy))) + /* unpunish() in advance if either ball or chain (or both) + is going to be destroyed */ + if (Punished && ((uchain->ox == u.ux && uchain->oy == u.uy) + || (uball->where == OBJ_FLOOR + && uball->ox == u.ux && uball->oy == u.uy))) unpunish(); for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp2) {