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