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...).
This commit is contained in:
nethack.rankin
2006-09-28 03:16:59 +00:00
parent 171a28871c
commit 008366c273
4 changed files with 21 additions and 3 deletions

View 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

View 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 {

View File

@@ -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);

View 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) {