]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - mille/mille.h
1 /* $NetBSD: mille.h,v 1.8 1998/07/26 16:11:39 mycroft Exp $ */
4 * Copyright (c) 1982, 1993
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by the University of
18 * California, Berkeley and its contributors.
19 * 4. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * @(#)mille.h 8.1 (Berkeley) 5/31/93
38 # include <sys/types.h>
40 # include <sys/stat.h>
52 * @(#)mille.h 1.1 (Berkeley) 4/1/82
56 * Miscellaneous constants
59 # define unsgn unsigned
62 # define HAND_SZ 7 /* number of cards in a hand */
63 # define DECK_SZ 101 /* number of cards in decks */
64 # define NUM_SAFE 4 /* number of saftey cards */
65 # define NUM_MILES 5 /* number of milestones types */
66 # define NUM_CARDS 20 /* number of types of cards */
67 # define BOARD_Y 17 /* size of board screen */
69 # define MILES_Y 7 /* size of mileage screen */
71 # define SCORE_Y 17 /* size of score screen */
73 # define MOVE_Y 10 /* Where to print move prompt */
75 # define ERR_Y 15 /* Where to print errors */
77 # define EXT_Y 4 /* Where to put Extension */
83 # define W_SMALL 0 /* Small (initial) window */
84 # define W_FULL 1 /* Full (final) window */
99 # define SC_SAFETY 100
100 # define SC_ALL_SAFE 300
104 # define SC_DELAY 300
105 # define SC_EXTENSION 200
106 # define SC_SHUT_OUT 500
109 * safety descriptions
112 # define S_UNKNOWN 0 /* location of safety unknown */
113 # define S_IN_HAND 1 /* safety in player's hand */
114 # define S_PLAYED 2 /* safety has been played */
115 # define S_GAS_SAFE 0 /* Gas safety card index */
116 # define S_SPARE_SAFE 1 /* Tire safety card index */
117 # define S_DRIVE_SAFE 2 /* Driveing safety card index */
118 # define S_RIGHT_WAY 3 /* Right-of-Way card index */
119 # define S_CONV 15 /* conversion from C_ to S_ */
138 # define C_REPAIRS 12
140 # define C_END_LIMIT 14
141 # define C_GAS_SAFE 15
142 # define C_SPARE_SAFE 16
143 # define C_DRIVE_SAFE 17
144 # define C_RIGHT_WAY 18
150 # define MOVEPROMPT 0
151 # define REALLYPROMPT 1
152 # define ANOTHERHANDPROMPT 2
153 # define ANOTHERGAMEPROMPT 3
154 # define SAVEGAMEPROMPT 4
155 # define SAMEFILEPROMPT 5
156 # define FILEPROMPT 6
157 # define EXTENSIONPROMPT 7
158 # define OVERWRITEFILEPROMPT 8
161 # define srandom(x) srand(x)
162 # define random() rand()
166 bool coups
[NUM_SAFE
];
170 short safety
[NUM_SAFE
];
171 short sh_safety
[NUM_SAFE
];
172 short nummiles
[NUM_MILES
];
173 short sh_nummiles
[NUM_MILES
];
175 CARD sh_hand
[HAND_SZ
];
198 # define other(x) (1 - x)
199 # define nextplay() (Play = other(Play))
200 # define nextwin(x) (1 - x)
201 # define opposite(x) (Opposite[x])
202 # define issafety(x) (x >= C_GAS_SAFE)
208 extern bool Debug
, Finished
, Next
, On_exit
, Order
, Saved
;
210 extern char *C_fmt
, **C_name
, *Fromfile
, Initstr
[];
212 extern int Card_no
, End
, Handstart
, Movetype
, Numcards
[], Numgos
,
213 Numneed
[], Numseen
[NUM_CARDS
], Play
, Value
[], Window
;
215 extern CARD Deck
[DECK_SZ
], Discard
, Opposite
[NUM_CARDS
], Sh_discard
,
220 extern PLAY Player
[2];
222 extern WINDOW
*Board
, *Miles
, *Score
;
228 void account
__P((CARD
));
229 void calcmove
__P((void));
230 int canplay
__P((PLAY
*, PLAY
*, CARD
));
231 int check_ext
__P((bool));
232 void check_go
__P((void));
233 void check_more
__P((void));
235 void domove
__P((void));
236 bool error
__P((const char *, ...));
237 void extrapolate
__P((PLAY
*));
238 void finalscore
__P((PLAY
*));
239 CARD getcard
__P((void));
240 void getmove
__P((void));
241 int getyn
__P((int));
242 int haspicked
__P((PLAY
*));
243 void init
__P((void));
244 int isrepair
__P((CARD
));
245 int main
__P((int, char **));
246 void newboard
__P((void));
247 void newscore
__P((void));
248 int onecard
__P((PLAY
*));
249 int playcard
__P((PLAY
*));
250 void prboard
__P((void));
251 void prompt
__P((int));
252 void prscore
__P((int));
253 int readch
__P((void));
254 bool rest_f
__P((char *));
255 int roll
__P((int, int));
257 int safety
__P((CARD
));
258 bool save
__P((void));
259 void show_card
__P((int, int, CARD
, CARD
*));
260 void show_score
__P((int, int, int, int *));
261 void shuffle
__P((void));
262 void sort
__P((CARD
*));
263 void undoex
__P((int));
264 bool varpush
__P((int, ssize_t
__P((int, const struct iovec
*, int))));