|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T t
Length: 688 (0x2b0) Types: TextFile Names: »track.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Nethack/track.c«
/* SCCS Id: @(#)track.c 1.4 87/08/08 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* track.c - version 1.0.2 */ #include "hack.h" #define UTSZ 50 coord utrack[UTSZ]; int utcnt = 0; int utpnt = 0; initrack(){ utcnt = utpnt = 0; } /* add to track */ settrack(){ if(utcnt < UTSZ) utcnt++; if(utpnt == UTSZ) utpnt = 0; utrack[utpnt].x = u.ux; utrack[utpnt].y = u.uy; utpnt++; } coord * gettrack(x,y) register x,y; { register int i,cnt,dist; coord tc; cnt = utcnt; for(i = utpnt-1; cnt--; i--){ if(i == -1) i = UTSZ-1; tc = utrack[i]; dist = (x-tc.x)*(x-tc.x) + (y-tc.y)*(y-tc.y); if(dist < 3) return(dist ? &(utrack[i]) : 0); } return(0); }