]> granicus.if.org Git - nethack/commitdiff
fix pull request #505 - undead turning
authorPatR <rankin@nethack.org>
Fri, 7 May 2021 18:58:58 +0000 (11:58 -0700)
committerPatR <rankin@nethack.org>
Fri, 7 May 2021 18:58:58 +0000 (11:58 -0700)
zapped at corpse flagged as "no revive".  A fairly recent change
made undead turning override no-revive if it hit someone carrying
a corpse flagged that way (corpse of a troll killed by Trollsbane
or stuffed in an ice box or explicitly cancelled) but neglected to
do so for corpses zapped while on the floor.  This fixes that, for
undead turning zapped by monsters as well as by the hero.

Fixes #505

doc/fixes37.0
src/zap.c

index 284ccc8cfef4202a4bd39f148a4d29fb92fdba3c..e0c478227cbc3e7fbc2309d368e777c9f83a3f32 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.526 $ $NHDT-Date: 1620348705 2021/05/07 00:51:45 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.527 $ $NHDT-Date: 1620413928 2021/05/07 18:58:48 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -655,6 +655,8 @@ if a <foo> corpse was set to revive as a <foo> zombie and corpse was partly
        nutrition that <foo> zombie, oeaten_stat() could give the warning
        "partly eaten food more nutritious than untouched food" when used to
        calculate zombie's hit points (depended upon how much had been eaten)
+undead turning magic revived corpses flagged as no-revive if they were being
+       carried but not if they were zapped while on the floor
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index a3fb0884a6fb8687e1b3bf85410589d33d83b181..bbd1e5af8ca4a943c1c8f1d0e14fe5e76b073f48 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -1,4 +1,4 @@
-/* NetHack 3.7 zap.c   $NHDT-Date: 1596498233 2020/08/03 23:43:53 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.346 $ */
+/* NetHack 3.7 zap.c   $NHDT-Date: 1620413928 2021/05/07 18:58:48 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.360 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2013. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -2101,6 +2101,7 @@ bhito(struct obj *obj, struct obj *otmp)
             } else if (obj->otyp == CORPSE) {
                 struct monst *mtmp;
                 xchar ox, oy;
+                unsigned save_norevive;
                 boolean by_u = !g.context.mon_moving;
                 int corpsenm = corpse_revive_type(obj);
                 char *corpsname = cxname_singular(obj);
@@ -2109,8 +2110,13 @@ bhito(struct obj *obj, struct obj *otmp)
                 if (!get_obj_location(obj, &ox, &oy, 0))
                     ox = obj->ox, oy = obj->oy; /* won't happen */
 
+                /* explicit revival magic overrides timer-based no-revive */
+                save_norevive = obj->norevive;
+                obj->norevive = 0;
+
                 mtmp = revive(obj, TRUE);
                 if (!mtmp) {
+                    obj->norevive = save_norevive;
                     res = 0; /* no monster implies corpse was left intact */
                 } else {
                     if (cansee(ox, oy)) {