From 654b7d41b2a0314bfb04f77486d9385455775c5a Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 2 May 2023 18:02:02 -0700 Subject: [PATCH] fix #K3907 - reviving buried corpse Burying an olog-hai corpse with a boulder resulted in a panic when its time to revive occurred. I was able to reproduce this once but failed with "you feel less hassled" several times (using same save file for multiple tests) so I'm not quite sure what was happening. A buried corpse was allowed to revive if it was for a zombie. This fix extends that to auto-revivers (trolls and Riders). The corpse keeps its revive_mon timer rather than changing that to zombify_mon. If/when revival of a buried troll or Rider happens while in view, it will "claw itself out of the ground" like zombies do. --- doc/fixes3-7-0.txt | 4 +++- src/do.c | 8 +++++++- src/zap.c | 9 +++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index f91e72c6f..a004006be 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1552,6 +1552,8 @@ anti-magic field's reduction of hero's maximum energy could result in current if hero was killed by a wand zapped by a monster, cause of death was reported as "killed by a bolt of imagined by " throttle the difficulty of the monsters in theme room "buried zombies" +buried troll whose auto-revive timer expired might triger panic with + "revive default case 6" Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository @@ -1790,7 +1792,7 @@ Qt: use idPressed signal instead of buttonPressed and mappedString instead of mapped for recent Qt (pr #913 by chasonr) Qt+macOS: fix control key (fixed all except for ^V); handle ^V as a shortcut Qt+macOS: rename menu entry "nethack->Preferences..." for invoking nethack's - key 'O' command to "Game->Run-time options" and entry "Game->Qt settings" + 'O' command to "Game->Run-time options" and entry "Game->Qt settings" for making persistent Qt customizations to "nethack->Preferences..." Qt+macOS: prevent game->Quit-without-saving from being hijacked for the nethack menu by renaming it game->_Quit-without-saving (macOS only) diff --git a/src/do.c b/src/do.c index 6de5df6e3..45dd251ed 100644 --- a/src/do.c +++ b/src/do.c @@ -2002,10 +2002,16 @@ revive_corpse(struct obj *corpse) char cname[BUFSZ]; struct obj *container = (struct obj *) 0; int container_where = 0; - boolean is_zomb = (mons[corpse->corpsenm].mlet == S_ZOMBIE); + int montype; + boolean is_zomb; coordxy corpsex, corpsey; where = corpse->where; + montype = corpse->corpsenm; + /* treat buried auto-reviver (troll, Rider?) like a zombie + so that it can dig itself out of the ground if it revives */ + is_zomb = (mons[montype].mlet == S_ZOMBIE + || (where == OBJ_BURIED && is_reviver(&mons[montype]))); is_uwep = (corpse == uwep); chewed = (corpse->oeaten != 0); Strcpy(cname, corpse_xname(corpse, diff --git a/src/zap.c b/src/zap.c index 681ce46fd..eb07d5064 100644 --- a/src/zap.c +++ b/src/zap.c @@ -839,12 +839,18 @@ revive(struct obj *corpse, boolean by_hero) boolean one_of; mmflags_nht mmflags = NO_MINVENT | MM_NOWAIT | MM_NOMSG; int montype, cgend, container_nesting = 0; - boolean is_zomb = (mons[corpse->corpsenm].mlet == S_ZOMBIE); + boolean is_zomb; if (corpse->otyp != CORPSE) { impossible("Attempting to revive %s?", xname(corpse)); return (struct monst *) 0; } + montype = corpse->corpsenm; + /* treat buried auto-reviver (troll, Rider?) like a zombie + so that it can dig itself out of the ground if it revives */ + is_zomb = mons[montype].mlet == S_ZOMBIE + || (corpse->where == OBJ_BURIED && is_reviver(&mons[montype])); + /* if this corpse is being eaten, stop doing that; this should be done after makemon() succeeds and skipped if it fails, but waiting until we know the result for that would be too late */ @@ -897,7 +903,6 @@ revive(struct obj *corpse, boolean by_hero) return (struct monst *) 0; /* prepare for the monster */ - montype = corpse->corpsenm; mptr = &mons[montype]; /* [should probably handle recorporealization first; if corpse and ghost are at same location, revived creature shouldn't be bumped