From 1fc8d7528ced1f519f67e6365530deda390ffeca Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 12 Oct 2019 02:31:47 -0700 Subject: [PATCH] fix #H9298 - corpse mismatch Corpses for dying monsters were being created with the wrong type, caused by incorrect block nesting for 'if (ptr)' from commit ad302fb8a99a5795c4d206870ea6573349b2d92a (Oct 10). --- doc/fixes36.3 | 3 ++- src/mkobj.c | 16 +++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 2fdd04027..a2467729c 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.128 $ $NHDT-Date: 1570652307 2019/10/09 20:18:27 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.132 $ $NHDT-Date: 1570872701 2019/10/12 09:31:41 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -201,6 +201,7 @@ monster throwing from stack of missiles (darts, daggers, spears) would cause crash if it wasn't wielding a weapon (bug in multi-shot shooting fix) surviving death while polymorphed would yield "You are a " without terminating period +'mksobj failure' commit resulted in wrong corpse types for dying monsters curses: sometimes the message window would show a blank line after a prompt curses: the change to show map in columns 1..79 instead of 2..80 made the highlight for '@' show up in the wrong place if clipped map had been diff --git a/src/mkobj.c b/src/mkobj.c index a92deceb6..6975ca966 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mkobj.c $NHDT-Date: 1570754586 2019/10/11 00:43:06 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.154 $ */ +/* NetHack 3.6 mkobj.c $NHDT-Date: 1570872702 2019/10/12 09:31:42 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.155 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1540,18 +1540,20 @@ unsigned corpstatflags; otmp = mksobj_at(objtype, x, y, init, FALSE); } - /* when 'mtmp' is non-null make a corpse or statue of that monster, - otherwise keep the random type chosen by mksobj() */ + /* when 'mtmp' is non-null save the monster's details with the + corpse or statue; it will also force the 'ptr' override below */ if (mtmp) { - int old_corpsenm = otmp->corpsenm; - /* save_mtraits updates otmp->oextra->omonst in place */ (void) save_mtraits(otmp, mtmp); - /* when 'ptr' is non-null use the type specified by our caller, - otherwise use the monster's species for the corpse */ if (!ptr) ptr = mtmp->data; + } + + /* when 'ptr' is non-null it comes from our caller or from 'mtmp'; + override mkobjs()'s initialization of a random monster type */ + if (ptr) { + int old_corpsenm = otmp->corpsenm; otmp->corpsenm = monsndx(ptr); otmp->owt = weight(otmp); -- 2.49.0