1 /* $NetBSD: globals.c,v 1.12 2001/01/04 05:34:56 jwise Exp $ */ 2 3 /* 4 * Copyright (c) 1983, 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[] = "@(#)globals.c 8.2 (Berkeley) 4/28/95"; 40 #else 41 __RCSID("$NetBSD: globals.c,v 1.12 2001/01/04 05:34:56 jwise Exp $"); 42 #endif 43 #endif /* not lint */ 44 45 #include <sys/types.h> 46 #include <setjmp.h> 47 #include "extern.h" 48 49 struct scenario scene[] = { 50 /* 51 * int winddir; 52 * int windspeed; 53 * int windchange; 54 * int vessels; 55 * char *name; 56 * struct ship ship[NSHIP]; 57 */ 58 { 5, 3, 5, 2, "Ranger vs. Drake", 59 { 60 { "Ranger", specs+0, N_A, 7, 20, 4, 0 }, 61 { "Drake", specs+1, N_B, 7, 31, 5, 0 } 62 } 63 }, 64 { 1, 3, 6, 2, "The Battle of Flamborough Head", 65 { 66 { "Bonhomme Rich", specs+2, N_A, 13, 40, 2, 0 }, 67 { "Serapis", specs+3, N_B, 2, 42, 2, 0 } 68 } 69 }, 70 { 5, 5, 5, 10, "Arbuthnot and Des Touches", 71 { 72 { "America", specs+4, N_B, 7, 37, 4, 0 }, 73 { "Befford", specs+5, N_B, 5, 35, 4, 0 }, 74 { "Adamant", specs+6, N_B, 3, 33, 4, 0 }, 75 { "London", specs+7, N_B, 1, 31, 4, 0 }, 76 { "Royal Oak", specs+8, N_B, -1, 29, 4, 0 }, 77 { "Neptune", specs+9, N_F, 6, 44, 4, 0 }, 78 { "Duc Bougogne", specs+10, N_F, 8, 46, 4, 0 }, 79 { "Conquerant", specs+48, N_F, 10, 48, 4, 0 }, 80 { "Provence", specs+11, N_F, 12, 50, 4, 0 }, 81 { "Romulus", specs+12, N_F, 20, 58, 4, 0 } 82 } 83 }, 84 { 1, 3, 5, 10, "Suffren and Hughes", 85 { 86 { "Monmouth", specs+52, N_B, 9, 45, 2, 0 }, 87 { "Hero", specs+5, N_B, 13, 49, 2, 0 }, 88 { "Isis", specs+6, N_B, 12, 48, 2, 0 }, 89 { "Superb", specs+50, N_B, 10, 46, 2, 0 }, 90 { "Burford", specs+48, N_B, 11, 47, 2, 0 }, 91 { "Flamband", specs+13, N_F, 7, 59, 4, 0 }, 92 { "Annibal", specs+9, N_F, 4, 56, 4, 0 }, 93 { "Severe", specs+11, N_F, 2, 54, 4, 0 }, 94 { "Brilliant", specs+49, N_F, -1, 51, 4, 0 }, 95 { "Sphinx", specs+51, N_F, -5, 47, 4, 0 } 96 } 97 }, 98 { 1, 3, 4, 2, "Nymphe vs. Cleopatre", 99 { 100 { "Nymphe", specs+14, N_B, 13, 30, 2, 0 }, 101 { "Cleopatre", specs+15, N_F, 3, 41, 2, 0 } 102 } 103 }, 104 { 1, 3, 5, 2, "Mars vs. Hercule", 105 { 106 { "Mars", specs+16, N_B, 13, 30, 2, 0 }, 107 { "Hercule", specs+17, N_F, 3, 41, 2, 0 } 108 } 109 }, 110 { 5, 3, 5, 2, "Ambuscade vs. Baionnaise", 111 { 112 { "Ambuscade", specs+18, N_B, 13, 30, 2, 0 }, 113 { "Baionnaise", specs+19, N_F, 3, 41, 2, 0 } 114 } 115 }, 116 { 1, 5, 6, 2, "Constellation vs. Insurgent", 117 { 118 { "Constellation", specs+20, N_A, 9, 50, 8, 0 }, 119 { "Insurgent", specs+22, N_F, 4, 24, 2, 0 } 120 } 121 }, 122 { 1, 3, 5, 2, "Constellation vs. Vengeance", 123 { 124 { "Constellation", specs+20, N_A, 12, 40, 2, 0 }, 125 { "Vengeance", specs+21, N_F, 1, 43, 2, 0 } 126 } 127 }, 128 { 1, 3, 6, 10, "The Battle of Lissa", 129 { 130 { "Amphion", specs+23, N_B, 8, 50, 4, 0 }, 131 { "Active", specs+24, N_B, 6, 48, 4, 0 }, 132 { "Volage", specs+25, N_B, 4, 46, 4, 0 }, 133 { "Cerberus", specs+26, N_B, 2, 44, 4, 0 }, 134 { "Favorite", specs+27, N_F, 9, 34, 2, 0 }, 135 { "Flore", specs+21, N_F, 13, 39, 2, 0 }, 136 { "Danae", specs+64, N_F, 15, 37, 2, 0 }, 137 { "Bellona", specs+28, N_F, 17, 35, 2, 0 }, 138 { "Corona", specs+29, N_F, 12, 31, 2, 0 }, 139 { "Carolina", specs+30, N_F, 15, 28, 2, 0 } 140 } 141 }, 142 { 2, 5, 6, 2, "Constitution vs. Guerriere", 143 { 144 { "Constitution", specs+31, N_A, 7, 35, 1, 0 }, 145 { "Guerriere", specs+32, N_B, 7, 47, 4, 0 } 146 } 147 }, 148 { 1, 3, 5, 2, "United States vs. Macedonian", 149 { 150 { "United States", specs+33, N_A, 1, 52, 6, 0 }, 151 { "Macedonian", specs+34, N_B, 14, 40, 1, 0 } 152 } 153 }, 154 { 1, 3, 6, 2, "Constitution vs. Java", 155 { 156 { "Constitution", specs+31, N_A, 1, 40, 2, 0 }, 157 { "Java", specs+35, N_B, 11, 40, 2, 0 } 158 } 159 }, 160 { 1, 3, 5, 2, "Chesapeake vs. Shannon", 161 { 162 { "Chesapeake", specs+36, N_A, 13, 40, 2, 0 }, 163 { "Shannon", specs+37, N_B, 1, 42, 2, 0 } 164 } 165 }, 166 { 1, 1, 6, 5, "The Battle of Lake Erie", 167 { 168 { "Lawrence", specs+38, N_A, 4, 55, 8, 0 }, 169 { "Niagara", specs+42, N_A, 7, 61, 8, 0 }, 170 { "Lady Prevost", specs+39, N_B, 4, 25, 2, 0 }, 171 { "Detroit", specs+40, N_B, 7, 22, 2, 0 }, 172 { "Q. Charlotte", specs+41, N_B, 10, 19, 2, 0 } 173 } 174 }, 175 { 1, 1, 5, 2, "Wasp vs. Reindeer", 176 { 177 { "Wasp", specs+42, N_A, 3, 41, 2, 0 }, 178 { "Reindeer", specs+43, N_B, 10, 48, 2, 0 } 179 } 180 }, 181 { 1, 2, 5, 3, "Constitution vs. Cyane and Levant", 182 { 183 { "Constitution", specs+31, N_A, 10, 45, 2, 0 }, 184 { "Cyane", specs+44, N_B, 3, 37, 2, 0 }, 185 { "Levant", specs+45, N_B, 5, 35, 2, 0 } 186 } 187 }, 188 { 5, 5, 5, 3, "Pellew vs. Droits de L'Homme", 189 { 190 { "Indefatigable", specs+46, N_B, 12, 45, 6, 0 }, 191 { "Amazon", specs+47, N_B, 9, 48, 6, 0 }, 192 { "Droits L'Hom", specs+48, N_F, 3, 28, 5, 0 } 193 } 194 }, 195 { 2, 2, 3, 10, "Algeciras", 196 { 197 { "Caesar", specs+49, N_B, 7, 70, 6, 0 }, 198 { "Pompee", specs+50, N_B, 5, 72, 6, 0 }, 199 { "Spencer", specs+5, N_B, 3, 74, 6, 0 }, 200 { "Hannibal", specs+7, N_B, 1, 76, 6, 0 }, 201 { "Real-Carlos", specs+53, N_S, 9, 20, 3, 0 }, 202 { "San Fernando", specs+54, N_S, 11, 16, 3, 0 }, 203 { "Argonauta", specs+55, N_S, 10, 14, 4, 0 }, 204 { "San Augustine", specs+56, N_S, 6, 22, 4, 0 }, 205 { "Indomptable", specs+51, N_F, 7, 23, 5, 0 }, 206 { "Desaix", specs+52, N_F, 7, 27, 7, 0 } 207 } 208 }, 209 { 5, 3, 6, 7, "Lake Champlain", 210 { 211 { "Saratoga", specs+60, N_A, 8, 10, 1, 0 }, 212 { "Eagle", specs+61, N_A, 9, 13, 2, 0 }, 213 { "Ticonderoga", specs+62, N_A, 12, 17, 3, 0 }, 214 { "Preble", specs+63, N_A, 14, 20, 2, 0 }, 215 { "Confiance", specs+57, N_B, 4, 70, 6, 0 }, 216 { "Linnet", specs+58, N_B, 7, 68, 6, 0 }, 217 { "Chubb", specs+59, N_B, 10, 65, 6, 0 } 218 } 219 }, 220 { 5, 3, 6, 4, "Last Voyage of the USS President", 221 { 222 { "President", specs+67, N_A, 12, 42, 5, 0 }, 223 { "Endymion", specs+64, N_B, 5, 42, 5, 0 }, 224 { "Pomone", specs+65, N_B, 7, 82, 6, 0 }, 225 { "Tenedos", specs+66, N_B, 7, -1, 4, 0 } 226 } 227 }, 228 { 7, 5, 5, 2, "Hornblower and the Natividad", 229 { 230 { "Lydia", specs+68, N_B, 12, 40, 2, 0 }, 231 { "Natividad", specs+69, N_S, 2, 40, 4, 0 } 232 } 233 }, 234 { 1, 3, 6, 2, "Curse of the Flying Dutchman", 235 { 236 { "Piece of Cake", specs+19, N_S, 7, 40, 2, 0 }, 237 { "Flying Dutchy", specs+71, N_F, 7, 41, 1, 0 } 238 } 239 }, 240 { 1, 4, 1, 4, "The South Pacific", 241 { 242 { "USS Scurvy", specs+70, N_A, 7, 40, 1, 0 }, 243 { "HMS Tahiti", specs+71, N_B, 12, 60, 1, 0 }, 244 { "Australian", specs+18, N_S, 5, 20, 8, 0 }, 245 { "Bikini Atoll", specs+63, N_F, 2, 60, 4, 0 } 246 } 247 }, 248 { 7, 3, 6, 5, "Hornblower and the battle of Rosas bay", 249 { 250 { "Sutherland", specs+5, N_B, 13, 30, 2, 0 }, 251 { "Turenne", specs+10, N_F, 9, 35, 6, 0 }, 252 { "Nightmare", specs+9, N_F, 7, 37, 6, 0 }, 253 { "Paris", specs+53, N_F, 3, 45, 4, 0 }, 254 { "Napoleon", specs+56, N_F, 1, 40, 6, 0 } 255 } 256 }, 257 { 6, 4, 7, 5, "Cape Horn", 258 { 259 { "Concord", specs+51, N_A, 3, 20, 4, 0 }, 260 { "Berkeley", specs+7, N_A, 5, 50, 5, 0 }, 261 { "Thames", specs+71, N_B, 10, 40, 1, 0 }, 262 { "Madrid", specs+53, N_S, 13, 60, 8, 0 }, 263 { "Musket", specs+10, N_F, 10, 60, 7, 0 } 264 } 265 }, 266 { 8, 3, 7, 3, "New Orleans", 267 { 268 { "Alligator", specs+71, N_A, 13, 5, 1, 0 }, 269 { "Firefly", specs+50, N_B, 10, 20, 8, 0 }, 270 { "Cypress", specs+46, N_B, 5, 10, 6, 0 } 271 } 272 }, 273 { 5, 3, 7, 3, "Botany Bay", 274 { 275 { "Shark", specs+11, N_B, 6, 15, 4, 0 }, 276 { "Coral Snake", specs+31, N_F, 3, 30, 6, 0 }, 277 { "Sea Lion", specs+33, N_F, 13, 50, 8, 0 } 278 } 279 }, 280 { 4, 3, 6, 4, "Voyage to the Bottom of the Sea", 281 { 282 { "Seaview", specs+71, N_A, 6, 3, 3, 0 }, 283 { "Flying Sub", specs+64, N_A, 8, 3, 3, 0 }, 284 { "Mermaid", specs+70, N_B, 2, 5, 5, 0 }, 285 { "Giant Squid", specs+53, N_S, 10, 30, 8, 0 } 286 } 287 }, 288 { 7, 3, 6, 3, "Frigate Action", 289 { 290 { "Killdeer", specs+21, N_A, 7, 20, 8, 0 }, 291 { "Sandpiper", specs+27, N_B, 5, 40, 8, 0 }, 292 { "Curlew", specs+34, N_S, 10, 60, 8, 0 } 293 } 294 }, 295 { 7, 2, 5, 6, "The Battle of Midway", 296 { 297 { "Enterprise", specs+49, N_A, 10, 70, 8, 0 }, 298 { "Yorktown", specs+51, N_A, 3, 70, 7, 0 }, 299 { "Hornet", specs+52, N_A, 6, 70, 7, 0 }, 300 { "Akagi", specs+53, N_J, 6, 10, 4, 0 }, 301 { "Kaga", specs+54, N_J, 4, 12, 4, 0 }, 302 { "Soryu", specs+55, N_J, 2, 14, 4, 0 } 303 } 304 }, 305 { 1, 3, 4, 8, "Star Trek", 306 { 307 { "Enterprise", specs+76, N_D,-10, 60, 7, 0 }, 308 { "Yorktown", specs+77, N_D, 0, 70, 7, 0 }, 309 { "Reliant", specs+78, N_D, 10, 70, 7, 0 }, 310 { "Galileo", specs+79, N_D, 20, 60, 7, 0 }, 311 { "Kobayashi Maru", specs+80, N_K, 0,120, 7, 0 }, 312 { "Klingon II", specs+81, N_K, 10,120, 7, 0 }, 313 { "Red Orion", specs+82, N_O, 0, 0, 3, 0 }, 314 { "Blue Orion", specs+83, N_O, 10, 0, 3, 0 } 315 } 316 } 317 }; 318 int nscene = sizeof scene / sizeof (struct scenario); 319 320 struct shipspecs specs[] = { 321 /* bs fs ta guns hull crew1 crew3 gunR carR rig2 rig4 pts */ 322 /* class qual crew2 gunL carL rig1 rig3 */ 323 /*00*/{ 4, 7, 3, 19, 5, 5, 4, 2, 2, 2, 2, 2, 0, 0, 4, 4, 4, 4, 7 }, 324 /*01*/{ 4, 7, 3, 17, 5, 5, 4, 2, 2, 2, 0, 0, 4, 4, 3, 3, 3, 3, 6 }, 325 /*02*/{ 3, 5, 2, 42, 4, 7, 4, 2, 2, 2, 2, 2, 0, 0, 5, 5, 5, -1, 11 }, 326 /*03*/{ 4, 6, 3, 44, 3, 7, 4, 2, 2, 2, 3, 3, 0, 0, 5, 5, 5, 5, 12 }, 327 /*04*/{ 3, 5, 2, 64, 2, 17, 4, 8, 6, 6, 12, 12, 2, 2, 7, 7, 7, -1, 20 }, 328 /*05*/{ 3, 5, 2, 74, 2, 20, 4, 8, 8, 8, 16, 16, 2, 2, 7, 7, 7, -1, 26 }, 329 /*06*/{ 3, 5, 2, 50, 2, 12, 4, 6, 4, 4, 8, 8, 2, 2, 6, 6, 6, -1, 17 }, 330 /*07*/{ 3, 5, 1, 98, 1, 23, 4, 10, 10, 10, 18, 18, 2, 2, 8, 8, 8, -1, 28 }, 331 /*08*/{ 3, 5, 2, 74, 2, 20, 4, 8, 8, 8, 16, 16, 2, 2, 7, 7, 7, -1, 26 }, 332 /*09*/{ 3, 5, 2, 74, 2, 21, 3, 10, 10, 8, 20, 20, 0, 0, 7, 7, 7, -1, 24 }, 333 /*10*/{ 3, 5, 1, 80, 1, 23, 3, 12, 12, 10, 22, 22, 0, 0, 7, 7, 7, -1, 27 }, 334 /*11*/{ 3, 5, 2, 64, 2, 18, 3, 8, 8, 6, 12, 12, 0, 0, 7, 7, 7, -1, 18 }, 335 /*12*/{ 3, 5, 2, 44, 2, 11, 3, 4, 4, 4, 6, 6, 2, 2, 5, 5, 5, -1, 10 }, 336 /*13*/{ 3, 5, 2, 50, 2, 14, 3, 6, 6, 4, 8, 8, 0, 0, 6, 6, 6, -1, 14 }, 337 /*14*/{ 4, 6, 3, 36, 3, 11, 4, 4, 4, 2, 4, 4, 2, 2, 5, 5, 5, 5, 11 }, 338 /*15*/{ 4, 6, 3, 36, 3, 11, 3, 4, 4, 4, 4, 4, 2, 2, 5, 5, 5, 5, 10 }, 339 /*16*/{ 3, 5, 2, 74, 2, 21, 4, 10, 8, 8, 18, 18, 2, 2, 7, 7, 7, -1, 26 }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, 2, 5, 5, 5, 5, 14 }, 370 /*47*/{ 4, 6, 3, 36, 3, 12, 4, 4, 4, 4, 6, 6, 2, 2, 5, 5, 5, 5, 14 }, 371 /*48*/{ 3, 5, 2, 74, 2, 21, 3, 10, 8, 8, 20, 20, 2, 2, 4, 4, 7, -1, 24 }, 372 /*49*/{ 3, 5, 2, 80, 2, 24, 4, 10, 8, 8, 20, 20, 2, 2, 8, 8, 8, -1, 31 }, 373 /*50*/{ 3, 5, 2, 74, 2, 21, 4, 8, 8, 6, 16, 16, 4, 4, 7, 7, 7, -1, 27 }, 374 /*51*/{ 3, 5, 2, 80, 2, 24, 3, 12, 12, 10, 22, 22, 2, 2, 7, 7, 7, -1, 27 }, 375 /*52*/{ 3, 5, 2, 74, 2, 21, 3, 10, 10, 8, 20, 20, 2, 2, 7, 7, 7, -1, 24 }, 376 /*53*/{ 3, 5, 1, 112, 1, 27, 2, 12, 12, 12, 24, 24, 0, 0, 9, 9, 9, -1, 27 }, 377 /*54*/{ 3, 5, 1, 96, 1, 24, 2, 12, 12, 10, 20, 20, 0, 0, 8, 8, 8, -1, 24 }, 378 /*55*/{ 3, 5, 2, 80, 2, 23, 2, 10, 10, 8, 20, 20, 0, 0, 7, 7, 7, -1, 23 }, 379 /*56*/{ 3, 5, 2, 74, 2, 21, 2, 10, 8, 8, 16, 16, 4, 4, 7, 7, 7, -1, 20 }, 380 /*57*/{ 4, 6, 3, 37, 3, 12, 4, 4, 4, 2, 6, 6, 4, 4, 5, 5, 5, 5, 14 }, 381 /*58*/{ 4, 7, 3, 16, 5, 5, 5, 2, 2, 2, 0, 0, 4, 4, 4, 4, 4, 4, 10 }, 382 /*59*/{ 4, 7, 3, 11, 6, 3, 4, 2, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 5 }, 383 /*60*/{ 4, 7, 3, 26, 5, 6, 4, 4, 2, 2, 2, 2, 6, 6, 4, 4, 4, 4, 12 }, 384 /*61*/{ 4, 7, 3, 20, 5, 6, 4, 4, 2, 2, 0, 0, 6, 6, 4, 4, 4, 4, 11 }, 385 /*62*/{ 4, 7, 3, 17, 5, 5, 4, 2, 2, 2, 0, 0, 6, 6, 4, 4, 4, 4, 9 }, 386 /*63*/{ 4, 7, 3, 7, 6, 3, 4, 0, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 4 }, 387 /*64*/{ 4, 6, 3, 40, 3, 15, 4, 4, 4, 4, 8, 8, 6, 6, 5, 5, 5, 5, 17 }, 388 /*65*/{ 4, 6, 3, 44, 3, 15, 4, 8, 8, 6, 10, 10, 2, 2, 6, 6, 6, 6, 20 }, 389 /*66*/{ 4, 6, 3, 38, 3, 14, 4, 4, 4, 4, 6, 6, 6, 6, 5, 5, 5, 5, 15 }, 390 /*67*/{ 4, 5, 3, 44, 3, 18, 5, 8, 6, 6, 8, 8, 8, 8, 6, 6, 6, 6, 24 }, 391 /*68*/{ 4, 6, 3, 36, 3, 9, 5, 4, 4, 2, 4, 4, 2, 2, 5, 5, 5, 5, 13 }, 392 /*69*/{ 3, 5, 2, 50, 2, 14, 2, 6, 6, 6, 8, 8, 0, 0, 6, 6, 6, -1, 14 }, 393 /*70*/{ 3, 5, 1, 136, 1, 30, 1, 8, 14, 14, 28, 28, 0, 0, 9, 9, 9, -1, 27 }, 394 /*71*/{ 3, 5, 1, 120, 1, 27, 5, 16, 14, 14, 28, 28, 2, 2, 9, 9, 9, -1, 43 }, 395 /*72*/{ 3, 5, 1, 120, 2, 21, 5, 15, 17, 15, 25, 25, 7, 7, 9, 9, 9, -1, 36 }, 396 /*73*/{ 3, 5, 1, 90, 3, 18, 4, 13, 15, 13, 20, 20, 6, 6, 5, 5, 5, 5, 28 }, 397 /*74*/{ 4, 7, 3, 6, 6, 3, 4, 2, 2, 2, 20, 20, 6, 6, 2, 2, 3, 3, 5 }, 398 /*75*/{ 3, 5, 1, 110, 2, 20, 4, 14, 15, 11, 26, 26, 8, 8, 7, 8, 9, -1, 34 }, 399 /*76*/{ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75 }, 400 /*77*/{ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75 }, 401 /*78*/{ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75 }, 402 /*79*/{ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75 }, 403 /*80*/{ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75 }, 404 /*81*/{ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75 }, 405 /*82*/{ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75 }, 406 /*83*/{ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75 } 407 /* bs fs ta guns hull crew1 crew3 gunR carR rig2 rig4 pts */ 408 /* class qual crew2 gunL carL rig1 rig3 */ 409 }; 410 411 const struct windeffects WET[7][6] = { 412 { {9,9,9,9}, {9,9,9,9}, {9,9,9,9}, {9,9,9,9}, {9,9,9,9}, {9,9,9,9} }, 413 { {3,2,2,0}, {3,2,1,0}, {3,2,1,0}, {3,2,1,0}, {2,1,0,0}, {2,1,0,0} }, 414 { {1,1,1,0}, {1,1,0,0}, {1,0,0,0}, {1,0,0,0}, {1,0,0,0}, {1,0,0,0} }, 415 { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0} }, 416 { {0,0,0,0}, {1,0,0,0}, {1,1,0,0}, {1,1,0,0}, {2,2,1,0}, {2,2,1,0} }, 417 { {1,0,0,0}, {1,1,0,0}, {1,1,1,0}, {1,1,1,0}, {3,2,2,0}, {3,2,2,0} }, 418 { {2,1,1,0}, {3,2,1,0}, {3,2,1,0}, {3,2,1,0}, {3,3,2,0}, {3,3,2,0} } 419 }; 420 421 const struct Tables RigTable[11][6] = { 422 { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,1}, {0,0,1,0} }, 423 { {0,0,0,0}, {0,0,0,0}, {0,0,0,1}, {0,0,1,0}, {1,0,0,1}, {0,1,1,1} }, 424 { {0,0,0,0}, {0,0,0,1}, {0,0,1,1}, {0,1,0,1}, {0,1,0,1}, {1,0,1,2} }, 425 { {0,0,0,0}, {0,0,1,1}, {0,1,0,1}, {0,0,0,2}, {0,1,0,2}, {1,0,1,2} }, 426 { {0,1,0,1}, {1,0,0,1}, {0,1,1,2}, {0,1,0,2}, {0,0,1,3}, {1,0,1,4} }, 427 { {0,0,1,1}, {0,1,0,2}, {1,0,0,3}, {0,1,1,3}, {1,0,0,4}, {1,1,1,4} }, 428 { {0,0,1,2}, {0,1,1,2}, {1,1,0,3}, {0,1,0,4}, {1,0,0,4}, {1,0,1,5} }, 429 { {0,0,1,2}, {0,1,0,3}, {1,1,0,3}, {1,0,2,4}, {0,2,1,5}, {2,1,0,5} }, 430 { {0,2,1,3}, {1,0,0,3}, {2,1,0,4}, {0,1,1,4}, {0,1,0,5}, {1,0,2,6} }, 431 { {1,1,0,4}, {1,0,1,4}, {2,0,0,5}, {0,2,1,5}, {0,1,2,6}, {0,2,0,7} }, 432 { {1,0,1,5}, {0,2,0,6}, {1,2,0,6}, {1,1,1,6}, {2,0,2,6}, {1,1,2,7} } 433 }; 434 const struct Tables HullTable[11][6] = { 435 { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {1,0,0,0}, {0,1,0,0} }, 436 { {0,0,0,0}, {0,0,0,0}, {0,1,0,0}, {1,1,0,0}, {1,0,1,0}, {1,0,1,1} }, 437 { {0,1,0,0}, {1,0,0,0}, {1,1,0,0}, {1,0,1,0}, {1,0,1,1}, {2,1,0,0} }, 438 { {0,1,1,0}, {1,0,0,0}, {1,1,1,0}, {2,0,0,1}, {2,0,1,0}, {2,2,0,0} }, 439 { {0,1,1,0}, {1,0,0,1}, {2,1,0,1}, {2,2,1,0}, {3,0,1,0}, {3,1,0,0} }, 440 { {1,1,1,0}, {2,0,2,1}, {2,1,1,0}, {2,2,0,0}, {3,1,0,1}, {3,1,1,0} }, 441 { {1,2,2,0}, {2,0,2,1}, {2,1,0,1}, {2,2,0,0}, {3,1,1,0}, {4,2,1,0} }, 442 { {2,1,1,0}, {2,0,1,1}, {3,2,2,0}, {3,2,0,0}, {4,2,1,0}, {4,2,1,1} }, 443 { {2,1,2,0}, {3,1,1,1}, {3,2,2,0}, {4,2,1,0}, {4,1,0,2}, {4,2,2,0} }, 444 { {2,3,1,0}, {3,2,2,0}, {3,2,2,1}, {4,2,2,0}, {4,1,0,3}, {5,1,2,0} }, 445 { {2,2,4,0}, {3,3,1,1}, {4,2,1,1}, {5,1,0,2}, {5,1,2,1}, {6,2,2,0} }, 446 }; 447 448 const char AMMO[9][4] = { 449 { -1, 1, 0, 1 }, 450 { -1, 1, 0, 1 }, 451 { -1, 1, 0, 1 }, 452 { -2, 1, 0, 2 }, 453 { -2, 2, 0, 2 }, 454 { -2, 2, 0, 2 }, 455 { -3, 2, 0, 2 }, 456 { -3, 2, 0, 3 }, 457 { -3, 2, 0, 3 } 458 }; 459 460 const char HDT[9][10] = { 461 { 1, 0,-1,-2,-3,-3,-4,-4,-4,-4 }, 462 { 1, 1, 0,-1,-2,-2,-3,-3,-3,-3 }, 463 { 2, 1, 0,-1,-2,-2,-3,-3,-3,-3 }, 464 { 2, 2, 1, 0,-1,-1,-2,-2,-2,-2 }, 465 { 3, 2, 1, 0,-1,-1,-2,-2,-2,-2 }, 466 { 3, 3, 2, 1, 0, 0,-1,-1,-1,-1 }, 467 { 4, 3, 2, 1, 0, 0,-1,-1,-1,-1 }, 468 { 4, 4, 3, 2, 1, 1, 0, 0, 0, 0 }, 469 { 5, 4, 3, 2, 1, 1, 0, 0, 0, 0 } 470 }; 471 472 const char HDTrake[9][10] = { 473 { 2, 1, 0,-1,-2,-2,-3,-3,-3,-3 }, 474 { 2, 2, 1, 0,-1,-1,-2,-2,-2,-2 }, 475 { 3, 2, 1, 0,-1,-1,-2,-2,-2,-2 }, 476 { 4, 3, 2, 1, 0, 0,-1,-1,-1,-1 }, 477 { 5, 4, 3, 2, 1, 1, 0, 0, 0, 0 }, 478 { 6, 5, 4, 3, 2, 2, 1, 1, 1, 1 }, 479 { 7, 6, 5, 4, 3, 3, 2, 2, 2, 2 }, 480 { 8, 7, 6, 5, 4, 4, 3, 3, 3, 3 }, 481 { 9, 8, 7, 6, 5, 5, 4, 4, 4, 4 } 482 }; 483 484 const char QUAL[9][5] = { 485 { -1, 0, 0, 1, 1 }, 486 { -1, 0, 0, 1, 1 }, 487 { -1, 0, 0, 1, 2 }, 488 { -1, 0, 0, 1, 2 }, 489 { -1, 0, 0, 2, 2 }, 490 { -1,-1, 0, 2, 2 }, 491 { -2,-1, 0, 2, 2 }, 492 { -2,-1, 0, 2, 2 }, 493 { -2,-1, 0, 2, 3 } 494 }; 495 496 const char MT[9][3] = { 497 { 1, 0, 0 }, 498 { 1, 1, 0 }, 499 { 2, 1, 0 }, 500 { 2, 1, 1 }, 501 { 2, 2, 1 }, 502 { 3, 2, 1 }, 503 { 3, 2, 2 }, 504 { 4, 3, 2 }, 505 { 4, 4, 2 } 506 }; 507 508 const char rangeofshot[] = { 509 0, 510 1, /* grape */ 511 3, /* chain */ 512 10, /* round */ 513 1 /* double */ 514 }; 515 516 const char *const countryname[] = { 517 "American", "British", "Spanish", "French", "Japanese", 518 "Federation", "Klingon", "Orion" 519 }; 520 521 const char *const classname[] = { 522 "Drift wood", 523 "Ship of the Line", 524 "Ship of the Line", 525 "Frigate", 526 "Corvette", 527 "Sloop", 528 "Brig" 529 }; 530 531 const char *const directionname[] = { 532 "dead ahead", 533 "off the starboard bow", 534 "off the starboard beam", 535 "off the starboard quarter", 536 "dead astern", 537 "off the port quarter", 538 "off the port beam", 539 "off the port bow", 540 "dead ahead" 541 }; 542 543 const char *const qualname[] = { "dead", "mutinous", "green", "mundane", "crack", "elite" }; 544 545 const char loadname[] = { '-', 'G', 'C', 'R', 'D', 'E' }; 546 547 const char dr[] = { 0, 1, 1, 0, -1, -1, -1, 0, 1 }; 548 const char dc[] = { 0, 0, -1, -1, -1, 0, 1, 1, 1 }; 549 550 int mode; 551 jmp_buf restart; 552 553 int randomize; /* -x, give first available ship */ 554 int longfmt; /* -l, print score in long format */ 555 int nobells; /* -b, don't ring bell before Signal */ 556 557 gid_t gid; 558 gid_t egid; 559 560 struct scenario *cc; /* the current scenario */ 561 struct ship *ls; /* &cc->ship[cc->vessels] */ 562 563 int winddir; 564 int windspeed; 565 int turn; 566 int game; 567 int alive; 568 int people; 569 int hasdriver; 570