Annotation of 43BSDReno/games/mille/mille.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1982 Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms are permitted
                      6:  * provided that: (1) source distributions retain this entire copyright
                      7:  * notice and comment, and (2) distributions including binaries display
                      8:  * the following acknowledgement:  ``This product includes software
                      9:  * developed by the University of California, Berkeley and its contributors''
                     10:  * in the documentation or other materials provided with the distribution
                     11:  * and in all advertising materials mentioning features or use of this
                     12:  * software. Neither the name of the University nor the names of its
                     13:  * contributors may be used to endorse or promote products derived
                     14:  * from this software without specific prior written permission.
                     15:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
                     16:  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
                     17:  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     18:  *
                     19:  *     @(#)mille.h     5.5 (Berkeley) 6/1/90
                     20:  */
                     21: 
                     22: # include      <sys/types.h>
                     23: # include      <ctype.h>
                     24: # include      <curses.h>
                     25: # include      <string.h>
                     26: 
                     27: /*
                     28:  * @(#)mille.h 1.1 (Berkeley) 4/1/82
                     29:  */
                     30: 
                     31: /*
                     32:  * Miscellaneous constants
                     33:  */
                     34: 
                     35: # define       unsgn           unsigned
                     36: # define       CARD            short
                     37: 
                     38: # define       HAND_SZ         7       /* number of cards in a hand    */
                     39: # define       DECK_SZ         101     /* number of cards in decks     */
                     40: # define       NUM_SAFE        4       /* number of saftey cards       */
                     41: # define       NUM_MILES       5       /* number of milestones types   */
                     42: # define       NUM_CARDS       20      /* number of types of cards     */
                     43: # define       BOARD_Y         17      /* size of board screen         */
                     44: # define       BOARD_X         40
                     45: # define       MILES_Y         7       /* size of mileage screen       */
                     46: # define       MILES_X         80
                     47: # define       SCORE_Y         17      /* size of score screen         */
                     48: # define       SCORE_X         40
                     49: # define       MOVE_Y          10      /* Where to print move prompt   */
                     50: # define       MOVE_X          20
                     51: # define       ERR_Y           15      /* Where to print errors        */
                     52: # define       ERR_X           5
                     53: # define       EXT_Y           4       /* Where to put Extension       */
                     54: # define       EXT_X           9
                     55: 
                     56: # define       PLAYER          0
                     57: # define       COMP            1
                     58: 
                     59: # define       W_SMALL         0       /* Small (initial) window       */
                     60: # define       W_FULL          1       /* Full (final) window          */
                     61: 
                     62: /*
                     63:  * Move types
                     64:  */
                     65: 
                     66: # define       M_DISCARD       0
                     67: # define       M_DRAW          1
                     68: # define       M_PLAY          2
                     69: # define       M_ORDER         3
                     70: 
                     71: /*
                     72:  * Scores
                     73:  */
                     74: 
                     75: # define       SC_SAFETY       100
                     76: # define       SC_ALL_SAFE     300
                     77: # define       SC_COUP         300
                     78: # define       SC_TRIP         400
                     79: # define       SC_SAFE         300
                     80: # define       SC_DELAY        300
                     81: # define       SC_EXTENSION    200
                     82: # define       SC_SHUT_OUT     500
                     83: 
                     84: /*
                     85:  * safety descriptions
                     86:  */
                     87: 
                     88: # define       S_UNKNOWN       0       /* location of safety unknown   */
                     89: # define       S_IN_HAND       1       /* safety in player's hand      */
                     90: # define       S_PLAYED        2       /* safety has been played       */
                     91: # define       S_GAS_SAFE      0       /* Gas safety card index        */
                     92: # define       S_SPARE_SAFE    1       /* Tire safety card index       */
                     93: # define       S_DRIVE_SAFE    2       /* Driveing safety card index   */
                     94: # define       S_RIGHT_WAY     3       /* Right-of-Way card index      */
                     95: # define       S_CONV          15      /* conversion from C_ to S_     */
                     96: 
                     97: /*
                     98:  * card numbers
                     99:  */
                    100: 
                    101: # define       C_INIT          -1
                    102: # define       C_25            0
                    103: # define       C_50            1
                    104: # define       C_75            2
                    105: # define       C_100           3
                    106: # define       C_200           4
                    107: # define       C_EMPTY         5
                    108: # define       C_FLAT          6       
                    109: # define       C_CRASH         7
                    110: # define       C_STOP          8
                    111: # define       C_LIMIT         9
                    112: # define       C_GAS           10
                    113: # define       C_SPARE         11
                    114: # define       C_REPAIRS       12
                    115: # define       C_GO            13
                    116: # define       C_END_LIMIT     14
                    117: # define       C_GAS_SAFE      15
                    118: # define       C_SPARE_SAFE    16
                    119: # define       C_DRIVE_SAFE    17
                    120: # define       C_RIGHT_WAY     18
                    121: 
                    122: /*
                    123:  * prompt types
                    124:  */
                    125: 
                    126: # define       MOVEPROMPT              0
                    127: # define       REALLYPROMPT            1
                    128: # define       ANOTHERHANDPROMPT       2
                    129: # define       ANOTHERGAMEPROMPT       3
                    130: # define       SAVEGAMEPROMPT          4
                    131: # define       SAMEFILEPROMPT          5
                    132: # define       FILEPROMPT              6
                    133: # define       EXTENSIONPROMPT         7
                    134: # define       OVERWRITEFILEPROMPT     8
                    135: 
                    136: # ifdef        SYSV
                    137: # define       srandom(x)      srand(x)
                    138: # define       random()        rand()
                    139: 
                    140: # ifndef       attron
                    141: #      define  erasechar()     _tty.c_cc[VERASE]
                    142: #      define  killchar()      _tty.c_cc[VKILL]
                    143: # endif
                    144: # else
                    145: # ifndef       erasechar
                    146: #      define  erasechar()     _tty.sg_erase
                    147: #      define  killchar()      _tty.sg_kill
                    148: # endif
                    149: # endif        SYSV
                    150: 
                    151: typedef struct {
                    152:        bool    coups[NUM_SAFE];
                    153:        bool    can_go;
                    154:        bool    new_battle;
                    155:        bool    new_speed;
                    156:        short   safety[NUM_SAFE];
                    157:        short   sh_safety[NUM_SAFE];
                    158:        short   nummiles[NUM_MILES];
                    159:        short   sh_nummiles[NUM_MILES];
                    160:        CARD    hand[HAND_SZ];
                    161:        CARD    sh_hand[HAND_SZ];
                    162:        CARD    battle;
                    163:        CARD    sh_battle;
                    164:        CARD    speed;
                    165:        CARD    sh_speed;
                    166:        int     mileage;
                    167:        int     sh_mileage;
                    168:        int     hand_tot;
                    169:        int     sh_hand_tot;
                    170:        int     safescore;
                    171:        int     sh_safescore;
                    172:        int     coupscore;
                    173:        int     total;
                    174:        int     sh_total;
                    175:        int     games;
                    176:        int     sh_games;
                    177:        int     was_finished;
                    178: } PLAY;
                    179: 
                    180: /*
                    181:  * macros
                    182:  */
                    183: 
                    184: # define       other(x)        (1 - x)
                    185: # define       nextplay()      (Play = other(Play))
                    186: # define       nextwin(x)      (1 - x)
                    187: # define       opposite(x)     (Opposite[x])
                    188: # define       issafety(x)     (x >= C_GAS_SAFE)
                    189: 
                    190: /*
                    191:  * externals
                    192:  */
                    193: 
                    194: extern bool    Debug, Finished, Next, On_exit, Order, Saved;
                    195: 
                    196: extern char    *C_fmt, **C_name, *Fromfile, Initstr[];
                    197: 
                    198: extern int     Card_no, End, Handstart, Movetype, Numcards[], Numgos,
                    199:                Numneed[], Numseen[NUM_CARDS], Play, Value[], Window;
                    200: 
                    201: extern CARD    Deck[DECK_SZ], Discard, Opposite[NUM_CARDS], Sh_discard,
                    202:                *Topcard;
                    203: 
                    204: extern FILE    *outf;
                    205: 
                    206: extern PLAY    Player[2];
                    207: 
                    208: extern WINDOW  *Board, *Miles, *Score;
                    209: 
                    210: /*
                    211:  * functions
                    212:  */
                    213: 
                    214: CARD   getcard();

unix.superglobalmegacorp.com

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