Annotation of researchv10no/games/atc/ahdr.h, revision 1.1.1.1

1.1       root        1: /* ahdr.h: definitions for atc game */
                      2: 
                      3: /*     #ifdef vax
                      4:        #define AIRFILE "/r/jim/atc/airspaces"
                      5:        #define STATSFILE "/r/jim/atc/stats"
                      6:        #else
                      7:        #define AIRFILE "/g/jim/atc.export/airspaces"
                      8:        #define STATSFILE "/g/jim/atc.export/stats"
                      9:        #endif                                          */
                     10: 
                     11: #define AIRFILE "/usr/games/lib/atc/airspaces"
                     12: #define STATSFILE "/usr/games/lib/atc/stats"
                     13: 
                     14: 
                     15: #define LEFT 0          /* left is left margin */
                     16: #define BOTTOM 39       /* bottom addressable part of display */
                     17: 
                     18: #define VERBOSE 1
                     19: #define TERSE 0
                     20: 
                     21: #define YES 1
                     22: #define NO 0
                     23: 
                     24: #define FF 014
                     25: #define SI 017
                     26: #define FS 034
                     27: #define US 037
                     28: #define BELL 007
                     29: #ifdef ANNARBOR
                     30: #define BS 036
                     31: #else
                     32: #define BS '\b'
                     33: #endif
                     34: 
                     35: #define BEEP putchar(BELL)
                     36: 
                     37: #define RETURN          '\r'
                     38: #define MIPAGE          021
                     39: #define HOME            013
                     40: #define PLPAGE          031
                     41: #define MISRCH          005
                     42: #define UPARROW         016
                     43: #define PLSRCH          022
                     44: #define LEFTARROW       010
                     45: #define DOWNARROW       012
                     46: #define RIGHTARROW      037
                     47: #define INSMODE         017
                     48: 
                     49: #define TIMEOUT 3       /* he loses command if he waits >3" between chars */
                     50: 
                     51: #define PAUSE putchar(0); putchar(0); putchar(0)
                     52: 
                     53: #define MINWIDTH 10
                     54: #define MAXWIDTH 30
                     55: #define MINHEIGHT 10
                     56: #define MAXHEIGHT 40
                     57: 
                     58: #define MAXPATHS 200    /* max number of paths for flow control */
                     59: 
                     60: #define EMAX 20 /* max number of entries into the screen */
                     61: #define AMAX 5
                     62: #define NMAX 5
                     63: 
                     64: #define CMDLEN 10       /* max length command: e.g. ATNW<0> */
                     65: #define CDLNAME 10      /* max length of name of clearance directive list */
                     66: #define LOCLEN 30       /* max length of location identifier */
                     67: 
                     68: #define NALT 12         /* max number altitudes being stored in f_dist */
                     69: 
                     70: struct flow /* from and to are stored as the die roll needed in flightplan */
                     71: {       int f_from;     /* origin */
                     72:        int f_fair;     /* 1 if airport */
                     73:        int f_to;       /* destination */
                     74:        int f_tair;     /* 1 if airport */
                     75:        int f_freq;     /* relative frequency */
                     76:        int f_dist[NALT]; /* least dist to travel if it comes in this high */
                     77:        int f_cmds;     /* min # of commands to land it */
                     78: };
                     79: 
                     80: struct pstruct  /* structure for interesting points on the screen */
                     81: {       int p_x;        /* coordinates of the entry point */
                     82:        int p_y;
                     83:        int p_dx;       /* x increment */
                     84:        int p_dy;
                     85:        int p_inprop;   /* proportion of entries from here */
                     86:        int p_outprop;  /* proportion of exits to here */
                     87:        char p_sym;     /* symbol on screen */
                     88: };
                     89: 
                     90: struct cdl      /* clearance directive list (plan) */
                     91: {       struct cdl *c_next;
                     92:        struct list *c_list;
                     93:        char c_name[CDLNAME];
                     94: } cdltop;
                     95: 
                     96: struct list     /* list of clearances */
                     97: {       struct list *l_next;
                     98:        int l_x,l_y;          /* place where this takes effect */
                     99:        char l_loc[LOCLEN];     /* verbatim location description */
                    100:        char l_cmd[CMDLEN];  /* command to execute here */
                    101: };
                    102: 
                    103: #define PMAX 26 /* for now we'll have exactly 26 planes as in apple game */
                    104: 
                    105: struct astruct  /* airplane structure */
                    106: {       int a_stime;    /* starting time (after start) */
                    107:        int a_active;   /* 1 if flying; 2 if on standby; 0 if off or waiting*/
                    108:        int a_start;    /* starting location */
                    109:        int a_sair;     /* 1 if starting from airport; else 0 */
                    110:        int a_dest;     /* leaving or landing at ... */
                    111:        int a_dair;     /* 1 if landing at airport; else 0 */
                    112:        int a_x;        /* location */
                    113:        int a_y;
                    114:        int a_z;        /* altitude */
                    115:        int a_dx;       /* direction: -1,0,or 1 */
                    116:        int a_dy;
                    117:        int a_lastz;    /* climb or descent - used for conflicts */
                    118:        int a_nextz;    /* designated altitude */
                    119:        char a_turn;    /* turning 'L' or 'R' (0 if no turn) */
                    120:        int a_dxnew;    /* new course - x increment */
                    121:        int a_dynew;
                    122:        int a_type;     /* 0 for prop, 1 for jet */
                    123:        int a_fuel;
                    124:        int a_hold;     /* 1 if scheduled to hold at navaid, 2 if holding */
                    125:        char a_clear;   /* cleared for approach to this location */
                    126:        char a_id;
                    127:        struct list *a_plan;     /* "clearance directive list" */
                    128:        int a_load;     /* sum of active planes at each tick */
                    129:        int a_ticks;    /* number of ticks it's on the screen */
                    130:        int a_planned;  /* sum of planned planes at each tick */
                    131:        int a_dist;     /* distance this plane travelled */
                    132:        int a_opt;      /* best distance it could have travelled */
                    133:        int a_cmds;     /* min # of commands for this plane's route */
                    134:        int a_prev;     /* number of ticks it was in the preview area */
                    135:        int a_aprev;    /* number of planes active while in preview */
                    136:        int a_pprev;    /* number of planes planned while in preview */
                    137:        int a_pplanned; /* whether this was planned or not while in preview */
                    138: };
                    139: 
                    140: #define PROP 0
                    141: #define JET  1
                    142: 
                    143: #define PROPFUEL 21*2
                    144: #define JETFUEL  15*4
                    145: 
                    146: /* reasons for dying */
                    147: #define FUEL 0
                    148: #define OUTOFTIME 1
                    149: #define CRASH 2
                    150: #define BOUND 3
                    151: #define SYSTEM 6
                    152: #define GOAROUND 7
                    153: 
                    154: #define UPDATE 15       /* updates happen every 15 seconds */
                    155: 
                    156: #define INACTIVE 0      /* possible airplane statuses (plane[i].a_active) */
                    157: #define ACTIVE 1
                    158: #define WAITING 2       /* waiting for takeoff */
                    159: #define DONE 3
                    160: #define APPROACHING 4   /* from another sector */
                    161: #define LANDING 5
                    162: 
                    163: #define FPTHRESH 60     /* amount of time info on incoming planes is up */
                    164: #define NEARLY 2        /* number of planes to get in 1st FPTHRESH seconds */
                    165: 
                    166: #define FUDGE 20        /* pretend interval is this much longer to make it */
                    167:                        /* more likely that there will be planes initially */
                    168: #define FIRST_TIME 30   /* first time that planes can come on */
                    169: #define SAFETY 120      /* if incoming planes are this close, bump alt */
                    170: 
                    171: extern char *index();
                    172: 
                    173: /*#define OFFSET 0        /* 0-origin */
                    174: /*#define OFFSET -1       /* 1-origin */
                    175: #define OFFSET -2       /* 2-origin */
                    176: 
                    177: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.