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

View File

@@ -1922,7 +1922,7 @@ extern boolean accessible(coordxy, coordxy);
extern void set_apparxy(struct monst *) NONNULLARG1;
extern boolean can_ooze(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;
extern boolean undesirable_disp(struct monst *, coordxy, coordxy) NONNULLARG1;
extern boolean can_hide_under_obj(struct obj *);

View File

@@ -1070,7 +1070,7 @@ dog_move(
uncursedcnt++;
}
better_with_displacing = should_displace(mtmp, mfp,
better_with_displacing = should_displace(mtmp, &mfp,
gg.gx, gg.gy);
chcnt = 0;

View File

@@ -1069,7 +1069,7 @@ itsstuck(struct monst *mtmp)
boolean
should_displace(
struct monst *mtmp,
struct mfndposdata data,
struct mfndposdata *data,
coordxy ggx,
coordxy ggy)
{
@@ -1079,11 +1079,11 @@ should_displace(
int i, nx, ny;
int ndist;
for (i = 0; i < data.cnt; i++) {
nx = data.poss[i].x;
ny = data.poss[i].y;
for (i = 0; i < data->cnt; i++) {
nx = data->poss[i].x;
ny = data->poss[i].y;
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)) {
if (shortest_with_displacing == -1
|| (ndist < shortest_with_displacing))
@@ -1942,7 +1942,7 @@ m_move(struct monst *mtmp, int after)
avoid = TRUE;
}
better_with_displacing =
should_displace(mtmp, mfp, ggx, ggy);
should_displace(mtmp, &mfp, ggx, ggy);
for (i = 0; i < cnt; i++) {
if (avoid && (mfp.info[i] & NOTONL))
continue;