Use macro for a location next to hero

This commit is contained in:
Pasi Kallinen
2022-02-12 11:05:07 +02:00
parent 2b4cf04281
commit 91e2d3633e
23 changed files with 53 additions and 50 deletions

View File

@@ -1084,7 +1084,7 @@ findtravelpath(int mode)
/* if travel to adjacent, reachable location, use normal movement rules */
if ((mode == TRAVP_TRAVEL || mode == TRAVP_VALID) && g.context.travel1
/* was '&& distmin(u.ux, u.uy, u.tx, u.ty) == 1' */
&& distu(u.tx, u.ty) <= 2 /* one step away */
&& next2u(u.tx, u.ty) /* one step away */
/* handle restricted diagonals */
&& crawl_destination(u.tx, u.ty)) {
end_running(FALSE);
@@ -1689,7 +1689,7 @@ domove_core(void)
}
if (u.ustuck && (x != u.ustuck->mx || y != u.ustuck->my)) {
if (distu(u.ustuck->mx, u.ustuck->my) > 2) {
if (!next2u(u.ustuck->mx, u.ustuck->my)) {
/* perhaps it fled (or was teleported or ... ) */
set_ustuck((struct monst *) 0);
} else if (sticks(g.youmonst.data)) {