]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - mille/mille.h
1 /* $NetBSD: mille.h,v 1.10 1999/09/08 21:17:50 jsm 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 Initstr
[];
211 extern const char *C_fmt
, *const *C_name
, *Fromfile
;
213 extern int Card_no
, End
, Handstart
, Movetype
, Numgos
,
214 Numneed
[], Numseen
[NUM_CARDS
], Play
, Window
;
215 extern const int Numcards
[], Value
[];
217 extern CARD Deck
[DECK_SZ
], Discard
, Sh_discard
, *Topcard
;
218 extern const CARD Opposite
[NUM_CARDS
];
222 extern PLAY Player
[2];
224 extern WINDOW
*Board
, *Miles
, *Score
;
230 void account
__P((CARD
));
231 void calcmove
__P((void));
232 int canplay
__P((const PLAY
*, const PLAY
*, CARD
));
233 int check_ext
__P((bool));
234 void check_go
__P((void));
235 void check_more
__P((void));
236 void die
__P((int)) __attribute__((__noreturn__
));
237 void domove
__P((void));
238 bool error
__P((const char *, ...));
239 void extrapolate
__P((PLAY
*));
240 void finalscore
__P((PLAY
*));
241 CARD getcard
__P((void));
242 void getmove
__P((void));
243 int getyn
__P((int));
244 int haspicked
__P((const PLAY
*));
245 void init
__P((void));
246 int isrepair
__P((CARD
));
247 int main
__P((int, char **));
248 void newboard
__P((void));
249 void newscore
__P((void));
250 int onecard
__P((const PLAY
*));
251 int playcard
__P((PLAY
*));
252 void prboard
__P((void));
253 void prompt
__P((int));
254 void prscore
__P((bool));
255 int readch
__P((void));
256 bool rest_f
__P((const char *));
257 int roll
__P((int, int));
259 int safety
__P((CARD
));
260 bool save
__P((void));
261 void show_card
__P((int, int, CARD
, CARD
*));
262 void show_score
__P((int, int, int, int *));
263 void shuffle
__P((void));
264 void sort
__P((CARD
*));
265 void undoex
__P((int));
266 bool varpush
__P((int, ssize_t
__P((int, const struct iovec
*, int))));