follow-up: NetHack typically passes ptr to coord

This commit is contained in:
nhmall
2024-11-03 09:21:19 -05:00
parent 82bca3d78a
commit 091a709cdb

View File

@@ -13,7 +13,7 @@ staticfn void use_whistle(struct obj *);
staticfn void use_magic_whistle(struct obj *);
staticfn void magic_whistled(struct obj *);
staticfn int use_leash(struct obj *);
staticfn void use_leash_core(struct obj *, struct monst *, coord, int);
staticfn void use_leash_core(struct obj *, struct monst *, coord *, int);
staticfn boolean mleashed_next2u(struct monst *);
staticfn int use_mirror(struct obj *);
staticfn void use_bell(struct obj **);
@@ -784,7 +784,7 @@ use_leash(struct obj *obj)
if (u_at(cc.x, cc.y)) {
if (u.usteed && u.dz > 0) {
mtmp = u.usteed;
use_leash_core(obj, mtmp, cc, 1);
use_leash_core(obj, mtmp, &cc, 1);
return ECMD_TIME;
}
pline("Leash yourself? Very funny...");
@@ -801,20 +801,20 @@ use_leash(struct obj *obj)
return ECMD_TIME;
}
use_leash_core(obj, mtmp, cc, canspotmon(mtmp));
use_leash_core(obj, mtmp, &cc, canspotmon(mtmp));
return ECMD_TIME;
}
staticfn void
use_leash_core(struct obj *obj, struct monst *mtmp, coord cc, int spotmon)
use_leash_core(struct obj *obj, struct monst *mtmp, coord *cc, int spotmon)
{
if (!spotmon && !glyph_is_invisible(levl[cc.x][cc.y].glyph)) {
if (!spotmon && !glyph_is_invisible(levl[cc->x][cc->y].glyph)) {
/* for the unleash case, we don't verify whether this unseen
monster is the creature attached to the current leash */
You("fail to %sleash something.", obj->leashmon ? "un" : "");
/* trying again will work provided the monster is tame
(and also that it doesn't change location by retry time) */
map_invisible(cc.x, cc.y);
map_invisible(cc->x, cc->y);
} else if (!mtmp->mtame) {
pline("%s %s leashed!", Monnam(mtmp),
(!obj->leashmon) ? "cannot be" : "is not");
@@ -832,7 +832,7 @@ use_leash_core(struct obj *obj, struct monst *mtmp, coord cc, int spotmon)
char lmonbuf[BUFSZ];
char *lmonnam = l_monnam(mtmp);
if (cc.x != mtmp->mx || cc.y != mtmp->my) {
if (cc->x != mtmp->mx || cc->y != mtmp->my) {
Sprintf(lmonbuf, "%s tail", s_suffix(lmonnam));
lmonnam = lmonbuf;
}