1 /* $OpenBSD: extern.c,v 1.8 2016/01/08 18:05:58 mestre Exp $ */ 2 /* $NetBSD: extern.c,v 1.4 1995/03/24 05:01:36 cgd Exp $ */ 3 4 /* 5 * Copyright (c) 1982, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. Neither the name of the University nor the names of its contributors 17 * may be used to endorse or promote products derived from this software 18 * without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 */ 32 33 #include "mille.h" 34 35 /* 36 * @(#)extern.c 1.1 (Berkeley) 4/1/82 37 */ 38 39 bool Debug, /* set if debugging code on */ 40 Finished, /* set if current hand is finished */ 41 Next, /* set if changing players */ 42 On_exit, /* set if game saved on exiting */ 43 Order, /* set if hand should be sorted */ 44 Saved; /* set if game just saved */ 45 46 char Initstr[100], /* initial string for error field */ 47 *C_fmt = "%-18.18s"; /* format for printing cards */ 48 const char *Fromfile = NULL, /* startup file for game */ 49 *const _cn[NUM_CARDS] = { /* Card name buffer */ 50 "", 51 "25", 52 "50", 53 "75", 54 "100", 55 "200", 56 "Out of Gas", 57 "Flat Tire", 58 "Accident", 59 "Stop", 60 "Speed Limit", 61 "Gasoline", 62 "Spare Tire", 63 "Repairs", 64 "Go", 65 "End of Limit", 66 "Extra Tank", 67 "Puncture Proof", 68 "Driving Ace", 69 "Right of Way" 70 }, 71 *const *C_name = &_cn[1]; /* Card names */ 72 73 int Card_no, /* Card number for current move */ 74 End, /* End value for current hand */ 75 Handstart = COMP, /* Player who starts hand */ 76 Movetype, /* Current move type */ 77 Play, /* Current player */ 78 Numgos, /* Number of Go cards used by computer */ 79 Window = W_SMALL, /* Current window wanted */ 80 Numseen[NUM_CARDS]; /* Number of cards seen in current hand */ 81 82 const int Value[NUM_MILES] = { /* Value of mileage cards */ 83 25, 50, 75, 100, 200 84 }, 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 */ 106 }; 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 */ 128 }; 129 130 const CARD Opposite[NUM_CARDS] = { /* Opposites of each card */ 131 C_25, C_50, C_75, C_100, C_200, C_GAS, C_SPARE, 132 C_REPAIRS, C_GO, C_END_LIMIT, C_EMPTY, C_FLAT, C_CRASH, 133 C_STOP, C_LIMIT, C_EMPTY, C_FLAT, C_CRASH, C_STOP, C_INIT 134 }; 135 CARD Discard, /* Top of discard pile */ 136 Sh_discard, /* Last discard card shown */ 137 *Topcard, /* Pointer to next card to be picked */ 138 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 159 }; 160 161 FILE *outf; 162 163 PLAY Player[2]; /* Player descriptions */ 164 165 WINDOW *Board, /* Playing field screen */ 166 *Miles, /* Mileage screen */ 167 *Score; /* Score screen */ 168 169