From: PatR Date: Sat, 5 Sep 2020 18:35:28 +0000 (-0700) Subject: polearm context X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bce7834f71ea1c1c2e683d021ca2694f5006e024;p=nethack 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. --- diff --git a/src/dog.c b/src/dog.c index 44ef538ff..14a6b1992 100644 --- a/src/dog.c +++ b/src/dog.c @@ -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 */ diff --git a/src/mon.c b/src/mon.c index a4c0f6f90..83e28ebbc 100644 --- a/src/mon.c +++ b/src/mon.c @@ -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,