From: nethack.rankin Date: Thu, 28 Sep 2006 03:16:59 +0000 (+0000) Subject: fix #h192 - missile which kills engulfer is in limbo when hero gets expelled (trunk... X-Git-Tag: MOVE2GIT~875 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=008366c2733979940855d769b1c4c52f8b4279c0;p=nethack fix #h192 - missile which kills engulfer is in limbo when hero gets expelled (trunk only) More explicit control over the behavior of spoteffects() is probably the way to go in the long run, but this much simpler fix handles the case at hand. I'm not sure what `thrownobj' was intended to be used for in the first place, but it came in handy here. (It was being left as a dangling pointer when thitmonst() reports that the missile has been used up; that's fixed now.) Fix the reported problem of lookhere/autopickup not seeing the missile which just killed the engulfing monster whose death caused the hero to be put back onto the map and so look/pickup upon arrival. Normally the missile gets placed after damage has been dealt and the throw has finished. This overrides that so that the missile is put into the engulfer's inventory as it is being killed (which will then put that inventory onto the floor prior to expelling the hero on top of same). If the monster happens to get life-saved it just ends up collecting the thrown-from-inside object a little sooner than usual. This wouldn't correctly handle the same case for a kicked object, if that were possible. But it isn't possible to kick objects while engulfed, so that's moot. Other calls to thitmonst() and hmon() don't appear to have any objects in transit so shouldn't need any comparable fix (I hope...). --- diff --git a/doc/fixes35.0 b/doc/fixes35.0 index ad9fbb5e2..85e60de78 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -158,6 +158,7 @@ if shopkeeper or priest gets teleported while inside his shop or temple, tame/peaceful grabber/engulfer will release hero after conflict ends make changes in hallucination be reflected by changes in mimickery feedback add Unaware pseudo-property to suppress various messages while unconscious +missile which kills engulfer will now be placed prior to hero's return to map Platform- and/or Interface-Specific Fixes diff --git a/src/dothrow.c b/src/dothrow.c index 0a527b491..6ec093f98 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)dothrow.c 3.5 2006/06/21 */ +/* SCCS Id: @(#)dothrow.c 3.5 2006/09/25 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1032,10 +1032,12 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */ !index(in_rooms(mon->mx, mon->my, SHOPBASE), *u.ushops))) hot_pursuit(mon); - if (obj_gone) return; + if (obj_gone) thrownobj = 0; } - if (u.uswallow) { + if (!thrownobj) { + ; /* missile has already been handled */ + } else if (u.uswallow) { /* ball is not picked up by monster */ if (obj != uball) (void) mpickobj(u.ustuck,obj); } else { diff --git a/src/mon.c b/src/mon.c index 5806898c6..0642fcc67 100644 --- a/src/mon.c +++ b/src/mon.c @@ -11,6 +11,8 @@ #include "mfndpos.h" #include +extern struct obj *thrownobj; /* dothrow.c */ + STATIC_DCL boolean FDECL(restrap,(struct monst *)); STATIC_DCL long FDECL(mm_aggression, (struct monst *,struct monst *)); #ifdef BARGETHROUGH @@ -1914,6 +1916,17 @@ int dest; /* your pet knows who just killed it...watch out */ if (mtmp->mtame && !mtmp->isminion) EDOG(mtmp)->killed_by_u = 1; + if (wasinside && thrownobj && thrownobj != uball) { + /* thrown object has killed hero's engulfer; add it to mon's + inventory now so that it will be placed with mon's other + stuff prior to lookhere/autopickup when hero is expelled + below (as a side-effect, this missile has immunity from + being consumed [for this shot/throw only]) */ + mpickobj(mtmp, thrownobj); + /* let throwing code know that missile has been disposed of */ + thrownobj = 0; + } + /* dispose of monster and make cadaver */ if(stoned) monstone(mtmp); else mondead(mtmp); diff --git a/src/uhitm.c b/src/uhitm.c index 9ac52aa2a..f88327c08 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -1074,6 +1074,8 @@ int thrown; pline(fmt, whom); } + /* [note: thrown obj might go away during killed/xkilled call] */ + if (needpoismsg) pline_The("poison doesn't seem to affect %s.", mon_nam(mon)); if (poiskilled) {