Make sure getdir return values are in range

u.dx and u.dy should be [-1, +1]
This commit is contained in:
Pasi Kallinen
2022-07-10 11:00:22 +03:00
parent f3e2f08b54
commit 1dcd14bffd

View File

@@ -4488,8 +4488,8 @@ getdir(const char *s)
mod = 0; /* neither CLICK_1 nor CLICK_2 */
} else {
/* caller expects simulated click to be relative to hero's spot */
u.dx = cc.x - u.ux;
u.dy = cc.y - u.uy;
u.dx = sgn(cc.x - u.ux);
u.dy = sgn(cc.y - u.uy);
u.dz = 0;
switch (pos + NHKF_GETPOS_PICK) {