From: PatR Date: Sat, 9 Sep 2017 23:21:22 +0000 (-0700) Subject: fix #H6015 - 'crash' on NAO X-Git-Tag: NetHack-3.6.1_RC01~385 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=263bd05fa0e0029eaa9d1e12ab49fd6d4e83faeb;p=nethack fix #H6015 - 'crash' on NAO Reported for nethack.alt.org where impossible events in to-be-3.6.1 trigger a panic instead of just a warning, being polymorphed into a vampire and draining something to 0 HP (rather than killing it with the bite attack) didn't properly kill off the victim unless it was also being drained from level 0 to level -1, resulting in impossible "dmonsfree: 1 removed doesn't match 0 pending". If the hero got another move before dead monsters were purged, applying a stethscope to the victim could trigger an actual crash rather than an impossible escalated to a panic. Other actions such as attacking again probably could too. A followup included a diagnosis and one-line patch. I expanded the adjacent comment when manually putting the patch into place. --- diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 4032a9dc2..5c5e732b5 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -473,6 +473,8 @@ wizhelp: ^O is #overview in wizard mode too; #wizwhere shows dungeon layout wishing for tins sometimes yielded a tin wand replace the fix for preventing putting on a helm of opposite alignment from causing wielded Excalibur from blasting hero twice +hero poly'd into vampire could drain monster down to 0 HP without killing it, + triggering impossible "dmonsfree: 1 removed doesn't match 0 pending" Platform- and/or Interface-Specific Fixes diff --git a/src/uhitm.c b/src/uhitm.c index b11cb0fd8..81a71a406 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 uhitm.c $NHDT-Date: 1496860757 2017/06/07 18:39:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.166 $ */ +/* NetHack 3.6 uhitm.c $NHDT-Date: 1504999056 2017/09/09 23:17:36 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.167 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1609,8 +1609,9 @@ register struct attack *mattk; pline("%s suddenly seems weaker!", Monnam(mdef)); mdef->mhpmax -= xtmp; mdef->mhp -= xtmp; - /* !m_lev: level 0 monster is killed rather than drop to -1 */ - if (mdef->mhp <= 0 && !mdef->m_lev) { + /* !m_lev: level 0 monster is killed regardless of hit points + rather than drop to level -1 */ + if (mdef->mhp <= 0 || !mdef->m_lev) { pline("%s dies!", Monnam(mdef)); xkilled(mdef, XKILL_NOMSG); } else