From f2cd27551d20b49323118e77853b0a7c755754dc Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 4 Jan 2026 16:34:28 +0200 Subject: [PATCH] Just pass a mfndposdata pointer to should_displace --- include/extern.h | 2 +- src/dogmove.c | 2 +- src/monmove.c | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/extern.h b/include/extern.h index 27732ea42..b9f2e5cce 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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 *); diff --git a/src/dogmove.c b/src/dogmove.c index 52ae569bf..c22eba74b 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -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; diff --git a/src/monmove.c b/src/monmove.c index 39a453e08..2721b54a0 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -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;