Add 'mdistu' macro

Short for distu(mtmp->mx, mtmp->my) (i.e. the distance between the hero
and the specified monster), which is a very common use of distu().  The
idea is that this would be a convenient shorthand for it; I actually
thought it (or something very similar) existed already, but couldn't
find it when I tried to use it earlier.  Based on the number of uses of
fully-spelled-out 'distu(mtmp->mx, mtmp->my)' replaced in this commit
I'm guessing I just imagined it.
This commit is contained in:
Michael Meyer
2022-11-14 18:37:17 -05:00
committed by PatR
parent a0dfc94bbe
commit 619781dbb8
19 changed files with 46 additions and 50 deletions

View File

@@ -715,6 +715,8 @@ enum optset_restrictions {
#define makeknown(x) discover_object((x), TRUE, TRUE)
#define distu(xx, yy) dist2((int)(xx), (int)(yy), (int) u.ux, (int) u.uy)
#define mdistu(mon) \
dist2((int) (mon)->mx, (int) (mon)->my, (int) u.ux, (int) u.uy)
#define onlineu(xx, yy) online2((int)(xx), (int)(yy), (int) u.ux, (int) u.uy)
#define rn1(x, y) (rn2(x) + (y))