# 2.11BSD#431 - /usr/src/games/hack/hack.track.c

##### Functions

    gettrack          X
    initrack          X
    settrack          X

##### Variables

    utcnt             X
    utpnt             X

##### Macros

    UTSZ              X

       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

- in /usr/src/games/hack/hack.dog.c line 256-258(2)
- in /usr/src/games/hack/hack.mon.c line 332-337(2)

initrack defined in line 12; used 2 times

- in /usr/src/games/hack/hack.do.c line 228
- in /usr/src/games/hack/hack.main.c line 296

settrack defined in line 17; used 1 times

- in /usr/src/games/hack/hack.main.c line 301

#### Defined variables

utcnt defined in line 9; used 4 times

- in line 13-18(3), 29

utpnt defined in line 10; used 7 times

- in line 13, 19-22(5), 30

#### Defined macros

UTSZ defined in line 6; used 4 times

- in line 8, 18-19(2), 31

Last modified: 1985-10-01 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 458 |