MCPcopy Create free account
hub / github.com/NetHack/NetHack / gettrack

Function gettrack

src/track.c:41–58  ·  view source on GitHub ↗

get a track coord on or next to x,y and last tracked by hero, returns null if no such track */

Source from the content-addressed store, hash-verified

39/* get a track coord on or next to x,y and last tracked by hero,
40 returns null if no such track */
41coord *
42gettrack(coordxy x, coordxy y)
43{
44 int cnt, ndist;
45 coord *tc;
46 cnt = utcnt;
47 for (tc = &utrack[utpnt]; cnt--;) {
48 if (tc == utrack)
49 tc = &utrack[UTSZ - 1];
50 else
51 tc--;
52 ndist = distmin(x, y, tc->x, tc->y);
53
54 if (ndist <= 1)
55 return (ndist ? tc : 0);
56 }
57 return (coord *) 0;
58}
59#endif /* !SFCTOOL */
60
61/* return TRUE if x,y has hero tracks on it */

Callers 2

dog_goalFunction · 0.85
m_moveFunction · 0.85

Calls 1

distminFunction · 0.85

Tested by

no test coverage detected