]> granicus.if.org Git - nethack/commit
fix add_to_minv panic when aklys kills enfulger
authorPatR <rankin@nethack.org>
Mon, 23 Sep 2019 22:16:39 +0000 (15:16 -0700)
committerPatR <rankin@nethack.org>
Mon, 23 Sep 2019 22:16:39 +0000 (15:16 -0700)
commit348f96813290594e794648e357b7eb89568a50e6
tree47ec86a41afb1cd8eb6bacfac6952e10886c08ba
parentbd26d2edbe1d343cdfdb7eed81a2e7fa2601d438
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.)
doc/fixes36.3
include/flag.h
src/dothrow.c
src/mon.c