X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/718b40e43f2fbb804acc0266499926f8e51f83ef..98a4fc6346f602b2e70306c8a0c79c4e984d1009:/mille/mille.h?ds=inline diff --git a/mille/mille.h b/mille/mille.h index 5c3f4800..e9672a7a 100644 --- a/mille/mille.h +++ b/mille/mille.h @@ -1,4 +1,4 @@ -/* $NetBSD: mille.h,v 1.7 1997/10/12 00:54:11 lukem Exp $ */ +/* $NetBSD: mille.h,v 1.17 2009/08/12 08:07:27 dholland Exp $ */ /* * Copyright (c) 1982, 1993 @@ -12,11 +12,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -35,18 +31,18 @@ * @(#)mille.h 8.1 (Berkeley) 5/31/93 */ -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* * @(#)mille.h 1.1 (Berkeley) 4/1/82 @@ -56,111 +52,118 @@ * Miscellaneous constants */ -# define unsgn unsigned -# define CARD short - -# define HAND_SZ 7 /* number of cards in a hand */ -# define DECK_SZ 101 /* number of cards in decks */ -# define NUM_SAFE 4 /* number of saftey cards */ -# define NUM_MILES 5 /* number of milestones types */ -# define NUM_CARDS 20 /* number of types of cards */ -# define BOARD_Y 17 /* size of board screen */ -# define BOARD_X 40 -# define MILES_Y 7 /* size of mileage screen */ -# define MILES_X 80 -# define SCORE_Y 17 /* size of score screen */ -# define SCORE_X 40 -# define MOVE_Y 10 /* Where to print move prompt */ -# define MOVE_X 20 -# define ERR_Y 15 /* Where to print errors */ -# define ERR_X 5 -# define EXT_Y 4 /* Where to put Extension */ -# define EXT_X 9 - -# define PLAYER 0 -# define COMP 1 - -# define W_SMALL 0 /* Small (initial) window */ -# define W_FULL 1 /* Full (final) window */ +#define CARD short + +#define HAND_SZ 7 /* number of cards in a hand */ +#define DECK_SZ 101 /* number of cards in decks */ +#define NUM_SAFE 4 /* number of saftey cards */ +#define NUM_MILES 5 /* number of milestones types */ +#define NUM_CARDS 20 /* number of types of cards */ +#define BOARD_Y 17 /* size of board screen */ +#define BOARD_X 40 +#define MILES_Y 7 /* size of mileage screen */ +#define MILES_X 80 +#define SCORE_Y 17 /* size of score screen */ +#define SCORE_X 40 +#define MOVE_Y 10 /* Where to print move prompt */ +#define MOVE_X 20 +#define ERR_Y 15 /* Where to print errors */ +#define ERR_X 5 +#define EXT_Y 4 /* Where to put Extension */ +#define EXT_X 9 + +#define PLAYER 0 +#define COMP 1 + +#define W_SMALL 0 /* Small (initial) window */ +#define W_FULL 1 /* Full (final) window */ /* * Move types */ -# define M_DISCARD 0 -# define M_DRAW 1 -# define M_PLAY 2 -# define M_ORDER 3 +#define M_DISCARD 0 +#define M_DRAW 1 +#define M_PLAY 2 +#define M_ORDER 3 /* * Scores */ -# define SC_SAFETY 100 -# define SC_ALL_SAFE 300 -# define SC_COUP 300 -# define SC_TRIP 400 -# define SC_SAFE 300 -# define SC_DELAY 300 -# define SC_EXTENSION 200 -# define SC_SHUT_OUT 500 +#define SC_SAFETY 100 +#define SC_ALL_SAFE 300 +#define SC_COUP 300 +#define SC_TRIP 400 +#define SC_SAFE 300 +#define SC_DELAY 300 +#define SC_EXTENSION 200 +#define SC_SHUT_OUT 500 /* * safety descriptions */ -# define S_UNKNOWN 0 /* location of safety unknown */ -# define S_IN_HAND 1 /* safety in player's hand */ -# define S_PLAYED 2 /* safety has been played */ -# define S_GAS_SAFE 0 /* Gas safety card index */ -# define S_SPARE_SAFE 1 /* Tire safety card index */ -# define S_DRIVE_SAFE 2 /* Driveing safety card index */ -# define S_RIGHT_WAY 3 /* Right-of-Way card index */ -# define S_CONV 15 /* conversion from C_ to S_ */ +#undef S_UNKNOWN +#undef S_IN_HAND +#undef S_PLAYED +#undef S_GAS_SAFE +#undef S_SPARE_SAFE +#undef S_DRIVE_SAFE +#undef S_RIGHT_WAY +#undef S_CONV +#define S_UNKNOWN 0 /* location of safety unknown */ +#define S_IN_HAND 1 /* safety in player's hand */ +#define S_PLAYED 2 /* safety has been played */ +#define S_GAS_SAFE 0 /* Gas safety card index */ +#define S_SPARE_SAFE 1 /* Tire safety card index */ +#define S_DRIVE_SAFE 2 /* Driveing safety card index */ +#define S_RIGHT_WAY 3 /* Right-of-Way card index */ +#define S_CONV 15 /* conversion from C_ to S_ */ /* * card numbers */ -# define C_INIT -1 -# define C_25 0 -# define C_50 1 -# define C_75 2 -# define C_100 3 -# define C_200 4 -# define C_EMPTY 5 -# define C_FLAT 6 -# define C_CRASH 7 -# define C_STOP 8 -# define C_LIMIT 9 -# define C_GAS 10 -# define C_SPARE 11 -# define C_REPAIRS 12 -# define C_GO 13 -# define C_END_LIMIT 14 -# define C_GAS_SAFE 15 -# define C_SPARE_SAFE 16 -# define C_DRIVE_SAFE 17 -# define C_RIGHT_WAY 18 +#define C_INIT -1 +#define C_25 0 +#define C_50 1 +#define C_75 2 +#define C_100 3 +#define C_200 4 +#define C_EMPTY 5 +#define C_FLAT 6 +#define C_CRASH 7 +#define C_STOP 8 +#define C_LIMIT 9 +#define C_GAS 10 +#define C_SPARE 11 +#define C_REPAIRS 12 +#define C_GO 13 +#define C_END_LIMIT 14 +#define C_GAS_SAFE 15 +#define C_SPARE_SAFE 16 +#define C_DRIVE_SAFE 17 +#define C_RIGHT_WAY 18 /* * prompt types */ -# define MOVEPROMPT 0 -# define REALLYPROMPT 1 -# define ANOTHERHANDPROMPT 2 -# define ANOTHERGAMEPROMPT 3 -# define SAVEGAMEPROMPT 4 -# define SAMEFILEPROMPT 5 -# define FILEPROMPT 6 -# define EXTENSIONPROMPT 7 -# define OVERWRITEFILEPROMPT 8 - -# ifdef SYSV -# define srandom(x) srand(x) -# define random() rand() -# endif /* SYSV */ +#define MOVEPROMPT 0 +#define REALLYPROMPT 1 +#define ANOTHERHANDPROMPT 2 +#define ANOTHERGAMEPROMPT 3 +#define SAVEGAMEPROMPT 4 +#define SAMEFILEPROMPT 5 +#define FILEPROMPT 6 +#define EXTENSIONPROMPT 7 +#define OVERWRITEFILEPROMPT 8 + +#ifdef SYSV +#define srandom(x) srand(x) +#define random() rand() +#endif /* SYSV */ typedef struct { bool coups[NUM_SAFE]; @@ -195,11 +198,11 @@ typedef struct { * macros */ -# define other(x) (1 - x) -# define nextplay() (Play = other(Play)) -# define nextwin(x) (1 - x) -# define opposite(x) (Opposite[x]) -# define issafety(x) (x >= C_GAS_SAFE) +#define other(x) (1 - x) +#define nextplay() (Play = other(Play)) +#define nextwin(x) (1 - x) +#define opposite(x) (Opposite[x]) +#define is_safety(x) (x >= C_GAS_SAFE) /* * externals @@ -207,13 +210,16 @@ typedef struct { extern bool Debug, Finished, Next, On_exit, Order, Saved; -extern char *C_fmt, **C_name, *Fromfile, Initstr[]; +#define INITSTR_SIZE 100 +extern char Initstr[INITSTR_SIZE]; +extern const char *C_fmt, *const *C_name, *Fromfile; -extern int Card_no, End, Handstart, Movetype, Numcards[], Numgos, - Numneed[], Numseen[NUM_CARDS], Play, Value[], Window; +extern int Card_no, End, Handstart, Movetype, Numgos, + Numneed[], Numseen[NUM_CARDS], Play, Window; +extern const int Numcards[], Value[]; -extern CARD Deck[DECK_SZ], Discard, Opposite[NUM_CARDS], Sh_discard, - *Topcard; +extern CARD Deck[DECK_SZ], Discard, Sh_discard, *Topcard; +extern const CARD Opposite[NUM_CARDS]; extern FILE *outf; @@ -225,40 +231,34 @@ extern WINDOW *Board, *Miles, *Score; * functions */ -void account __P((CARD)); -void calcmove __P((void)); -int canplay __P((PLAY *, PLAY *, CARD)); -int check_ext __P((bool)); -void check_go __P((void)); -void check_more __P((void)); -void die __P((int)); -void domove __P((void)); -bool error __P((char *, ...)); -void extrapolate __P((PLAY *)); -void finalscore __P((PLAY *)); -CARD getcard __P((void)); -void getmove __P((void)); -int getyn __P((int)); -int haspicked __P((PLAY *)); -void init __P((void)); -int isrepair __P((CARD)); -int main __P((int, char **)); -void newboard __P((void)); -void newscore __P((void)); -int onecard __P((PLAY *)); -int playcard __P((PLAY *)); -void prboard __P((void)); -void prompt __P((int)); -void prscore __P((int)); -int readch __P((void)); -bool rest_f __P((char *)); -int roll __P((int, int)); -void rub __P((int)); -int safety __P((CARD)); -bool save __P((void)); -void show_card __P((int, int, CARD, CARD *)); -void show_score __P((int, int, int, int *)); -void shuffle __P((void)); -void sort __P((CARD *)); -void undoex __P((int)); -bool varpush __P((int, ssize_t __P((int, const struct iovec *, int)))); +void account(CARD); +void calcmove(void); +int canplay(const PLAY *, const PLAY *, CARD); +int check_ext(bool); +void check_more(void); +void die(int) __attribute__((__noreturn__)); +void domove(void); +bool error(const char *, ...); +void extrapolate(PLAY *); +void finalscore(PLAY *); +CARD getcard(void); +int getyn(int); +void init(void); +int is_repair(CARD); +int main(int, char **); +void newboard(void); +void newscore(void); +int onecard(const PLAY *); +void prboard(void); +void prompt(int); +void prscore(bool); +int readch(void); +bool rest_f(const char *); +int roll(int, int); +void rub(int); +int safety(CARD); +bool save(void); +void shuffle(void); +void sort(CARD *); +void undoex(int); +bool varpush(int, ssize_t (int, const struct iovec *, int));