1 /* NetHack 3.6 track.c $NHDT-Date: 1432512769 2015/05/25 00:12:49 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
4 /* track.c - version 1.0.2 */
10 STATIC_VAR NEARDATA
int utcnt
, utpnt
;
11 STATIC_VAR NEARDATA coord utrack
[UTSZ
];
27 utrack
[utpnt
].x
= u
.ux
;
28 utrack
[utpnt
].y
= u
.uy
;
36 register int cnt
, ndist
;
39 for (tc
= &utrack
[utpnt
]; cnt
--;) {
41 tc
= &utrack
[UTSZ
- 1];
44 ndist
= distmin(x
, y
, tc
->x
, tc
->y
);
46 /* if far away, skip track entries til we're closer */
48 ndist
-= 2; /* be careful due to extra decrement at top of loop */
51 return (coord
*) 0; /* too far away, no matches possible */
52 if (tc
< &utrack
[ndist
])
56 } else if (ndist
<= 1)
57 return (ndist
? tc
: 0);