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

@@ -404,7 +404,7 @@ mattacku(register struct monst *mtmp)
* excessively verbose miss feedback when monster can do multiple
* attacks and would miss the same wrong spot each time.)
*/
boolean ranged = (distu(mtmp->mx, mtmp->my) > 3),
boolean ranged = (mdistu(mtmp) > 3),
range2 = !monnear(mtmp, mtmp->mux, mtmp->muy),
foundyou = u_at(mtmp->mux, mtmp->muy),
youseeit = canseemon(mtmp),
@@ -1606,7 +1606,7 @@ gazemu(struct monst *mtmp, struct attack *mattk)
break;
case AD_BLND:
if (canseemon(mtmp) && !resists_blnd(&g.youmonst)
&& distu(mtmp->mx, mtmp->my) <= BOLT_LIM * BOLT_LIM) {
&& mdistu(mtmp) <= BOLT_LIM * BOLT_LIM) {
if (cancelled) {
react = rn1(2, 2); /* "puzzled" || "dazzled" */
already = (mtmp->mcansee == 0);