fix add_to_minv panic when aklys kills enfulger
Reported directly to devteam rather than via the web contact form: throwing wielded aklys while swallowed would hit the engulfer and return to the hero's hand but leave a stale 'thrownobj' pointer if the monster survived. Under usual circumstances, throwing anything else or throwing the aklys again when not engulfed would clear that pointer, putting things back to normal. However, killing any engulfer with the same weapon would try to add it to engulfer's inventory to be dropped as it died. If the killing blow was via melee rather than another throw, the object in question would still be in hero's inventory instead of free, hence panic. The initial returning-aklys implementation shared Mjollnir's code which doesn't have this issue. This reverts from having attached aklys always returning successfully when thrown while swallowed to Mjollnir's 99% chance of return and 99% to be caught when it does come back. (That was already the case if the engulfer was killed by the throw, where hero wasn't swallowed anymore after the damage was inflicted.)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 mon.c $NHDT-Date: 1565833749 2019/08/15 01:49:09 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.296 $ */
|
||||
/* NetHack 3.6 mon.c $NHDT-Date: 1569276991 2019/09/23 22:16:31 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.297 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -2370,7 +2370,9 @@ int xkill_flags; /* 1: suppress message, 2: suppress corpse, 4: pacifist */
|
||||
if (mtmp->mtame && !mtmp->isminion)
|
||||
EDOG(mtmp)->killed_by_u = 1;
|
||||
|
||||
if (wasinside && thrownobj && thrownobj != uball) {
|
||||
if (wasinside && thrownobj && thrownobj != uball
|
||||
/* don't give to mon if missile is going to return to hero */
|
||||
&& thrownobj != (struct obj *) iflags.returning_missile) {
|
||||
/* 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
|
||||
|
||||
Reference in New Issue
Block a user