Home | History | Annotate | Line # | Download | only in mille
extern.c revision 1.4
      1 /*	$NetBSD: extern.c,v 1.4 1995/03/24 05:01:36 cgd Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1982, 1993
      5  *	The Regents of the University of California.  All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     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.
     22  *
     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
     33  * SUCH DAMAGE.
     34  */
     35 
     36 #ifndef lint
     37 #if 0
     38 static char sccsid[] = "@(#)extern.c	8.1 (Berkeley) 5/31/93";
     39 #else
     40 static char rcsid[] = "$NetBSD: extern.c,v 1.4 1995/03/24 05:01:36 cgd Exp $";
     41 #endif
     42 #endif /* not lint */
     43 
     44 # include	"mille.h"
     45 
     46 /*
     47  * @(#)extern.c	1.1 (Berkeley) 4/1/82
     48  */
     49 
     50 bool	Debug,			/* set if debugging code on		*/
     51 	Finished,		/* set if current hand is finished	*/
     52 	Next,			/* set if changing players		*/
     53 	On_exit,		/* set if game saved on exiting		*/
     54 	Order,			/* set if hand should be sorted		*/
     55 	Saved;			/* set if game just saved		*/
     56 
     57 char	*C_fmt = "%-18.18s",	/* format for printing cards		*/
     58 	*Fromfile = NULL,	/* startup file for game		*/
     59 	Initstr[100],		/* initial string for error field	*/
     60 	*_cn[NUM_CARDS] = {	/* Card name buffer			*/
     61 		"",
     62 		"25",
     63 		"50",
     64 		"75",
     65 		"100",
     66 		"200",
     67 		"Out of Gas",
     68 		"Flat Tire",
     69 		"Accident",
     70 		"Stop",
     71 		"Speed Limit",
     72 		"Gasoline",
     73 		"Spare Tire",
     74 		"Repairs",
     75 		"Go",
     76 		"End of Limit",
     77 		"Extra Tank",
     78 		"Puncture Proof",
     79 		"Driving Ace",
     80 		"Right of Way"
     81 	},
     82 	**C_name = &_cn[1];	/* Card names				*/
     83 
     84 int	Card_no,		/* Card number for current move		*/
     85 	End,			/* End value for current hand		*/
     86 	Handstart = COMP,	/* Player who starts hand		*/
     87 	Movetype,		/* Current move type			*/
     88 	Play,			/* Current player			*/
     89 	Numgos,			/* Number of Go cards used by computer	*/
     90 	Window = W_SMALL,	/* Current window wanted		*/
     91 	Numseen[NUM_CARDS],	/* Number of cards seen in current hand	*/
     92 	Value[NUM_MILES] = {	/* Value of mileage cards		*/
     93 		25, 50, 75, 100, 200
     94 	},
     95 	Numcards[NUM_CARDS] = {	/* Number of cards in deck		*/
     96 		10,	/* C_25 */
     97 		10,	/* C_50 */
     98 		10,	/* C_75 */
     99 		12,	/* C_100 */
    100 		4,	/* C_200 */
    101 		2,	/* C_EMPTY */
    102 		2,	/* C_FLAT */
    103 		2,	/* C_CRASH */
    104 		4,	/* C_STOP */
    105 		3,	/* C_LIMIT */
    106 		6,	/* C_GAS */
    107 		6,	/* C_SPARE */
    108 		6,	/* C_REPAIRS */
    109 		14,	/* C_GO */
    110 		6,	/* C_END_LIMIT */
    111 		1,	/* C_GAS_SAFE */
    112 		1,	/* C_SPARE_SAFE */
    113 		1,	/* C_DRIVE_SAFE */
    114 		1,	/* C_RIGHT_WAY */
    115 		0	/* C_INIT */
    116 	},
    117 	Numneed[NUM_CARDS] = {	/* number of cards needed per hand	*/
    118 		0,	/* C_25 */
    119 		0,	/* C_50 */
    120 		0,	/* C_75 */
    121 		0,	/* C_100 */
    122 		0,	/* C_200 */
    123 		2,	/* C_EMPTY */
    124 		2,	/* C_FLAT */
    125 		2,	/* C_CRASH */
    126 		4,	/* C_STOP */
    127 		3,	/* C_LIMIT */
    128 		2,	/* C_GAS */
    129 		2,	/* C_SPARE */
    130 		2,	/* C_REPAIRS */
    131 		10,	/* C_GO */
    132 		3,	/* C_END_LIMIT */
    133 		1,	/* C_GAS_SAFE */
    134 		1,	/* C_SPARE_SAFE */
    135 		1,	/* C_DRIVE_SAFE */
    136 		1,	/* C_RIGHT_WAY */
    137 		0	/* C_INIT */
    138 	};
    139 
    140 CARD	Discard,		/* Top of discard pile			*/
    141 	Sh_discard,		/* Last discard card shown		*/
    142 	*Topcard,		/* Pointer to next card to be picked	*/
    143 	Opposite[NUM_CARDS] = {	/* Opposites of each card		*/
    144 		C_25, C_50, C_75, C_100, C_200, C_GAS, C_SPARE,
    145 		C_REPAIRS, C_GO, C_END_LIMIT, C_EMPTY, C_FLAT, C_CRASH,
    146 		C_STOP, C_LIMIT, C_EMPTY, C_FLAT, C_CRASH, C_STOP, C_INIT
    147 	},
    148 	Deck[DECK_SZ] = {	/* Current deck				*/
    149 		C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25,
    150 		C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50,
    151 		C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75,
    152 		C_100, C_100, C_100, C_100, C_100, C_100, C_100, C_100, C_100,
    153 		C_100, C_100, C_100,
    154 		C_200, C_200, C_200, C_200,
    155 		C_EMPTY, C_EMPTY,
    156 		C_FLAT, C_FLAT,
    157 		C_CRASH, C_CRASH,
    158 		C_STOP, C_STOP, C_STOP, C_STOP,
    159 		C_LIMIT, C_LIMIT, C_LIMIT,
    160 		C_GAS, C_GAS, C_GAS, C_GAS, C_GAS, C_GAS,
    161 		C_SPARE, C_SPARE, C_SPARE, C_SPARE, C_SPARE, C_SPARE,
    162 		C_REPAIRS, C_REPAIRS, C_REPAIRS, C_REPAIRS, C_REPAIRS,
    163 			C_REPAIRS,
    164 		C_END_LIMIT, C_END_LIMIT, C_END_LIMIT, C_END_LIMIT, C_END_LIMIT,
    165 			C_END_LIMIT,
    166 		C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO,
    167 			C_GO, C_GO, C_GO, C_GO,
    168 		C_GAS_SAFE, C_SPARE_SAFE, C_DRIVE_SAFE, C_RIGHT_WAY
    169 	};
    170 
    171 FILE	*outf;
    172 
    173 PLAY	Player[2];		/* Player descriptions			*/
    174 
    175 WINDOW	*Board,			/* Playing field screen			*/
    176 	*Miles,			/* Mileage screen			*/
    177 	*Score;			/* Score screen				*/
    178 
    179