polearm context

Move clearing of polearm context from migrate_to_lev() to lower
level relmon().  Add missing transfer of polearm context from
old mon to new mon in replmon().  These days it seems to only be
used for creating a monster from saved traits, so polearm context
in it should be moot.
This commit is contained in:
PatR
2020-09-05 11:35:28 -07:00
parent 13cf558e6b
commit bce7834f71
2 changed files with 8 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 dog.c $NHDT-Date: 1596498159 2020/08/03 23:42:39 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.103 $ */
/* NetHack 3.7 dog.c $NHDT-Date: 1599330917 2020/09/05 18:35:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.104 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -726,8 +726,6 @@ coord *cc; /* optional destination coordinates */
mtmp->mux = new_lev.dnum;
mtmp->muy = new_lev.dlevel;
mtmp->mx = mtmp->my = 0; /* this implies migration */
if (mtmp == g.context.polearm.hitmon)
g.context.polearm.hitmon = (struct monst *) 0;
}
/* return quality of food; the lower the better */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 mon.c $NHDT-Date: 1598575089 2020/08/28 00:38:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.344 $ */
/* NetHack 3.7 mon.c $NHDT-Date: 1599330921 2020/09/05 18:35:21 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.345 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1809,6 +1809,9 @@ struct monst *mtmp, *mtmp2;
otmp->ocarry = mtmp2;
}
mtmp->minvent = 0;
/* before relmon(mtmp), because it could clear polearm.hitmon */
if (g.context.polearm.hitmon == mtmp)
g.context.polearm.hitmon = mtmp2;
/* remove the old monster from the map and from `fmon' list */
relmon(mtmp, (struct monst **) 0);
@@ -1853,6 +1856,9 @@ struct monst **monst_list; /* &g.migrating_mons or &g.mydogs or null */
if (!fmon)
panic("relmon: no fmon available.");
if (mon == g.context.polearm.hitmon)
g.context.polearm.hitmon = (struct monst *) 0;
if (unhide) {
/* can't remain hidden across level changes (exception: wizard
clone can continue imitating some other monster form); also,