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

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) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1683,7 +1683,7 @@ struct monst *mtmp, *mtmp2;
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)
@@ -2314,15 +2314,23 @@ int how;
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;