]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - mille/mille.h
1 /* $NetBSD: mille.h,v 1.13 2004/01/27 20:30:30 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. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * @(#)mille.h 8.1 (Berkeley) 5/31/93
34 # include <sys/types.h>
36 # include <sys/stat.h>
48 * @(#)mille.h 1.1 (Berkeley) 4/1/82
52 * Miscellaneous constants
55 # define unsgn unsigned
58 # define HAND_SZ 7 /* number of cards in a hand */
59 # define DECK_SZ 101 /* number of cards in decks */
60 # define NUM_SAFE 4 /* number of saftey cards */
61 # define NUM_MILES 5 /* number of milestones types */
62 # define NUM_CARDS 20 /* number of types of cards */
63 # define BOARD_Y 17 /* size of board screen */
65 # define MILES_Y 7 /* size of mileage screen */
67 # define SCORE_Y 17 /* size of score screen */
69 # define MOVE_Y 10 /* Where to print move prompt */
71 # define ERR_Y 15 /* Where to print errors */
73 # define EXT_Y 4 /* Where to put Extension */
79 # define W_SMALL 0 /* Small (initial) window */
80 # define W_FULL 1 /* Full (final) window */
95 # define SC_SAFETY 100
96 # define SC_ALL_SAFE 300
100 # define SC_DELAY 300
101 # define SC_EXTENSION 200
102 # define SC_SHUT_OUT 500
105 * safety descriptions
116 # define S_UNKNOWN 0 /* location of safety unknown */
117 # define S_IN_HAND 1 /* safety in player's hand */
118 # define S_PLAYED 2 /* safety has been played */
119 # define S_GAS_SAFE 0 /* Gas safety card index */
120 # define S_SPARE_SAFE 1 /* Tire safety card index */
121 # define S_DRIVE_SAFE 2 /* Driveing safety card index */
122 # define S_RIGHT_WAY 3 /* Right-of-Way card index */
123 # define S_CONV 15 /* conversion from C_ to S_ */
142 # define C_REPAIRS 12
144 # define C_END_LIMIT 14
145 # define C_GAS_SAFE 15
146 # define C_SPARE_SAFE 16
147 # define C_DRIVE_SAFE 17
148 # define C_RIGHT_WAY 18
154 # define MOVEPROMPT 0
155 # define REALLYPROMPT 1
156 # define ANOTHERHANDPROMPT 2
157 # define ANOTHERGAMEPROMPT 3
158 # define SAVEGAMEPROMPT 4
159 # define SAMEFILEPROMPT 5
160 # define FILEPROMPT 6
161 # define EXTENSIONPROMPT 7
162 # define OVERWRITEFILEPROMPT 8
165 # define srandom(x) srand(x)
166 # define random() rand()
170 bool coups
[NUM_SAFE
];
174 short safety
[NUM_SAFE
];
175 short sh_safety
[NUM_SAFE
];
176 short nummiles
[NUM_MILES
];
177 short sh_nummiles
[NUM_MILES
];
179 CARD sh_hand
[HAND_SZ
];
202 # define other(x) (1 - x)
203 # define nextplay() (Play = other(Play))
204 # define nextwin(x) (1 - x)
205 # define opposite(x) (Opposite[x])
206 # define is_safety(x) (x >= C_GAS_SAFE)
212 extern bool Debug
, Finished
, Next
, On_exit
, Order
, Saved
;
214 extern char Initstr
[];
215 extern const char *C_fmt
, *const *C_name
, *Fromfile
;
217 extern int Card_no
, End
, Handstart
, Movetype
, Numgos
,
218 Numneed
[], Numseen
[NUM_CARDS
], Play
, Window
;
219 extern const int Numcards
[], Value
[];
221 extern CARD Deck
[DECK_SZ
], Discard
, Sh_discard
, *Topcard
;
222 extern const CARD Opposite
[NUM_CARDS
];
226 extern PLAY Player
[2];
228 extern WINDOW
*Board
, *Miles
, *Score
;
236 int canplay(const PLAY
*, const PLAY
*, CARD
);
239 void check_more(void);
240 void die(int) __attribute__((__noreturn__
));
242 bool error(const char *, ...);
243 void extrapolate(PLAY
*);
244 void finalscore(PLAY
*);
248 int haspicked(const PLAY
*);
251 int main(int, char **);
254 int onecard(const PLAY
*);
255 int playcard(PLAY
*);
260 bool rest_f(const char *);
265 void show_card(int, int, CARD
, CARD
*);
266 void show_score(int, int, int, int *);
270 bool varpush(int, ssize_t (int, const struct iovec
*, int));