kernel - Fix races created by a comedy of circumstansces (3)
[dragonfly.git] / games / mille / extern.c
blob3d2ac69a8e5bf97b3b0d90503f5b1b5f2b2b4731
1 /*-
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
7 * are met:
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
27 * SUCH DAMAGE.
29 * @(#)extern.c 8.1 (Berkeley) 5/31/93
30 * $FreeBSD: src/games/mille/extern.c,v 1.3 1999/11/30 03:49:01 billf Exp $
31 * $DragonFly: src/games/mille/extern.c,v 1.3 2006/08/27 17:17:23 pavalos Exp $
34 #include "mille.h"
37 * @(#)extern.c 1.1 (Berkeley) 4/1/82
40 bool Debug, /* set if debugging code on */
41 Finished, /* set if current hand is finished */
42 Next, /* set if changing players */
43 On_exit, /* set if game saved on exiting */
44 Order, /* set if hand should be sorted */
45 Saved; /* set if game just saved */
47 char Initstr[100]; /* initial string for error field */
48 const char *C_fmt = "%-18.18s"; /* format for printing cards */
49 char *Fromfile = NULL; /* startup file for game */
50 const char *_cn[NUM_CARDS] = { /* Card name buffer */
51 "",
52 "25",
53 "50",
54 "75",
55 "100",
56 "200",
57 "Out of Gas",
58 "Flat Tire",
59 "Accident",
60 "Stop",
61 "Speed Limit",
62 "Gasoline",
63 "Spare Tire",
64 "Repairs",
65 "Go",
66 "End of Limit",
67 "Extra Tank",
68 "Puncture Proof",
69 "Driving Ace",
70 "Right of Way"
72 const char **C_name = &_cn[1]; /* Card names */
74 int Card_no, /* Card number for current move */
75 End, /* End value for current hand */
76 Handstart = COMP, /* Player who starts hand */
77 Movetype, /* Current move type */
78 Play, /* Current player */
79 Numgos, /* Number of Go cards used by computer */
80 Window = W_SMALL, /* Current window wanted */
81 Numseen[NUM_CARDS]; /* Number of cards seen in current hand */
82 int Value[NUM_MILES] = { /* Value of mileage cards */
83 25, 50, 75, 100, 200
85 Numcards[NUM_CARDS] = { /* Number of cards in deck */
86 10, /* C_25 */
87 10, /* C_50 */
88 10, /* C_75 */
89 12, /* C_100 */
90 4, /* C_200 */
91 2, /* C_EMPTY */
92 2, /* C_FLAT */
93 2, /* C_CRASH */
94 4, /* C_STOP */
95 3, /* C_LIMIT */
96 6, /* C_GAS */
97 6, /* C_SPARE */
98 6, /* C_REPAIRS */
99 14, /* C_GO */
100 6, /* C_END_LIMIT */
101 1, /* C_GAS_SAFE */
102 1, /* C_SPARE_SAFE */
103 1, /* C_DRIVE_SAFE */
104 1, /* C_RIGHT_WAY */
105 0 /* C_INIT */
107 int Numneed[NUM_CARDS] = { /* number of cards needed per hand */
108 0, /* C_25 */
109 0, /* C_50 */
110 0, /* C_75 */
111 0, /* C_100 */
112 0, /* C_200 */
113 2, /* C_EMPTY */
114 2, /* C_FLAT */
115 2, /* C_CRASH */
116 4, /* C_STOP */
117 3, /* C_LIMIT */
118 2, /* C_GAS */
119 2, /* C_SPARE */
120 2, /* C_REPAIRS */
121 10, /* C_GO */
122 3, /* C_END_LIMIT */
123 1, /* C_GAS_SAFE */
124 1, /* C_SPARE_SAFE */
125 1, /* C_DRIVE_SAFE */
126 1, /* C_RIGHT_WAY */
127 0 /* C_INIT */
130 CARD Discard, /* Top of discard pile */
131 Sh_discard, /* Last discard card shown */
132 *Topcard; /* Pointer to next card to be picked */
133 CARD Opposite[NUM_CARDS] = { /* Opposites of each card */
134 C_25, C_50, C_75, C_100, C_200, C_GAS, C_SPARE,
135 C_REPAIRS, C_GO, C_END_LIMIT, C_EMPTY, C_FLAT, C_CRASH,
136 C_STOP, C_LIMIT, C_EMPTY, C_FLAT, C_CRASH, C_STOP, C_INIT
138 CARD Deck[DECK_SZ] = { /* Current deck */
139 C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25, C_25,
140 C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50, C_50,
141 C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75, C_75,
142 C_100, C_100, C_100, C_100, C_100, C_100, C_100, C_100, C_100,
143 C_100, C_100, C_100,
144 C_200, C_200, C_200, C_200,
145 C_EMPTY, C_EMPTY,
146 C_FLAT, C_FLAT,
147 C_CRASH, C_CRASH,
148 C_STOP, C_STOP, C_STOP, C_STOP,
149 C_LIMIT, C_LIMIT, C_LIMIT,
150 C_GAS, C_GAS, C_GAS, C_GAS, C_GAS, C_GAS,
151 C_SPARE, C_SPARE, C_SPARE, C_SPARE, C_SPARE, C_SPARE,
152 C_REPAIRS, C_REPAIRS, C_REPAIRS, C_REPAIRS, C_REPAIRS,
153 C_REPAIRS,
154 C_END_LIMIT, C_END_LIMIT, C_END_LIMIT, C_END_LIMIT, C_END_LIMIT,
155 C_END_LIMIT,
156 C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO, C_GO,
157 C_GO, C_GO, C_GO, C_GO,
158 C_GAS_SAFE, C_SPARE_SAFE, C_DRIVE_SAFE, C_RIGHT_WAY
161 FILE *outf;
163 PLAY Player[2]; /* Player descriptions */
165 WINDOW *Board, /* Playing field screen */
166 *Miles, /* Mileage screen */
167 *Score; /* Score screen */