1 /* SCCS Id: @(#)track.c 3.4 87/08/08 */
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
];
28 if(utcnt
< UTSZ
) utcnt
++;
29 if(utpnt
== UTSZ
) utpnt
= 0;
30 utrack
[utpnt
].x
= u
.ux
;
31 utrack
[utpnt
].y
= u
.uy
;
42 register int cnt
, ndist
;
45 for(tc
= &utrack
[utpnt
]; cnt
--; ){
46 if(tc
== utrack
) tc
= &utrack
[UTSZ
-1];
48 ndist
= distmin(x
,y
,tc
->x
,tc
->y
);
50 /* if far away, skip track entries til we're closer */
52 ndist
-= 2; /* be careful due to extra decrement at top of loop */
55 return (coord
*) 0; /* too far away, no matches possible */
56 if(tc
< &utrack
[ndist
])
61 return(ndist
? tc
: 0);