leash groundwork

Add another parameter to m_unleash.  This should not introduce
any change in behavior.
This commit is contained in:
nethack.rankin
2002-03-11 08:00:21 +00:00
parent bc8acf4a29
commit 6c91a6bc04
6 changed files with 22 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)extern.h 3.4 2002/01/04 */
/* SCCS Id: @(#)extern.h 3.4 2002/03/09 */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -34,7 +34,7 @@ E int NDECL(dojump);
E int FDECL(jump, (int));
E int NDECL(number_leashed);
E void FDECL(o_unleash, (struct obj *));
E void FDECL(m_unleash, (struct monst *));
E void FDECL(m_unleash, (struct monst *,BOOLEAN_P));
E void NDECL(unleash_all);
E boolean NDECL(next_to_u);
E struct obj *FDECL(get_mleash, (struct monst *));

View File

@@ -360,11 +360,18 @@ register struct obj *otmp;
}
void
m_unleash(mtmp) /* mtmp is about to die, or become untame */
m_unleash(mtmp, feedback) /* mtmp is about to die, or become untame */
register struct monst *mtmp;
boolean feedback;
{
register struct obj *otmp;
if (feedback) {
if (canseemon(mtmp))
pline("%s pulls free of %s leash!", Monnam(mtmp), mhis(mtmp));
else
Your("leash falls slack.");
}
for(otmp = invent; otmp; otmp = otmp->nobj)
if(otmp->otyp == LEASH &&
otmp->leashmon == (int)mtmp->m_id)
@@ -542,7 +549,7 @@ register xchar x, y;
if(um_dist(mtmp->mx, mtmp->my, 5)) {
pline("%s leash snaps loose!",
s_suffix(Monnam(mtmp)));
m_unleash(mtmp);
m_unleash(mtmp, FALSE);
} else {
if(um_dist(mtmp->mx, mtmp->my, 3)) {
You("pull on the leash.");

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)dog.c 3.4 1999/10/20 */
/* SCCS Id: @(#)dog.c 3.4 2002/03/09 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -473,7 +473,7 @@ boolean pets_only; /* true for ascension or final escape */
humanoid(mtmp->data)
? (mtmp->female ? "Her" : "His")
: "Its");
m_unleash(mtmp);
m_unleash(mtmp, FALSE);
}
continue;
}
@@ -512,7 +512,7 @@ boolean pets_only; /* true for ascension or final escape */
/* this can happen if your quest leader ejects you from the
"home" level while a leashed pet isn't next to you */
pline("%s leash goes slack.", s_suffix(Monnam(mtmp)));
m_unleash(mtmp);
m_unleash(mtmp, FALSE);
}
}
}
@@ -554,7 +554,7 @@ migrate_to_level(mtmp, tolev, xyloc, cc)
mtmp->nmon = migrating_mons;
migrating_mons = mtmp;
if (mtmp->mleashed) {
m_unleash(mtmp);
m_unleash(mtmp, FALSE);
mtmp->mtame--;
pline_The("leash comes off!");
}
@@ -833,7 +833,7 @@ struct monst *mtmp;
if (!mtmp->mtame && mtmp->mleashed) {
pline("%s breaks loose of %s leash!", Monnam(mtmp), mhis(mtmp));
m_unleash(mtmp);
m_unleash(mtmp, FALSE);
}
/* don't make a sound if pet is in the middle of leaving the level */

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)dogmove.c 3.4 1997/05/25 */
/* SCCS Id: @(#)dogmove.c 3.4 2002/03/09 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -717,7 +717,7 @@ newdogpos:
if (mtmp->mleashed) { /* play it safe */
pline("%s breaks loose of %s leash!",
Monnam(mtmp), mhis(mtmp));
m_unleash(mtmp);
m_unleash(mtmp, FALSE);
}
(void) mattacku(mtmp);
return(0);

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mon.c 3.4 2002/02/07 */
/* SCCS Id: @(#)mon.c 3.4 2002/03/09 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1241,7 +1241,7 @@ m_detach(mtmp, mptr)
struct monst *mtmp;
struct permonst *mptr; /* reflects mtmp->data _prior_ to mtmp's death */
{
if(mtmp->mleashed) m_unleash(mtmp);
if (mtmp->mleashed) m_unleash(mtmp, FALSE);
/* to prevent an infinite relobj-flooreffects-hmon-killed loop */
mtmp->mtrapped = 0;
mtmp->mhp = 0; /* simplify some tests: force mhp to 0 */

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)teleport.c 3.4 2001/12/06 */
/* SCCS Id: @(#)teleport.c 3.4 2002/03/09 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -332,7 +332,7 @@ boolean force_it;
} else {
Your("leash goes slack.");
release_it:
m_unleash(mtmp);
m_unleash(mtmp, FALSE);
return TRUE;
}
}