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
+2 -2
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. */ /* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -34,7 +34,7 @@ E int NDECL(dojump);
E int FDECL(jump, (int)); E int FDECL(jump, (int));
E int NDECL(number_leashed); E int NDECL(number_leashed);
E void FDECL(o_unleash, (struct obj *)); 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 void NDECL(unleash_all);
E boolean NDECL(next_to_u); E boolean NDECL(next_to_u);
E struct obj *FDECL(get_mleash, (struct monst *)); E struct obj *FDECL(get_mleash, (struct monst *));
+9 -2
View File
@@ -360,11 +360,18 @@ register struct obj *otmp;
} }
void 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; register struct monst *mtmp;
boolean feedback;
{ {
register struct obj *otmp; 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) for(otmp = invent; otmp; otmp = otmp->nobj)
if(otmp->otyp == LEASH && if(otmp->otyp == LEASH &&
otmp->leashmon == (int)mtmp->m_id) otmp->leashmon == (int)mtmp->m_id)
@@ -542,7 +549,7 @@ register xchar x, y;
if(um_dist(mtmp->mx, mtmp->my, 5)) { if(um_dist(mtmp->mx, mtmp->my, 5)) {
pline("%s leash snaps loose!", pline("%s leash snaps loose!",
s_suffix(Monnam(mtmp))); s_suffix(Monnam(mtmp)));
m_unleash(mtmp); m_unleash(mtmp, FALSE);
} else { } else {
if(um_dist(mtmp->mx, mtmp->my, 3)) { if(um_dist(mtmp->mx, mtmp->my, 3)) {
You("pull on the leash."); You("pull on the leash.");
+5 -5
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. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* 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) humanoid(mtmp->data)
? (mtmp->female ? "Her" : "His") ? (mtmp->female ? "Her" : "His")
: "Its"); : "Its");
m_unleash(mtmp); m_unleash(mtmp, FALSE);
} }
continue; 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 /* this can happen if your quest leader ejects you from the
"home" level while a leashed pet isn't next to you */ "home" level while a leashed pet isn't next to you */
pline("%s leash goes slack.", s_suffix(Monnam(mtmp))); 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; mtmp->nmon = migrating_mons;
migrating_mons = mtmp; migrating_mons = mtmp;
if (mtmp->mleashed) { if (mtmp->mleashed) {
m_unleash(mtmp); m_unleash(mtmp, FALSE);
mtmp->mtame--; mtmp->mtame--;
pline_The("leash comes off!"); pline_The("leash comes off!");
} }
@@ -833,7 +833,7 @@ struct monst *mtmp;
if (!mtmp->mtame && mtmp->mleashed) { if (!mtmp->mtame && mtmp->mleashed) {
pline("%s breaks loose of %s leash!", Monnam(mtmp), mhis(mtmp)); 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 */ /* don't make a sound if pet is in the middle of leaving the level */
+2 -2
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. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -717,7 +717,7 @@ newdogpos:
if (mtmp->mleashed) { /* play it safe */ if (mtmp->mleashed) { /* play it safe */
pline("%s breaks loose of %s leash!", pline("%s breaks loose of %s leash!",
Monnam(mtmp), mhis(mtmp)); Monnam(mtmp), mhis(mtmp));
m_unleash(mtmp); m_unleash(mtmp, FALSE);
} }
(void) mattacku(mtmp); (void) mattacku(mtmp);
return(0); return(0);
+2 -2
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. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1241,7 +1241,7 @@ m_detach(mtmp, mptr)
struct monst *mtmp; struct monst *mtmp;
struct permonst *mptr; /* reflects mtmp->data _prior_ to mtmp's death */ 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 */ /* to prevent an infinite relobj-flooreffects-hmon-killed loop */
mtmp->mtrapped = 0; mtmp->mtrapped = 0;
mtmp->mhp = 0; /* simplify some tests: force mhp to 0 */ mtmp->mhp = 0; /* simplify some tests: force mhp to 0 */
+2 -2
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. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -332,7 +332,7 @@ boolean force_it;
} else { } else {
Your("leash goes slack."); Your("leash goes slack.");
release_it: release_it:
m_unleash(mtmp); m_unleash(mtmp, FALSE);
return TRUE; return TRUE;
} }
} }