Just pass a mfndposdata pointer to should_displace

This commit is contained in:
Pasi Kallinen
2026-01-04 16:34:28 +02:00
parent 37df18b59c
commit f2cd27551d
3 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -1922,7 +1922,7 @@ extern boolean accessible(coordxy, coordxy);
extern void set_apparxy(struct monst *) NONNULLARG1; extern void set_apparxy(struct monst *) NONNULLARG1;
extern boolean can_ooze(struct monst *) NONNULLARG1; extern boolean can_ooze(struct monst *) NONNULLARG1;
extern boolean can_fog(struct monst *) NONNULLARG1; extern boolean can_fog(struct monst *) NONNULLARG1;
extern boolean should_displace(struct monst *, struct mfndposdata, coordxy, extern boolean should_displace(struct monst *, struct mfndposdata *, coordxy,
coordxy) NONNULLPTRS; coordxy) NONNULLPTRS;
extern boolean undesirable_disp(struct monst *, coordxy, coordxy) NONNULLARG1; extern boolean undesirable_disp(struct monst *, coordxy, coordxy) NONNULLARG1;
extern boolean can_hide_under_obj(struct obj *); extern boolean can_hide_under_obj(struct obj *);
+1 -1
View File
@@ -1070,7 +1070,7 @@ dog_move(
uncursedcnt++; uncursedcnt++;
} }
better_with_displacing = should_displace(mtmp, mfp, better_with_displacing = should_displace(mtmp, &mfp,
gg.gx, gg.gy); gg.gx, gg.gy);
chcnt = 0; chcnt = 0;
+6 -6
View File
@@ -1069,7 +1069,7 @@ itsstuck(struct monst *mtmp)
boolean boolean
should_displace( should_displace(
struct monst *mtmp, struct monst *mtmp,
struct mfndposdata data, struct mfndposdata *data,
coordxy ggx, coordxy ggx,
coordxy ggy) coordxy ggy)
{ {
@@ -1079,11 +1079,11 @@ should_displace(
int i, nx, ny; int i, nx, ny;
int ndist; int ndist;
for (i = 0; i < data.cnt; i++) { for (i = 0; i < data->cnt; i++) {
nx = data.poss[i].x; nx = data->poss[i].x;
ny = data.poss[i].y; ny = data->poss[i].y;
ndist = dist2(nx, ny, ggx, ggy); ndist = dist2(nx, ny, ggx, ggy);
if (MON_AT(nx, ny) && (data.info[i] & ALLOW_MDISP) && !(data.info[i] & ALLOW_M) if (MON_AT(nx, ny) && (data->info[i] & ALLOW_MDISP) && !(data->info[i] & ALLOW_M)
&& !undesirable_disp(mtmp, nx, ny)) { && !undesirable_disp(mtmp, nx, ny)) {
if (shortest_with_displacing == -1 if (shortest_with_displacing == -1
|| (ndist < shortest_with_displacing)) || (ndist < shortest_with_displacing))
@@ -1942,7 +1942,7 @@ m_move(struct monst *mtmp, int after)
avoid = TRUE; avoid = TRUE;
} }
better_with_displacing = better_with_displacing =
should_displace(mtmp, mfp, ggx, ggy); should_displace(mtmp, &mfp, ggx, ggy);
for (i = 0; i < cnt; i++) { for (i = 0; i < cnt; i++) {
if (avoid && (mfp.info[i] & NOTONL)) if (avoid && (mfp.info[i] & NOTONL))
continue; continue;