Make getpos monster/object coord picker deterministic

...and make it pick coordinates top-left to bottom-right.
This commit is contained in:
Pasi Kallinen
2016-01-13 10:22:41 +02:00
parent 5f6c0bd04a
commit ef3ce49dd4

View File

@@ -88,10 +88,13 @@ const void *b;
dx = u.ux - c1->x;
dy = u.uy - c1->y;
dist_1 = dx * dx + dy * dy;
dist_1 = max(abs(dx), abs(dy));
dx = u.ux - c2->x;
dy = u.uy - c2->y;
dist_2 = dx * dx + dy * dy;
dist_2 = max(abs(dx), abs(dy));
if (dist_1 == dist_2)
return (c1->y != c2->y) ? (c1->y - c2->y) : (c1->x - c2->x);
return dist_1 - dist_2;
}