fix pull request #505 - undead turning

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
This commit is contained in:
PatR
2021-05-07 11:58:58 -07:00
parent cecda13ab2
commit dd6ed5026b
2 changed files with 10 additions and 2 deletions

View 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

View File

@@ -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)) {