|
|
1.1 ! root 1: # include <ctype.h> ! 2: # include "curses.h" ! 3: ! 4: /* ! 5: * @(#)mille.h 1.1 (Berkeley) 4/1/82 ! 6: */ ! 7: ! 8: /* ! 9: * Miscellaneous constants ! 10: */ ! 11: ! 12: # define unsgn unsigned ! 13: # define CARD short ! 14: ! 15: # define ARNOLD 214 /* my uid */ ! 16: ! 17: # define GURP 28672 /* bad uid */ ! 18: # define MAXUSERS 35 /* max # of users for startup */ ! 19: # define HAND_SZ 7 /* number of cards in a hand */ ! 20: # define DECK_SZ 101 /* number of cards in decks */ ! 21: # define NUM_SAFE 4 /* number of saftey cards */ ! 22: # define NUM_MILES 5 /* number of milestones types */ ! 23: # define NUM_CARDS 20 /* number of types of cards */ ! 24: # define BOARD_Y 17 /* size of board screen */ ! 25: # define BOARD_X 40 ! 26: # define MILES_Y 7 /* size of mileage screen */ ! 27: # define MILES_X 80 ! 28: # define SCORE_Y 17 /* size of score screen */ ! 29: # define SCORE_X 40 ! 30: # define MOVE_Y 10 /* Where to print move prompt */ ! 31: # define MOVE_X 20 ! 32: # define ERR_Y 15 /* Where to print errors */ ! 33: # define ERR_X 5 ! 34: # define EXT_Y 4 /* Where to put Extension */ ! 35: # define EXT_X 9 ! 36: ! 37: # define PLAYER 0 ! 38: # define COMP 1 ! 39: ! 40: # define W_SMALL 0 /* Small (initial) window */ ! 41: # define W_FULL 1 /* Full (final) window */ ! 42: ! 43: /* ! 44: * Move types ! 45: */ ! 46: ! 47: # define M_DISCARD 0 ! 48: # define M_DRAW 1 ! 49: # define M_PLAY 2 ! 50: # define M_ORDER 3 ! 51: ! 52: /* ! 53: * Scores ! 54: */ ! 55: ! 56: # define SC_SAFETY 100 ! 57: # define SC_ALL_SAFE 300 ! 58: # define SC_COUP 300 ! 59: # define SC_TRIP 400 ! 60: # define SC_SAFE 300 ! 61: # define SC_DELAY 300 ! 62: # define SC_EXTENSION 200 ! 63: # define SC_SHUT_OUT 500 ! 64: ! 65: /* ! 66: * safety descriptions ! 67: */ ! 68: ! 69: # define S_UNKNOWN 0 /* location of safety unknown */ ! 70: # define S_IN_HAND 1 /* safety in player's hand */ ! 71: # define S_PLAYED 2 /* safety has been played */ ! 72: # define S_GAS_SAFE 0 /* Gas safety card index */ ! 73: # define S_SPARE_SAFE 1 /* Tire safety card index */ ! 74: # define S_DRIVE_SAFE 2 /* Driveing safety card index */ ! 75: # define S_RIGHT_WAY 3 /* Right-of-Way card index */ ! 76: # define S_CONV 15 /* conversion from C_ to S_ */ ! 77: ! 78: /* ! 79: * card numbers ! 80: */ ! 81: ! 82: # define C_INIT -1 ! 83: # define C_25 0 ! 84: # define C_50 1 ! 85: # define C_75 2 ! 86: # define C_100 3 ! 87: # define C_200 4 ! 88: # define C_EMPTY 5 ! 89: # define C_FLAT 6 ! 90: # define C_CRASH 7 ! 91: # define C_STOP 8 ! 92: # define C_LIMIT 9 ! 93: # define C_GAS 10 ! 94: # define C_SPARE 11 ! 95: # define C_REPAIRS 12 ! 96: # define C_GO 13 ! 97: # define C_END_LIMIT 14 ! 98: # define C_GAS_SAFE 15 ! 99: # define C_SPARE_SAFE 16 ! 100: # define C_DRIVE_SAFE 17 ! 101: # define C_RIGHT_WAY 18 ! 102: ! 103: /* ! 104: * prompt types ! 105: */ ! 106: ! 107: # define MOVEPROMPT 0 ! 108: # define REALLYPROMPT 1 ! 109: # define ANOTHERHANDPROMPT 2 ! 110: # define ANOTHERGAMEPROMPT 3 ! 111: # define SAVEGAMEPROMPT 4 ! 112: # define SAMEFILEPROMPT 5 ! 113: # define FILEPROMPT 6 ! 114: # define EXTENSIONPROMPT 7 ! 115: # define OVERWRITEFILEPROMPT 8 ! 116: ! 117: # ifdef SYSV ! 118: # define srandom(x) srand(x) ! 119: # define random() rand() ! 120: ! 121: # ifndef attron ! 122: # define erasechar() _tty.c_cc[VERASE] ! 123: # define killchar() _tty.c_cc[VKILL] ! 124: # endif ! 125: # else ! 126: # ifndef erasechar ! 127: # define erasechar() _tty.sg_erase ! 128: # define killchar() _tty.sg_kill ! 129: # endif ! 130: # endif SYSV ! 131: ! 132: typedef struct { ! 133: bool coups[NUM_SAFE]; ! 134: bool can_go; ! 135: bool new_battle; ! 136: bool new_speed; ! 137: short safety[NUM_SAFE]; ! 138: short sh_safety[NUM_SAFE]; ! 139: short nummiles[NUM_MILES]; ! 140: short sh_nummiles[NUM_MILES]; ! 141: CARD hand[HAND_SZ]; ! 142: CARD sh_hand[HAND_SZ]; ! 143: CARD battle; ! 144: CARD sh_battle; ! 145: CARD speed; ! 146: CARD sh_speed; ! 147: int mileage; ! 148: int sh_mileage; ! 149: int hand_tot; ! 150: int sh_hand_tot; ! 151: int safescore; ! 152: int sh_safescore; ! 153: int coupscore; ! 154: int total; ! 155: int sh_total; ! 156: int games; ! 157: int sh_games; ! 158: int was_finished; ! 159: } PLAY; ! 160: ! 161: /* ! 162: * macros ! 163: */ ! 164: ! 165: # define other(x) (1 - x) ! 166: # define nextplay() (Play = other(Play)) ! 167: # define nextwin(x) (1 - x) ! 168: # define opposite(x) (Opposite[x]) ! 169: # define issafety(x) (x >= C_GAS_SAFE) ! 170: ! 171: /* ! 172: * externals ! 173: */ ! 174: ! 175: extern bool Debug, Finished, Next, On_exit, Order, Saved; ! 176: ! 177: extern char *C_fmt, **C_name, *Fromfile, Initstr[]; ! 178: ! 179: extern int Card_no, End, Handstart, Movetype, Numcards[], Numgos, ! 180: Numneed[], Numseen[NUM_CARDS], Play, Value[], Window; ! 181: ! 182: extern CARD Deck[DECK_SZ], Discard, Opposite[NUM_CARDS], Sh_discard, ! 183: *Topcard; ! 184: ! 185: extern FILE *outf; ! 186: ! 187: extern PLAY Player[2]; ! 188: ! 189: extern WINDOW *Board, *Miles, *Score; ! 190: ! 191: /* ! 192: * functions ! 193: */ ! 194: ! 195: CARD getcard();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.