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:
PatR
2019-09-23 15:16:39 -07:00
parent bd26d2edbe
commit 348f968132
4 changed files with 62 additions and 52 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 flag.h $NHDT-Date: 1562532730 2019/07/07 20:52:10 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.152 $ */
/* NetHack 3.6 flag.h $NHDT-Date: 1569276988 2019/09/23 22:16:28 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.155 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
@@ -446,6 +446,7 @@ struct instance_flags {
boolean windowtype_deferred; /* pick a windowport and store it in
chosen_windowport[], but do not switch to
it in the midst of options processing */
genericptr_t returning_missile; /* 'struct obj *'; Mjollnir or aklys */
boolean obsolete; /* obsolete options can point at this, it isn't used */
};