-/* 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. */
/* NetHack may be freely redistributed. See license for details. */
E void FDECL(mongone, (struct monst *));
E void FDECL(monstone, (struct monst *));
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(killed, (struct monst *));
E void FDECL(xkilled, (struct monst *, int));
E boolean FDECL(resists_drli, (struct monst *));
E boolean FDECL(resists_magm, (struct monst *));
E boolean FDECL(resists_blnd, (struct monst *));
-E boolean
-FDECL(can_blnd, (struct monst *, struct monst *, UCHAR_P, struct obj *));
+E boolean FDECL(can_blnd, (struct monst *, struct monst *,
+ UCHAR_P, struct obj *));
E boolean FDECL(ranged_attk, (struct permonst *));
E boolean FDECL(hates_silver, (struct permonst *));
E boolean FDECL(mon_hates_silver, (struct monst *));
-/* 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) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
return 0;
} else if (u.ustuck) {
if (u.ustuck->mtame && !Conflict && !u.ustuck->mconf) {
- You("pull free from %s.", mon_nam(u.ustuck));
- u.ustuck = 0;
+ struct monst *mtmp = u.ustuck;
+
+ set_ustuck((struct monst *) 0);
+ You("pull free from %s.", mon_nam(mtmp));
return 1;
}
if (magic) {
-/* 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) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
g.multi_reason = "being scared stiff";
g.nomovemsg = "";
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));
}
}
-/* 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) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
reset_utrap(FALSE);
check_special_room(TRUE); /* room exit */
u.ustuck = (struct monst *) 0;
- u.uswallow = 0;
+ u.uswallow = u.uswldtim = 0;
u.uinwater = 0;
u.uundetected = 0; /* not hidden, even if means are available */
dmonsfree(); /* purge dead monsters from 'fmon' */
-/* 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) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
unplacebc();
reset_utrap(FALSE); /* needed in level_tele */
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.uundetected = 0; /* not hidden, even if means are available */
keepdogs(FALSE);
- if (u.uswallow) /* idem */
- u.uswldtim = u.uswallow = 0;
recalc_mapseen(); /* recalculate map overview before we leave the level */
/*
* We no longer see anything on the level. Make sure that this
-/* 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) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
if (u.ustuck && (x != u.ustuck->mx || y != u.ustuck->my)) {
if (distu(u.ustuck->mx, u.ustuck->my) > 2) {
/* perhaps it fled (or was teleported or ... ) */
- u.ustuck = 0;
+ set_ustuck((struct monst *) 0);
} else if (sticks(g.youmonst.data)) {
/* When polymorphed into a sticking monster,
* u.ustuck means it's stuck to you, not you to it.
*/
- You("release %s.", mon_nam(u.ustuck));
- u.ustuck = 0;
+ mtmp = u.ustuck;
+ set_ustuck((struct monst *) 0);
+ You("release %s.", mon_nam(mtmp));
} else {
/* If holder is asleep or paralyzed:
* 37.5% chance of getting away,
case 1:
case 2:
pull_free:
- You("pull free from %s.", mon_nam(u.ustuck));
- u.ustuck = 0;
+ mtmp = u.ustuck;
+ set_ustuck((struct monst *) 0);
+ You("pull free from %s.", mon_nam(mtmp));
break;
case 3:
if (!u.ustuck->mcanmove) {
-/* 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) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
if (monnear(mtmp, mon->mx, mon->my)) {
if (!u.uswallow && (mtmp == u.ustuck)) {
if (!rn2(4)) {
+ set_ustuck((struct monst *) 0);
pline("%s releases you!", Monnam(mtmp));
- u.ustuck = 0;
} else
break;
}
-/* 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) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
pline("Wait, %s! That's a %s named %s!", m_monnam(mtmp),
g.youmonst.data->mname, g.plname);
if (sticky)
- u.ustuck = mtmp;
+ set_ustuck(mtmp);
g.youmonst.m_ap_type = M_AP_NOTHING;
g.youmonst.mappearance = 0;
newsym(u.ux, u.uy);
if (u_slip_free(mtmp, mattk)) {
dmg = 0;
} else {
- u.ustuck = mtmp;
+ set_ustuck(mtmp);
pline("%s grabs you!", Monnam(mtmp));
}
} else if (u.ustuck == mtmp) {
case AD_STCK:
hitmsg(mtmp, mattk);
if (uncancelled && !u.ustuck && !sticks(g.youmonst.data)) {
- g.context.botl = 1;
- u.ustuck = mtmp;
+ set_ustuck(mtmp);
}
break;
case AD_WRAP:
if (u_slip_free(mtmp, mattk)) {
dmg = 0;
} else {
- g.context.botl = 1;
+ set_ustuck(mtmp); /* before message, for botl update */
pline("%s swings itself around you!", Monnam(mtmp));
- u.ustuck = mtmp;
}
} else if (u.ustuck == mtmp) {
if (is_pool(mtmp->mx, mtmp->my) && !Swimming && !Amphibious) {
moat ? "moat" : "pool of water",
an(mtmp->data->mname));
done(DROWNING);
- } else if (mattk->aatyp == AT_HUGS)
+ } else if (mattk->aatyp == AT_HUGS) {
You("are being crushed.");
+ }
} else {
dmg = 0;
if (flags.verbose)
remove_monster(omx, omy);
mtmp->mtrapped = 0; /* no longer on old trap */
place_monster(mtmp, u.ux, u.uy);
- u.ustuck = mtmp;
+ set_ustuck(mtmp);
newsym(mtmp->mx, mtmp->my);
if (is_animal(mtmp->data) && u.usteed) {
char buf[BUFSZ];
pline("%s lunges forward and plucks you off %s!", Monnam(mtmp),
buf);
dismount_steed(DISMOUNT_ENGULFED);
- } else
+ } else {
pline("%s engulfs you!", Monnam(mtmp));
+ }
stop_occupation();
reset_occupations(); /* behave as if you had moved */
fully swallowed yet so that won't work here */
if (Punished)
placebc();
- u.ustuck = 0;
+ set_ustuck((struct monst *) 0);
return (!DEADMONSTER(mtmp)) ? 0 : 2;
}
}
/* u.uswldtim always set > 1 */
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)
(void) snuff_lit(otmp2);
}
-/* 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) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
mtmp2->nmon = fmon;
fmon = mtmp2;
if (u.ustuck == mtmp)
- u.ustuck = mtmp2;
+ set_ustuck(mtmp2);
if (u.usteed == mtmp)
u.usteed = mtmp2;
if (mtmp2->isshk)
mondied(mdef);
}
+void
+set_ustuck(mtmp)
+struct monst *mtmp;
+{
+ g.context.botl = 1;
+ u.ustuck = mtmp;
+}
+
void
unstuck(mtmp)
struct monst *mtmp;
{
if (u.ustuck == mtmp) {
- g.context.botl = 1;
/* do this first so that docrt()'s botl update is accurate;
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) {
u.ux = mtmp->mx;
u.uy = mtmp->my;
-/* 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 */
/* NetHack may be freely redistributed. See license for details. */
grabber to engulfer or vice versa because engulfing by poly'd hero
always ends immediately so won't be in effect during a polymorph] */
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))
uunstick();
void
uunstick()
{
- if (!u.ustuck) {
+ struct monst *mtmp = u.ustuck;
+
+ if (!mtmp) {
impossible("uunstick: no ustuck?");
return;
}
- pline("%s is no longer in your clutches.", Monnam(u.ustuck));
- u.ustuck = 0;
+ set_ustuck((struct monst *) 0); /* before pline() */
+ pline("%s is no longer in your clutches.", Monnam(mtmp));
}
void
-/* 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) Michael Allison, 2009. */
/* NetHack may be freely redistributed. See license for details. */
break;
if (!mtmp)
panic("Cannot find the monster ustuck.");
- u.ustuck = mtmp;
+ set_ustuck(mtmp);
}
if (steedid) {
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
-/* 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) Michael Allison, 2009. */
/* NetHack may be freely redistributed. See license for details. */
/* these pointers are no longer valid, and at least u.usteed
* may mislead place_monster() on other levels
*/
- u.ustuck = (struct monst *) 0;
+ set_ustuck((struct monst *) 0);
u.usteed = (struct monst *) 0;
for (ltmp = (xchar) 1; ltmp <= maxledgerno(); ltmp++) {
-/* 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) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
}
}
reset_utrap(FALSE);
- u.ustuck = 0;
+ set_ustuck((struct monst *) 0);
u.ux0 = u.ux;
u.uy0 = u.uy;
-/* 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) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
else
pline("Startled, %s can no longer hold you!",
mon_nam(u.ustuck));
- u.ustuck = 0;
+ set_ustuck((struct monst *) 0);
}
/* kludge alert:
* drown() and lava_effects() print various messages almost
-/* 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) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
/* applied pole-arm attack is too far to get stuck */
&& distu(mtmp->mx, mtmp->my) <= 2) {
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
* assessing an alignment penalty and removing the engraving
monflee(mon, !rn2(3) ? rnd(100) : 0, FALSE, TRUE);
if (u.ustuck == mon && !u.uswallow && !sticks(g.youmonst.data))
- u.ustuck = 0;
+ set_ustuck((struct monst *) 0);
}
/* Vorpal Blade hit converted to miss */
/* could be headless monster or worm tail */
tmp = 0;
} else {
You("swing yourself around %s!", mon_nam(mdef));
- u.ustuck = mdef;
+ set_ustuck(mdef);
}
} else if (u.ustuck == mdef) {
/* Monsters don't wear amulets of magical breathing */
if (u.ustuck && u.ustuck != mon)
uunstick();
You("grab %s!", mon_nam(mon));
- u.ustuck = mon;
+ set_ustuck(mon);
if (silverhit && flags.verbose)
silver_sears(&g.youmonst, mon, silverhit);
sum[i] = damageum(mon, mattk, specialdmg);
const char *fmt = "Wait! That's %s!", *generic = "a monster", *what = 0;
if (!u.ustuck && !mtmp->mflee && dmgtype(mtmp->data, AD_STCK))
- u.ustuck = mtmp;
+ set_ustuck(mtmp);
if (Blind) {
if (!Blind_telepat)