1: /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
   2: /* hack.track.c - version 1.0.2 */
   3: 
   4: #include "hack.h"
   5: 
   6: #define UTSZ    50
   7: 
   8: coord utrack[UTSZ];
   9: int utcnt = 0;
  10: int utpnt = 0;
  11: 
  12: initrack(){
  13:     utcnt = utpnt = 0;
  14: }
  15: 
  16: /* add to track */
  17: settrack(){
  18:     if(utcnt < UTSZ) utcnt++;
  19:     if(utpnt == UTSZ) utpnt = 0;
  20:     utrack[utpnt].x = u.ux;
  21:     utrack[utpnt].y = u.uy;
  22:     utpnt++;
  23: }
  24: 
  25: coord *
  26: gettrack(x,y) register x,y; {
  27: register int i,cnt,dist;
  28: coord tc;
  29:     cnt = utcnt;
  30:     for(i = utpnt-1; cnt--; i--){
  31:         if(i == -1) i = UTSZ-1;
  32:         tc = utrack[i];
  33:         dist = (x-tc.x)*(x-tc.x) + (y-tc.y)*(y-tc.y);
  34:         if(dist < 3)
  35:             return(dist ? &(utrack[i]) : 0);
  36:     }
  37:     return(0);
  38: }

Defined functions

gettrack defined in line 25; used 4 times
initrack defined in line 12; used 2 times
settrack defined in line 17; used 1 times

Defined variables

utcnt defined in line 9; used 4 times
utpnt defined in line 10; used 7 times

Defined macros

UTSZ defined in line 6; used 4 times
Last modified: 1985-10-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 569
Valid CSS Valid XHTML 1.0 Strict