]> granicus.if.org Git - nethack/commitdiff
fix #h192 - missile which kills engulfer is in limbo when hero gets expelled (trunk...
authornethack.rankin <nethack.rankin>
Thu, 28 Sep 2006 03:16:59 +0000 (03:16 +0000)
committernethack.rankin <nethack.rankin>
Thu, 28 Sep 2006 03:16:59 +0000 (03:16 +0000)
     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...).

doc/fixes35.0
src/dothrow.c
src/mon.c
src/uhitm.c

index ad9fbb5e2ca09952c65637511354bf49b5e0b825..85e60de786afd22d9fdf5e1aa2f49f6833034e05 100644 (file)
@@ -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
index 0a527b491ad10e68fbbf9ab59f90400c93e6bc6c..6ec093f98b9e515ebe92359f678c8a2cbf885d5f 100644 (file)
@@ -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 {
index 5806898c6448b2cad9ebf7d889bfb1af5026beaa..0642fcc6714b0e2e7b972276a9f78082d6f17700 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -11,6 +11,8 @@
 #include "mfndpos.h"
 #include <ctype.h>
 
+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);
index 9ac52aa2ab5fec1f7c19bd345c70d1830d444922..f88327c0854d8f4e777fc1651441fc69e0f56425 100644 (file)
@@ -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) {