mongone vs vault guard

mongone() would send away a vault guard, whether alive or already
dead and parked at <0,0>, losing the information needed to remove
the temporary vault corridor once whatever obstacle (ie, the hero)
that's keeping it in place has been cleared.  Have mongone() call
grddead() like mondead() does, so that a guard will just be moved
to <0,0> with 0 HP and kept there rather than being purged during
the next dead monster removal.

Move polearm context reset to m_detach() [and, unfortunately,
duplicated in grddead()] rather than in having it in dmonsfree()
since execution of the latter is deferred.  I'm not sure offhand
whether a fast hero could get a second move before end-of-turn
purging of dead monsters.
This commit is contained in:
PatR
2015-04-20 19:45:13 -07:00
parent 32ed364086
commit 7bbf292c92
2 changed files with 18 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 mon.c $NHDT-Date: 1426470347 2015/03/16 01:45:47 $ $NHDT-Branch: derek-farming $:$NHDT-Revision: 1.140 $ */
/* NetHack 3.5 mon.c $NHDT-Date: 1429584308 2015/04/21 02:45:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.164 $ */
/* NetHack 3.5 mon.c $Date: 2012/05/16 02:15:10 $ $Revision: 1.126 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1256,15 +1256,13 @@ dmonsfree()
int count = 0;
for (mtmp = &fmon; *mtmp;) {
freetmp = *mtmp;
if (freetmp->mhp <= 0 && !freetmp->isgd) {
if (freetmp == context.polearm.hitmon)
context.polearm.hitmon = NULL;
*mtmp = freetmp->nmon;
dealloc_monst(freetmp);
count++;
} else
mtmp = &(freetmp->nmon);
freetmp = *mtmp;
if (freetmp->mhp <= 0 && !freetmp->isgd) {
*mtmp = freetmp->nmon;
dealloc_monst(freetmp);
count++;
} else
mtmp = &(freetmp->nmon);
}
if (count != iflags.purge_monsters)
@@ -1433,6 +1431,8 @@ m_detach(mtmp, mptr)
struct monst *mtmp;
struct permonst *mptr; /* reflects mtmp->data _prior_ to mtmp's death */
{
if (mtmp == context.polearm.hitmon)
context.polearm.hitmon = 0;
if (mtmp->mleashed) m_unleash(mtmp, FALSE);
/* to prevent an infinite relobj-flooreffects-hmon-killed loop */
mtmp->mtrapped = 0;
@@ -1720,7 +1720,11 @@ mongone(mdef)
register struct monst *mdef;
{
mdef->mhp = 0; /* can skip some inventory bookkeeping */
/* Player is thrown from his steed when it disappears */
/* dead vault guard is actually kept at coordinate <0,0> until
his temporary corridor to/from the vault has been removed */
if (mdef->isgd && !grddead(mdef)) return;
/* hero is thrown from his steed when it disappears */
if (mdef == u.usteed)
dismount_steed(DISMOUNT_GENERIC);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.5 vault.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 vault.c $NHDT-Date: 1429584309 2015/04/21 02:45:09 $ $NHDT-Branch: master $:$NHDT-Revision: 1.33 $ */
/* NetHack 3.5 vault.c $Date: 2011/10/13 00:31:10 $ $Revision: 1.28 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -141,6 +141,8 @@ register struct monst *grd;
relobj(grd, 0, FALSE);
/* guard is dead; monster traversal loops should skip it */
grd->mhp = 0;
if (grd == context.polearm.hitmon)
context.polearm.hitmon = 0;
/* see comment by newpos in gd_move() */
remove_monster(grd->mx, grd->my);
newsym(grd->mx, grd->my);