controlling u.ustuck

Setting or clearing u.ustuck now requires that context.botl be set,
so make a new routine to take care of both instead of manipulating
that pointer directly.
This commit is contained in:
PatR
2020-02-16 13:04:12 -08:00
parent c7ec28f4c7
commit 3981e3e6e5
15 changed files with 71 additions and 57 deletions
+4 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 extern.h $NHDT-Date: 1581562570 2020/02/13 02:56:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.796 $ */ /* NetHack 3.6 extern.h $NHDT-Date: 1581886855 2020/02/16 21:00:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.797 $ */
/* Copyright (c) Steve Creps, 1988. */ /* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1468,6 +1468,7 @@ E void FDECL(mondied, (struct monst *));
E void FDECL(mongone, (struct monst *)); E void FDECL(mongone, (struct monst *));
E void FDECL(monstone, (struct monst *)); E void FDECL(monstone, (struct monst *));
E void FDECL(monkilled, (struct monst *, const char *, int)); E void FDECL(monkilled, (struct monst *, const char *, int));
E void FDECL(set_ustuck, (struct monst *));
E void FDECL(unstuck, (struct monst *)); E void FDECL(unstuck, (struct monst *));
E void FDECL(killed, (struct monst *)); E void FDECL(killed, (struct monst *));
E void FDECL(xkilled, (struct monst *, int)); E void FDECL(xkilled, (struct monst *, int));
@@ -1515,8 +1516,8 @@ E boolean FDECL(poly_when_stoned, (struct permonst *));
E boolean FDECL(resists_drli, (struct monst *)); E boolean FDECL(resists_drli, (struct monst *));
E boolean FDECL(resists_magm, (struct monst *)); E boolean FDECL(resists_magm, (struct monst *));
E boolean FDECL(resists_blnd, (struct monst *)); E boolean FDECL(resists_blnd, (struct monst *));
E boolean E boolean FDECL(can_blnd, (struct monst *, struct monst *,
FDECL(can_blnd, (struct monst *, struct monst *, UCHAR_P, struct obj *)); UCHAR_P, struct obj *));
E boolean FDECL(ranged_attk, (struct permonst *)); E boolean FDECL(ranged_attk, (struct permonst *));
E boolean FDECL(hates_silver, (struct permonst *)); E boolean FDECL(hates_silver, (struct permonst *));
E boolean FDECL(mon_hates_silver, (struct monst *)); E boolean FDECL(mon_hates_silver, (struct monst *));
+5 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 apply.c $NHDT-Date: 1580476196 2020/01/31 13:09:56 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.316 $ */ /* NetHack 3.6 apply.c $NHDT-Date: 1581886857 2020/02/16 21:00:57 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.317 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1721,8 +1721,10 @@ int magic; /* 0=Physical, otherwise skill level */
return 0; return 0;
} else if (u.ustuck) { } else if (u.ustuck) {
if (u.ustuck->mtame && !Conflict && !u.ustuck->mconf) { if (u.ustuck->mtame && !Conflict && !u.ustuck->mconf) {
You("pull free from %s.", mon_nam(u.ustuck)); struct monst *mtmp = u.ustuck;
u.ustuck = 0;
set_ustuck((struct monst *) 0);
You("pull free from %s.", mon_nam(mtmp));
return 1; return 1;
} }
if (magic) { if (magic) {
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 artifact.c $NHDT-Date: 1577662239 2019/12/29 23:30:39 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.152 $ */ /* NetHack 3.6 artifact.c $NHDT-Date: 1581886858 2020/02/16 21:00:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.153 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1061,7 +1061,7 @@ char *hittee; /* target's name: "you" or mon_nam(mdef) */
g.multi_reason = "being scared stiff"; g.multi_reason = "being scared stiff";
g.nomovemsg = ""; g.nomovemsg = "";
if (magr && magr == u.ustuck && sticks(g.youmonst.data)) { if (magr && magr == u.ustuck && sticks(g.youmonst.data)) {
u.ustuck = (struct monst *) 0; set_ustuck((struct monst *) 0);
You("release %s!", mon_nam(magr)); You("release %s!", mon_nam(magr));
} }
} }
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 cmd.c $NHDT-Date: 1581322659 2020/02/10 08:17:39 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.398 $ */ /* NetHack 3.6 cmd.c $NHDT-Date: 1581886858 2020/02/16 21:00:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.400 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -824,7 +824,7 @@ boolean pre, wiztower;
reset_utrap(FALSE); reset_utrap(FALSE);
check_special_room(TRUE); /* room exit */ check_special_room(TRUE); /* room exit */
u.ustuck = (struct monst *) 0; u.ustuck = (struct monst *) 0;
u.uswallow = 0; u.uswallow = u.uswldtim = 0;
u.uinwater = 0; u.uinwater = 0;
u.uundetected = 0; /* not hidden, even if means are available */ u.uundetected = 0; /* not hidden, even if means are available */
dmonsfree(); /* purge dead monsters from 'fmon' */ dmonsfree(); /* purge dead monsters from 'fmon' */
+3 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 do.c $NHDT-Date: 1581810044 2020/02/15 23:40:44 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.226 $ */ /* NetHack 3.6 do.c $NHDT-Date: 1581886859 2020/02/16 21:00:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.227 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */ /*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1373,12 +1373,11 @@ boolean at_stairs, falling, portal;
unplacebc(); unplacebc();
reset_utrap(FALSE); /* needed in level_tele */ reset_utrap(FALSE); /* needed in level_tele */
fill_pit(u.ux, u.uy); fill_pit(u.ux, u.uy);
u.ustuck = 0; /* idem */ set_ustuck((struct monst *) 0); /* idem */
u.uswallow = u.uswldtim = 0;
u.uinwater = 0; u.uinwater = 0;
u.uundetected = 0; /* not hidden, even if means are available */ u.uundetected = 0; /* not hidden, even if means are available */
keepdogs(FALSE); keepdogs(FALSE);
if (u.uswallow) /* idem */
u.uswldtim = u.uswallow = 0;
recalc_mapseen(); /* recalculate map overview before we leave the level */ recalc_mapseen(); /* recalculate map overview before we leave the level */
/* /*
* We no longer see anything on the level. Make sure that this * We no longer see anything on the level. Make sure that this
+8 -6
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 hack.c $NHDT-Date: 1581810065 2020/02/15 23:41:05 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.247 $ */ /* NetHack 3.6 hack.c $NHDT-Date: 1581886860 2020/02/16 21:01:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.248 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */ /*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1537,13 +1537,14 @@ domove_core()
if (u.ustuck && (x != u.ustuck->mx || y != u.ustuck->my)) { if (u.ustuck && (x != u.ustuck->mx || y != u.ustuck->my)) {
if (distu(u.ustuck->mx, u.ustuck->my) > 2) { if (distu(u.ustuck->mx, u.ustuck->my) > 2) {
/* perhaps it fled (or was teleported or ... ) */ /* perhaps it fled (or was teleported or ... ) */
u.ustuck = 0; set_ustuck((struct monst *) 0);
} else if (sticks(g.youmonst.data)) { } else if (sticks(g.youmonst.data)) {
/* When polymorphed into a sticking monster, /* When polymorphed into a sticking monster,
* u.ustuck means it's stuck to you, not you to it. * u.ustuck means it's stuck to you, not you to it.
*/ */
You("release %s.", mon_nam(u.ustuck)); mtmp = u.ustuck;
u.ustuck = 0; set_ustuck((struct monst *) 0);
You("release %s.", mon_nam(mtmp));
} else { } else {
/* If holder is asleep or paralyzed: /* If holder is asleep or paralyzed:
* 37.5% chance of getting away, * 37.5% chance of getting away,
@@ -1559,8 +1560,9 @@ domove_core()
case 1: case 1:
case 2: case 2:
pull_free: pull_free:
You("pull free from %s.", mon_nam(u.ustuck)); mtmp = u.ustuck;
u.ustuck = 0; set_ustuck((struct monst *) 0);
You("pull free from %s.", mon_nam(mtmp));
break; break;
case 3: case 3:
if (!u.ustuck->mcanmove) { if (!u.ustuck->mcanmove) {
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 mhitm.c $NHDT-Date: 1573773926 2019/11/14 23:25:26 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.118 $ */ /* NetHack 3.6 mhitm.c $NHDT-Date: 1581886861 2020/02/16 21:01:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.130 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -146,8 +146,8 @@ register struct monst *mtmp;
if (monnear(mtmp, mon->mx, mon->my)) { if (monnear(mtmp, mon->mx, mon->my)) {
if (!u.uswallow && (mtmp == u.ustuck)) { if (!u.uswallow && (mtmp == u.ustuck)) {
if (!rn2(4)) { if (!rn2(4)) {
set_ustuck((struct monst *) 0);
pline("%s releases you!", Monnam(mtmp)); pline("%s releases you!", Monnam(mtmp));
u.ustuck = 0;
} else } else
break; break;
} }
+12 -12
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 mhitu.c $NHDT-Date: 1581810070 2020/02/15 23:41:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.182 $ */ /* NetHack 3.6 mhitu.c $NHDT-Date: 1581886862 2020/02/16 21:01:02 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.183 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -534,7 +534,7 @@ register struct monst *mtmp;
pline("Wait, %s! That's a %s named %s!", m_monnam(mtmp), pline("Wait, %s! That's a %s named %s!", m_monnam(mtmp),
g.youmonst.data->mname, g.plname); g.youmonst.data->mname, g.plname);
if (sticky) if (sticky)
u.ustuck = mtmp; set_ustuck(mtmp);
g.youmonst.m_ap_type = M_AP_NOTHING; g.youmonst.m_ap_type = M_AP_NOTHING;
g.youmonst.mappearance = 0; g.youmonst.mappearance = 0;
newsym(u.ux, u.uy); newsym(u.ux, u.uy);
@@ -973,7 +973,7 @@ register struct attack *mattk;
if (u_slip_free(mtmp, mattk)) { if (u_slip_free(mtmp, mattk)) {
dmg = 0; dmg = 0;
} else { } else {
u.ustuck = mtmp; set_ustuck(mtmp);
pline("%s grabs you!", Monnam(mtmp)); pline("%s grabs you!", Monnam(mtmp));
} }
} else if (u.ustuck == mtmp) { } else if (u.ustuck == mtmp) {
@@ -1269,8 +1269,7 @@ register struct attack *mattk;
case AD_STCK: case AD_STCK:
hitmsg(mtmp, mattk); hitmsg(mtmp, mattk);
if (uncancelled && !u.ustuck && !sticks(g.youmonst.data)) { if (uncancelled && !u.ustuck && !sticks(g.youmonst.data)) {
g.context.botl = 1; set_ustuck(mtmp);
u.ustuck = mtmp;
} }
break; break;
case AD_WRAP: case AD_WRAP:
@@ -1279,9 +1278,8 @@ register struct attack *mattk;
if (u_slip_free(mtmp, mattk)) { if (u_slip_free(mtmp, mattk)) {
dmg = 0; dmg = 0;
} else { } else {
g.context.botl = 1; set_ustuck(mtmp); /* before message, for botl update */
pline("%s swings itself around you!", Monnam(mtmp)); pline("%s swings itself around you!", Monnam(mtmp));
u.ustuck = mtmp;
} }
} else if (u.ustuck == mtmp) { } else if (u.ustuck == mtmp) {
if (is_pool(mtmp->mx, mtmp->my) && !Swimming && !Amphibious) { if (is_pool(mtmp->mx, mtmp->my) && !Swimming && !Amphibious) {
@@ -1296,8 +1294,9 @@ register struct attack *mattk;
moat ? "moat" : "pool of water", moat ? "moat" : "pool of water",
an(mtmp->data->mname)); an(mtmp->data->mname));
done(DROWNING); done(DROWNING);
} else if (mattk->aatyp == AT_HUGS) } else if (mattk->aatyp == AT_HUGS) {
You("are being crushed."); You("are being crushed.");
}
} else { } else {
dmg = 0; dmg = 0;
if (flags.verbose) if (flags.verbose)
@@ -1801,7 +1800,7 @@ struct attack *mattk;
remove_monster(omx, omy); remove_monster(omx, omy);
mtmp->mtrapped = 0; /* no longer on old trap */ mtmp->mtrapped = 0; /* no longer on old trap */
place_monster(mtmp, u.ux, u.uy); place_monster(mtmp, u.ux, u.uy);
u.ustuck = mtmp; set_ustuck(mtmp);
newsym(mtmp->mx, mtmp->my); newsym(mtmp->mx, mtmp->my);
if (is_animal(mtmp->data) && u.usteed) { if (is_animal(mtmp->data) && u.usteed) {
char buf[BUFSZ]; char buf[BUFSZ];
@@ -1814,8 +1813,9 @@ struct attack *mattk;
pline("%s lunges forward and plucks you off %s!", Monnam(mtmp), pline("%s lunges forward and plucks you off %s!", Monnam(mtmp),
buf); buf);
dismount_steed(DISMOUNT_ENGULFED); dismount_steed(DISMOUNT_ENGULFED);
} else } else {
pline("%s engulfs you!", Monnam(mtmp)); pline("%s engulfs you!", Monnam(mtmp));
}
stop_occupation(); stop_occupation();
reset_occupations(); /* behave as if you had moved */ reset_occupations(); /* behave as if you had moved */
@@ -1843,7 +1843,7 @@ struct attack *mattk;
fully swallowed yet so that won't work here */ fully swallowed yet so that won't work here */
if (Punished) if (Punished)
placebc(); placebc();
u.ustuck = 0; set_ustuck((struct monst *) 0);
return (!DEADMONSTER(mtmp)) ? 0 : 2; return (!DEADMONSTER(mtmp)) ? 0 : 2;
} }
@@ -1869,7 +1869,7 @@ struct attack *mattk;
} }
/* u.uswldtim always set > 1 */ /* u.uswldtim always set > 1 */
u.uswldtim = (unsigned) ((tim_tmp < 2) ? 2 : tim_tmp); u.uswldtim = (unsigned) ((tim_tmp < 2) ? 2 : tim_tmp);
swallowed(1); swallowed(1); /* update the map display, shows hero swallowed */
for (otmp2 = g.invent; otmp2; otmp2 = otmp2->nobj) for (otmp2 = g.invent; otmp2; otmp2 = otmp2->nobj)
(void) snuff_lit(otmp2); (void) snuff_lit(otmp2);
} }
+12 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 mon.c $NHDT-Date: 1581810072 2020/02/15 23:41:12 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.323 $ */ /* NetHack 3.6 mon.c $NHDT-Date: 1581886863 2020/02/16 21:01:03 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.324 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */ /*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1683,7 +1683,7 @@ struct monst *mtmp, *mtmp2;
mtmp2->nmon = fmon; mtmp2->nmon = fmon;
fmon = mtmp2; fmon = mtmp2;
if (u.ustuck == mtmp) if (u.ustuck == mtmp)
u.ustuck = mtmp2; set_ustuck(mtmp2);
if (u.usteed == mtmp) if (u.usteed == mtmp)
u.usteed = mtmp2; u.usteed = mtmp2;
if (mtmp2->isshk) if (mtmp2->isshk)
@@ -2314,15 +2314,23 @@ int how;
mondied(mdef); mondied(mdef);
} }
void
set_ustuck(mtmp)
struct monst *mtmp;
{
g.context.botl = 1;
u.ustuck = mtmp;
}
void void
unstuck(mtmp) unstuck(mtmp)
struct monst *mtmp; struct monst *mtmp;
{ {
if (u.ustuck == mtmp) { if (u.ustuck == mtmp) {
g.context.botl = 1;
/* do this first so that docrt()'s botl update is accurate; /* do this first so that docrt()'s botl update is accurate;
safe to do as long as u.uswallow is also cleared before docrt() */ safe to do as long as u.uswallow is also cleared before docrt() */
u.ustuck = (struct monst *) 0; set_ustuck((struct monst *) 0);
if (u.uswallow) { if (u.uswallow) {
u.ux = mtmp->mx; u.ux = mtmp->mx;
u.uy = mtmp->my; u.uy = mtmp->my;
+7 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 polyself.c $NHDT-Date: 1579660157 2020/01/22 02:29:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.149 $ */ /* NetHack 3.6 polyself.c $NHDT-Date: 1581886864 2020/02/16 21:01:04 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.150 $ */
/* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */ /* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -767,7 +767,7 @@ int mntmp;
grabber to engulfer or vice versa because engulfing by poly'd hero grabber to engulfer or vice versa because engulfing by poly'd hero
always ends immediately so won't be in effect during a polymorph] */ always ends immediately so won't be in effect during a polymorph] */
if (!sticky && !u.uswallow && u.ustuck && sticks(g.youmonst.data)) if (!sticky && !u.uswallow && u.ustuck && sticks(g.youmonst.data))
u.ustuck = 0; set_ustuck((struct monst *) 0);
else if (sticky && !sticks(g.youmonst.data)) else if (sticky && !sticks(g.youmonst.data))
uunstick(); uunstick();
@@ -1622,12 +1622,14 @@ domindblast()
void void
uunstick() uunstick()
{ {
if (!u.ustuck) { struct monst *mtmp = u.ustuck;
if (!mtmp) {
impossible("uunstick: no ustuck?"); impossible("uunstick: no ustuck?");
return; return;
} }
pline("%s is no longer in your clutches.", Monnam(u.ustuck)); set_ustuck((struct monst *) 0); /* before pline() */
u.ustuck = 0; pline("%s is no longer in your clutches.", Monnam(mtmp));
} }
void void
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 restore.c $NHDT-Date: 1575245087 2019/12/02 00:04:47 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.136 $ */ /* NetHack 3.7 restore.c $NHDT-Date: 1581886865 2020/02/16 21:01:05 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.163 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2009. */ /*-Copyright (c) Michael Allison, 2009. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -775,7 +775,7 @@ unsigned int stuckid, steedid;
break; break;
if (!mtmp) if (!mtmp)
panic("Cannot find the monster ustuck."); panic("Cannot find the monster ustuck.");
u.ustuck = mtmp; set_ustuck(mtmp);
} }
if (steedid) { if (steedid) {
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 save.c $NHDT-Date: 1559994625 2019/06/08 11:50:25 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.121 $ */ /* NetHack 3.6 save.c $NHDT-Date: 1581886866 2020/02/16 21:01:06 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.153 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2009. */ /*-Copyright (c) Michael Allison, 2009. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -216,7 +216,7 @@ dosave0()
/* these pointers are no longer valid, and at least u.usteed /* these pointers are no longer valid, and at least u.usteed
* may mislead place_monster() on other levels * may mislead place_monster() on other levels
*/ */
u.ustuck = (struct monst *) 0; set_ustuck((struct monst *) 0);
u.usteed = (struct monst *) 0; u.usteed = (struct monst *) 0;
for (ltmp = (xchar) 1; ltmp <= maxledgerno(); ltmp++) { for (ltmp = (xchar) 1; ltmp <= maxledgerno(); ltmp++) {
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 teleport.c $NHDT-Date: 1581210886 2020/02/09 01:14:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.112 $ */ /* NetHack 3.6 teleport.c $NHDT-Date: 1581886867 2020/02/16 21:01:07 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.113 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -323,7 +323,7 @@ int teleds_flags;
} }
} }
reset_utrap(FALSE); reset_utrap(FALSE);
u.ustuck = 0; set_ustuck((struct monst *) 0);
u.ux0 = u.ux; u.ux0 = u.ux;
u.uy0 = u.uy; u.uy0 = u.uy;
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 trap.c $NHDT-Date: 1578624299 2020/01/10 02:44:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.349 $ */ /* NetHack 3.6 trap.c $NHDT-Date: 1581886868 2020/02/16 21:01:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.351 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2987,7 +2987,7 @@ long hmask, emask; /* might cancel timeout */
else else
pline("Startled, %s can no longer hold you!", pline("Startled, %s can no longer hold you!",
mon_nam(u.ustuck)); mon_nam(u.ustuck));
u.ustuck = 0; set_ustuck((struct monst *) 0);
} }
/* kludge alert: /* kludge alert:
* drown() and lava_effects() print various messages almost * drown() and lava_effects() print various messages almost
+6 -6
View File
@@ -1,4 +1,4 @@
/* NetHack 3.6 uhitm.c $NHDT-Date: 1573764936 2019/11/14 20:55:36 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.215 $ */ /* NetHack 3.6 uhitm.c $NHDT-Date: 1581886869 2020/02/16 21:01:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.227 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -145,7 +145,7 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
/* applied pole-arm attack is too far to get stuck */ /* applied pole-arm attack is too far to get stuck */
&& distu(mtmp->mx, mtmp->my) <= 2) { && distu(mtmp->mx, mtmp->my) <= 2) {
if (!u.ustuck && !mtmp->mflee && dmgtype(mtmp->data, AD_STCK)) if (!u.ustuck && !mtmp->mflee && dmgtype(mtmp->data, AD_STCK))
u.ustuck = mtmp; set_ustuck(mtmp);
} }
/* #H7329 - if hero is on engraved "Elbereth", this will end up /* #H7329 - if hero is on engraved "Elbereth", this will end up
* assessing an alignment penalty and removing the engraving * assessing an alignment penalty and removing the engraving
@@ -495,7 +495,7 @@ int dieroll;
monflee(mon, !rn2(3) ? rnd(100) : 0, FALSE, TRUE); monflee(mon, !rn2(3) ? rnd(100) : 0, FALSE, TRUE);
if (u.ustuck == mon && !u.uswallow && !sticks(g.youmonst.data)) if (u.ustuck == mon && !u.uswallow && !sticks(g.youmonst.data))
u.ustuck = 0; set_ustuck((struct monst *) 0);
} }
/* Vorpal Blade hit converted to miss */ /* Vorpal Blade hit converted to miss */
/* could be headless monster or worm tail */ /* could be headless monster or worm tail */
@@ -1933,7 +1933,7 @@ int specialdmg; /* blessed and/or silver bonus against various things */
tmp = 0; tmp = 0;
} else { } else {
You("swing yourself around %s!", mon_nam(mdef)); You("swing yourself around %s!", mon_nam(mdef));
u.ustuck = mdef; set_ustuck(mdef);
} }
} else if (u.ustuck == mdef) { } else if (u.ustuck == mdef) {
/* Monsters don't wear amulets of magical breathing */ /* Monsters don't wear amulets of magical breathing */
@@ -2631,7 +2631,7 @@ register struct monst *mon;
if (u.ustuck && u.ustuck != mon) if (u.ustuck && u.ustuck != mon)
uunstick(); uunstick();
You("grab %s!", mon_nam(mon)); You("grab %s!", mon_nam(mon));
u.ustuck = mon; set_ustuck(mon);
if (silverhit && flags.verbose) if (silverhit && flags.verbose)
silver_sears(&g.youmonst, mon, silverhit); silver_sears(&g.youmonst, mon, silverhit);
sum[i] = damageum(mon, mattk, specialdmg); sum[i] = damageum(mon, mattk, specialdmg);
@@ -3042,7 +3042,7 @@ struct monst *mtmp;
const char *fmt = "Wait! That's %s!", *generic = "a monster", *what = 0; const char *fmt = "Wait! That's %s!", *generic = "a monster", *what = 0;
if (!u.ustuck && !mtmp->mflee && dmgtype(mtmp->data, AD_STCK)) if (!u.ustuck && !mtmp->mflee && dmgtype(mtmp->data, AD_STCK))
u.ustuck = mtmp; set_ustuck(mtmp);
if (Blind) { if (Blind) {
if (!Blind_telepat) if (!Blind_telepat)