2 * Copyright (c) 1982, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * @(#)mille.h 8.1 (Berkeley) 5/31/93
31 * $FreeBSD: src/games/mille/mille.h,v 1.7 1999/12/12 06:17:24 billf Exp $
34 #include <sys/types.h>
43 * @(#)mille.h 1.1 (Berkeley) 4/1/82
47 * Miscellaneous constants
52 #define HAND_SZ 7 /* number of cards in a hand */
53 #define DECK_SZ 101 /* number of cards in decks */
54 #define NUM_SAFE 4 /* number of safety cards */
55 #define NUM_MILES 5 /* number of milestones types */
56 #define NUM_CARDS 20 /* number of types of cards */
57 #define BOARD_Y 17 /* size of board screen */
59 #define MILES_Y 7 /* size of mileage screen */
61 #define SCORE_Y 17 /* size of score screen */
63 #define MOVE_Y 10 /* Where to print move prompt */
65 #define ERR_Y 15 /* Where to print errors */
67 #define EXT_Y 4 /* Where to put Extension */
73 #define W_SMALL 0 /* Small (initial) window */
74 #define W_FULL 1 /* Full (final) window */
90 #define SC_ALL_SAFE 300
95 #define SC_EXTENSION 200
96 #define SC_SHUT_OUT 500
102 #define S_UNKNOWN 0 /* location of safety unknown */
103 #define S_IN_HAND 1 /* safety in player's hand */
104 #define S_PLAYED 2 /* safety has been played */
105 #define S_GAS_SAFE 0 /* Gas safety card index */
106 #define S_SPARE_SAFE 1 /* Tire safety card index */
107 #define S_DRIVE_SAFE 2 /* Driveing safety card index */
108 #define S_RIGHT_WAY 3 /* Right-of-Way card index */
109 #define S_CONV 15 /* conversion from C_ to S_ */
130 #define C_END_LIMIT 14
131 #define C_GAS_SAFE 15
132 #define C_SPARE_SAFE 16
133 #define C_DRIVE_SAFE 17
134 #define C_RIGHT_WAY 18
141 #define REALLYPROMPT 1
142 #define ANOTHERHANDPROMPT 2
143 #define ANOTHERGAMEPROMPT 3
144 #define SAVEGAMEPROMPT 4
145 #define SAMEFILEPROMPT 5
147 #define EXTENSIONPROMPT 7
148 #define OVERWRITEFILEPROMPT 8
150 #define erasechar() cur_term->Nttyb.c_cc[VERASE]
151 #define killchar() cur_term->Nttyb.c_cc[VKILL]
154 bool coups[NUM_SAFE];
158 short safety[NUM_SAFE];
159 short sh_safety[NUM_SAFE];
160 short nummiles[NUM_MILES];
161 short sh_nummiles[NUM_MILES];
163 CARD sh_hand[HAND_SZ];
186 #define other(x) (1 - x)
187 #define nextplay() (Play = other(Play))
188 #define nextwin(x) (1 - x)
189 #define opposite(x) (Opposite[x])
190 #define issafety(x) (x >= C_GAS_SAFE)
196 extern bool Debug, Finished, Next, On_exit, Order, Saved;
198 extern char Initstr[];
199 extern const char *C_fmt, *const *C_name, *Fromfile;
201 extern int Card_no, End, Handstart, Movetype, Numgos,
202 Numneed[], Numseen[NUM_CARDS], Play, Window;
203 extern const int Numcards[], Value[];
205 extern CARD Deck[DECK_SZ], Discard, Sh_discard, *Topcard;
206 extern const CARD Opposite[NUM_CARDS];
210 extern PLAY Player[2];
212 extern WINDOW *Board, *Miles, *Score;
220 bool canplay(const PLAY *, const PLAY *, CARD);
221 bool check_ext(bool);
222 void check_more(void);
223 void die(int) __dead2;
225 bool error(const char *, ...);
227 void extrapolate(PLAY *);
229 void finalscore(PLAY *);
236 bool onecard(const PLAY *);
241 bool rest_f(const char *);
248 bool varpush(int, ssize_t (*)(int, const struct iovec *, int));