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:
@@ -3650,8 +3650,7 @@ shk_fixes_damage(struct monst *shkp)
|
||||
if (!dam)
|
||||
return;
|
||||
|
||||
shk_closeby = (distu(shkp->mx, shkp->my)
|
||||
<= (BOLT_LIM / 2) * (BOLT_LIM / 2));
|
||||
shk_closeby = (mdistu(shkp) <= (BOLT_LIM / 2) * (BOLT_LIM / 2));
|
||||
|
||||
if (canseemon(shkp))
|
||||
pline("%s whispers %s.", Shknam(shkp),
|
||||
@@ -4221,7 +4220,7 @@ pay_for_damage(const char* dmgstr, boolean cant_mollify)
|
||||
}
|
||||
if (!inhishop(tmp_shk))
|
||||
continue;
|
||||
shk_distance = distu(tmp_shk->mx, tmp_shk->my);
|
||||
shk_distance = mdistu(tmp_shk);
|
||||
if (shk_distance > nearest_shk)
|
||||
continue;
|
||||
if ((shk_distance == nearest_shk) && picks) {
|
||||
|
||||
Reference in New Issue
Block a user