xref: /original-bsd/games/sail/globals.c (revision 80a2c5b1)
1 #ifndef lint
2 static	char *sccsid = "@(#)globals.c	1.1 83/03/17";
3 #endif
4 #include <stdio.h>
5 
6 #define NUMOFSCENES 32
7 
8 #define BUFSIZE 2024
9 
10 struct snag {
11 	int turnfoul, toship;
12 };
13 
14 struct BP {
15 	int turnsent, toship, mensent;
16 };
17 
18 typedef struct {
19 	int row, col, dir;
20 } postype;
21 postype pos[20];
22 
23 struct File {
24 	char captain[20];
25 	int points;
26 	int loadL, loadR, readyL, readyR;
27 	struct BP OBP[3], DBP[3];
28 	int struck, captured, pcrew;
29 	char last[10];
30 	int drift;
31 	struct snag fouls[10], grapples[10];
32 	char signal[60];
33 	int RH, RG, RR, FS, explode, sink;
34 };
35 
36 typedef struct {
37 	char *shipname;
38 	int shipnum, nationality;
39 	int shiprow, shipcol, shipdir;
40 	struct File *file;
41 } ships;
42 
43 struct scenario {
44 	int winddir, windspeed, windchange;
45 	int turn, people, time, vessels;
46 	char *name;
47 	ships ship[10];
48 };
49 
50 struct scenario scene[NUMOFSCENES] = {
51 	5, 3, 5, 0, 1, 0, 2, "Ranger vs. Drake",
52 	{
53 		{ "Ranger",          0,  0, 7,  20, 4, 0 },
54 		{ "Drake",           1,  1, 7,  31, 5, 0 }
55 	},
56 	1, 3, 6, 0, 1,0, 2, "The Battle of Flamborough Head",
57 	{
58 		{ "Bonhomme Rich",   2,  0, 13, 40, 2, 0 },
59 		{ "Serapis",         3,  1,  2, 42, 2, 0 }
60 	},
61 	5, 5, 5, 0, 1, 0, 10, "Arbuthnot and Des Touches",
62 	{
63 		{ "America",         4,  1,  7, 37, 4, 0 },
64 		{ "Befford",         5,  1,  5, 35, 4, 0 },
65 		{ "Adamant",         6,  1,  3, 33, 4, 0 },
66 		{ "London",          7,  1,  1, 31, 4, 0 },
67 		{ "Royal Oak",       8,  1, -1, 29, 4, 0 },
68 		{ "Neptune",         9,  3,  6, 44, 4, 0 },
69 		{ "Duc Bougogne",    10, 3,  8, 46, 4, 0 },
70 		{ "Conquerant",      48, 3, 10, 48, 4, 0 },
71 		{ "Provence",        11, 3, 12, 50, 4, 0 },
72 		{ "Romulus",         12, 3, 20, 58, 4, 0 }
73 	},
74 	1, 3, 5, 0, 1, 0, 10, "Suffren and Hughes",
75 	{
76 		{ "Monmouth",        52, 1, 9,  45, 2, 0 },
77 		{ "Hero",            5,  1, 13, 49, 2, 0 },
78 		{ "Isis",            6,  1, 12, 48, 2, 0 },
79 		{ "Superb",          50, 1, 10, 46, 2, 0 },
80 		{ "Burford",	   48, 1, 11, 47, 2, 0 },
81 		{ "Flamband",        13, 3, 7,  59, 4, 0 },
82 		{ "Annibal",	    9, 3, 4,  56, 4, 0 },
83 		{ "Severe",          11, 3, 2,  54, 4, 0 },
84 		{ "Brilliant",       49, 3, -1, 51, 4, 0 },
85 		{ "Sphinx",          51, 3, -5, 47, 4, 0 }
86 	},
87 	1, 3, 4, 0, 1, 0, 2, "Nymphe vs. Cleopatre",
88 	{
89 		{ "Nymphe",          14, 1, 13, 30, 2, 0 },
90 		{ "Cleopatre",       15, 3, 3,  41, 2, 0 }
91 	},
92 	1, 3, 5, 0, 1, 0, 2, "Mars vs. Hercule",
93 	{
94 		{ "Mars",            16, 1, 13, 30, 2, 0 },
95 		{ "Hercule",         17, 3, 3,  41, 2, 0 }
96 	},
97 	5, 3, 5, 0, 1, 0, 2, "Ambuscade vs. Baionnaise",
98 	{
99 		{ "Ambuscade",       18, 1, 13, 30, 2, 0 },
100 		{ "Baionnaise",      19, 3, 3,  41, 2, 0 }
101 	},
102 	1, 5, 6, 0, 1, 0, 2, "Constellation vs. Insurgent",
103 	{
104 		{ "Constellation",   20, 0, 9,  50, 8, 0 },
105 		{ "Insurgent",       22, 3, 4,  24, 2, 0 }
106 	},
107 	1, 3, 5, 0, 1, 0, 2, "Constellation vs. Vengeance",
108 	{
109 		{ "Constellation",   20, 0, 12, 40, 2, 0 },
110 		{ "Vengeance",       21, 3, 1,  43, 2, 0 }
111 	},
112 	1, 3, 6, 0, 1, 0, 10, "The Battle of Lissa",
113 	{
114 		{ "Amphion",         23, 1, 8,  50, 4, 0 },
115 		{ "Active",          24, 1, 6,  48, 4, 0 },
116 		{ "Volage",          25, 1, 4,  46, 4, 0 },
117 		{ "Cerberus",        26, 1, 2,  44, 4, 0 },
118 		{ "Favorite",        27, 3, 9,  34, 2, 0 },
119 		{ "Flore",           21, 3, 13, 39, 2, 0 },
120 		{ "Danae",           64, 3, 15, 37, 2, 0 },
121 		{ "Bellona",         28, 3, 17, 35, 2, 0 },
122 		{ "Corona",          29, 3, 12, 31, 2, 0 },
123 		{ "Carolina",        30, 3, 15, 28, 2, 0 }
124 	},
125 	2, 5, 6, 0, 1, 0, 2, "Constitution vs. Guerriere",
126 	{
127 		{ "Constitution",    31, 0, 7,  35, 1, 0 },
128 		{ "Guerriere",       32, 1, 7,  47, 4, 0 }
129 	},
130 	1, 3, 5, 0, 1, 0, 2, "United States vs. Macedonian",
131 	{
132 		{ "United States",   33, 0, 1,  52, 6, 0 },
133 		{ "Macedonian",      34, 1, 14, 40, 1, 0 }
134 	},
135 	1, 3, 6, 0, 1, 0, 2, "Constitution vs. Java",
136 	{
137 		{ "Constitution",    31, 0, 1,  40, 2, 0 },
138 		{ "Java",            35, 1, 11, 40, 2, 0 }
139 	},
140 	1, 3, 5, 0, 1, 0, 2, "Chesapeake vs. Shannon",
141 	{
142 		{ "Chesapeake",      36, 0, 13, 40, 2, 0 },
143 		{ "Shannon",         37, 1, 1,  42, 2, 0 }
144 	},
145 	1, 1, 6, 0, 1, 0, 5, "The Battle of Lake Erie",
146 	{
147 		{ "Lawrence",        38, 0, 4,  55, 8, 0 },
148 		{ "Niagara",         42, 0, 7,  61, 8, 0 },
149 		{ "Lady Prevost",    39, 1, 4,  25, 2, 0,  },
150 		{ "Detroit",         40, 1, 7,  22, 2, 0 },
151 		{ "Q. Charlotte",    41, 1, 10, 19, 2, 0  }
152 	},
153 	1, 1, 5, 0, 1, 0, 2, "Wasp vs. Reindeer",
154 	{
155 		{ "Wasp",            42, 0, 3,  41, 2, 0 },
156 		{ "Reindeer",        43, 1, 10, 48, 2, 0 }
157 	},
158 	1, 2, 5, 0, 1, 0, 3, "Constitution vs. Cyane and Levant",
159 	{
160 		{ "Constitution",    31, 0, 10, 45, 2, 0 },
161 		{ "Cyane",           44, 1, 3,  37, 2, 0 },
162 		{ "Levant",          45, 1, 5,  35, 2, 0 }
163 	},
164 	5, 5, 5, 0, 1, 0, 3, "Pellew vs. Droits de L'Homme",
165 	{
166 		{ "Indefatigable",   46, 1, 12, 45, 6, 0 },
167 		{ "Amazon",          47, 1, 9,  48, 6, 0 },
168 		{ "Droits L'Hom",    48, 3, 3,  28, 5, 0 }
169 	},
170 	2, 2, 3, 0, 1, 0, 10, "Algeciras",
171 	{
172 		{ "Caesar",          49, 1, 7,  70, 6, 0 },
173 		{ "Pompee",          50, 1, 5,  72, 6, 0 },
174 		{ "Spencer",         5,  1, 3,  74, 6, 0 },
175 		{ "Hannibal",        7,  1, 1,  76, 6, 0 },
176 		{ "Real-Carlos",     53, 2, 9,  20, 3, 0 },
177 		{ "San Fernando",    54, 2, 11, 16, 3, 0 },
178 		{ "Argonauta",       55, 2, 10, 14, 4, 0 },
179 		{ "San Augustine",   56, 2, 6,  22, 4, 0 },
180 		{ "Indomptable",     51, 3, 7,  23, 5, 0 },
181 		{ "Desaix",          52, 3, 7,  27, 7, 0 }
182 	},
183 	5, 3, 6, 0, 1, 0, 7, "Lake Champlain",
184 	{
185 		{ "Saratoga",        60, 0, 8,  10, 1, 0 },
186 		{ "Eagle",           61, 0, 9,  13, 2, 0 },
187 		{ "Ticonderoga",     62, 0, 12, 17, 3, 0 },
188 		{ "Preble",          63, 0, 14, 20, 2, 0 },
189 		{ "Confiance",       57, 1, 4,  70, 6, 0 },
190 		{ "Linnet",          58, 1, 7,  68, 6, 0 },
191 		{ "Chubb",           59, 1, 10, 65, 6, 0 }
192 	},
193 	5, 3, 6, 0, 1, 0, 4, "Last Voyage of the USS President",
194 	{
195 		{ "President",       67, 0, 12, 42, 5, 0 },
196 		{ "Endymion",        64, 1, 5,  42, 5, 0 },
197 		{ "Pomone",          65, 1, 7,  82, 6, 0 },
198 		{ "Tenedos",         66, 1, 7,  -1, 4, 0 }
199 	},
200 	7, 5, 5, 0, 1, 0, 2, "Hornblower and the Natividad",
201 	{
202 		{ "Lydia",           68, 1, 12, 40, 2, 0 },
203 		{ "Natividad",       69, 2, 2,  40, 4, 0 }
204 	},
205 	1, 3, 6, 0, 1, 0, 2, "Curse of the Flying Dutchman",
206 	{
207 		{ "Piece of Cake",   19, 2, 7,  40, 2, 0 },
208 		{ "Flying Dutchy",   71, 3, 7,  41, 1, 0 }
209 	},
210 	1, 4, 1, 0, 1, 0, 4, "The South Pacific",
211 	{
212 		{ "USS Scurvy",      70, 0, 7,  40, 1, 0 },
213 		{ "HMS Tahiti",      71, 1, 12, 60, 1, 0 },
214 		{ "Australian",      18, 2, 5,  20, 8, 0 },
215 		{ "Bikini Atoll",    63, 3, 2,  60, 4, 0 }
216 	},
217 	7, 3, 6, 0, 1, 0, 5, "Hornblower and the battle of Rosas bay",
218 	{
219 		{ "Sutherland",      5,  1, 13, 30, 2, 0 },
220 		{ "Turenne",         10, 3, 9,  35, 6, 0 },
221 		{ "Nightmare",       9,  3, 7,  37, 6, 0 },
222 		{ "Paris",           53, 3, 3,  45, 4, 0 },
223 		{ "Napolean",        56, 3, 1,  40, 6, 0 }
224 	},
225 	6, 4, 7, 0, 1, 0, 5, "Cape Horn",
226 	{
227 		{ "Concord",         51, 0, 3,  20, 4, 0 },
228 		{ "Berkeley",        7,  0, 5,  50, 5, 0 },
229 		{ "Thames",          71, 1, 10, 40, 1, 0 },
230 		{ "Madrid",          53, 2, 13, 60, 8, 0 },
231 		{ "Musket",          10, 3, 10, 60, 7, 0 }
232 	},
233 	8, 3, 7, 0, 1, 0, 3, "New Orleans",
234 	{
235 		{ "Alligator",       71, 0, 13,  5, 1, 0 },
236 		{ "Firefly",         50, 1, 10, 20, 8, 0 },
237 		{ "Cypress",         46, 1, 5,  10, 6, 0 }
238 	},
239 	5, 3, 7, 0, 1, 0, 3, "Botany Bay",
240 	{
241 		{ "Shark",           11, 1, 6,  15, 4, 0 },
242 		{ "Coral Snake",     31, 3, 3,  30, 6, 0 },
243 		{ "Sea Lion",        33, 3, 13, 50, 8, 0 }
244 	},
245 	4, 3, 6, 0, 1, 0, 4, "Voyage to the Bottom of the Sea",
246 	{
247 		{ "Seaview",         71, 0, 6,  3,  3, 0 },
248 		{ "Flying Sub",      64, 0, 8,  3,  3, 0 },
249 		{ "Mermaid",         70, 1, 2,  5,  5, 0 },
250 		{ "Giant Squid",     53, 2, 10, 30, 8, 0 }
251 	},
252 	7, 3, 6, 0, 1, 0, 3, "Frigate Action",
253 	{
254 		{ "Killdeer",        21, 0, 7,  20, 8, 0 },
255 		{ "Sandpiper",       27, 1, 5,  40, 8, 0 },
256 		{ "Curlew",          34, 2, 10, 60, 8, 0 }
257 	},
258 	7, 2, 5, 0, 1, 0, 6, "The Battle of Midway",
259 	{
260 		{ "Enterprise",      49, 0, 10, 70, 8, 0 },
261 		{ "Yorktown",        51, 0, 3,  70, 7, 0 },
262 		{ "Hornet",          52, 0, 6,  70, 7, 0 },
263 		{ "Akagi",           53, 3, 6,  10, 4, 0 },
264 		{ "Kaga",            54, 3, 4,  12, 4, 0 },
265 		{ "Soryu",           55, 3, 2,  14, 4, 0 }
266 	},
267 	4, 3, 4, 0, 1, 0, 8, "Star Trek",
268 	{
269 		{ "Enterprise",      72, 0, 20,  4, 2, 0 },
270 		{ "Yorktown",        72, 0, 19,  2, 2, 0 },
271 		{ "Reliant",         73, 0, 18,  3, 2, 0 },
272 		{ "Galileo",         74, 0, 20,  6, 2, 0 },
273 		{ "Kobayashi Maru",  75, 3, 31, 11, 5, 0 },
274 		{ "Klingon two",     75, 3, 31, 11, 5, 0 },
275 		{ "Klingon three",   75, 3, 31, 11, 5, 0 },
276 		{ "Blue Orion",      63, 2, 31, 11, 5, 0 }
277 	}
278 };
279 
280 /* happy */
281 struct shipspecs {
282 	int bs, fs, ta, guns, class, hull, qual, crew1, crew2, crew3, gunL, gunR, carL, carR, rig1, rig2, rig3, rig4, pts;
283 } specs[] = {
284 	4, 7, 3,  19, 5,  5, 4,  2,  2,  2,  2,  2, 0, 0,  4, 4, 4, 4,  7,
285 	4, 7, 3,  17, 5,  5, 4,  2,  2,  2,  0,  0, 4, 4,  3, 3, 3, 3,  6,
286 	3, 5, 2,  42, 4,  7, 4,  2,  2,  2,  2,  2, 0, 0,  5, 5, 5, -1, 11,
287 	4, 6, 3,  44, 3,  7, 4,  2,  2,  2,  3,  3, 0, 0,  5, 5, 5, 5,  12,
288 	3, 5, 2,  64, 2, 17, 4,  8,  6,  6, 12, 12, 2, 2,  7, 7, 7, -1, 20,
289 	3, 5, 2,  74, 2, 20, 4,  8,  8,  8, 16, 16, 2, 2,  7, 7, 7, -1, 26,
290 	3, 5, 2,  50, 2, 12, 4,  6,  4,  4,  8,  8, 2, 2,  6, 6, 6, -1, 17,
291 	3, 5, 1,  98, 1, 23, 4, 10, 10, 10, 18, 18, 2, 2,  8, 8, 8, -1, 28,
292 	3, 5, 2,  74, 2, 20, 4,  8,  8,  8, 16, 16, 2, 2,  7, 7, 7, -1, 26,
293 	3, 5, 2,  74, 2, 21, 3, 10, 10,  8, 20, 20, 0, 0,  7, 7, 7, -1, 24,
294 	3, 5, 1,  80, 1, 23, 3, 12, 12, 10, 22, 22, 0, 0,  7, 7, 7, -1, 27,
295 	3, 5, 2,  64, 2, 18, 3,  8,  8,  6, 12, 12, 0, 0,  7, 7, 7, -1, 18,
296 	3, 5, 2,  44, 2, 11, 3,  4,  4,  4,  6,  6, 2, 2,  5, 5, 5, -1, 10,
297 	3, 5, 2,  50, 2, 14, 3,  6,  6,  4,  8,  8, 0, 0,  6, 6, 6, -1, 14,
298 	4, 6, 3,  36, 3, 11, 4,  4,  4,  2,  4,  4, 2, 2,  5, 5, 5, 5,  11,
299 	4, 6, 3,  36, 3, 11, 3,  4,  4,  4,  4,  4, 2, 2,  5, 5, 5, 5,  10,
300 	3, 5, 2,  74, 2, 21, 4, 10,  8,  8, 18, 18, 2, 2,  7, 7, 7, -1, 26,
301 	3, 5, 2,  74, 2, 21, 3, 10, 10,  8, 20, 20, 2, 2,  7, 7, 7, -1, 23,
302 	4, 6, 3,  32, 3,  8, 3,  4,  2,  2,  4,  4, 2, 2,  5, 5, 5, 5,  9,
303 	4, 6, 3,  24, 4,  6, 3,  4,  4,  4,  2,  2, 0, 0,  4, 4, 4, 4,  9,
304 	4, 7, 3,  38, 4, 14, 5,  6,  4,  4,  4,  4, 6, 6,  5, 5, 5, 5,  17,
305 	4, 6, 3,  40, 3, 15, 3,  8,  6,  6,  6,  6, 4, 4,  5, 5, 5, 5,  15,
306 	4, 7, 3,  36, 4, 11, 3,  6,  6,  4,  4,  4, 2, 2,  5, 5, 5, 5,  11,
307 	4, 6, 3,  32, 3, 11, 5,  4,  4,  2,  4,  4, 2, 2,  5, 5, 5, 5,  13,
308 	4, 6, 3,  38, 3, 14, 5,  4,  4,  4,  6,  6, 4, 4,  5, 5, 5, 5,  18,
309 	4, 6, 3,  22, 3,  6, 5,  2,  2,  2,  0,  0, 8, 8,  4, 4, 4, 4,  11,
310 	4, 6, 3,  32, 3, 11, 5,  4,  4,  2,  4,  4, 2, 2,  5, 5, 5, 5,  13,
311 	4, 6, 3,  40, 3, 14, 3,  6,  6,  4,  6,  6, 4, 4,  5, 5, 5, 5,  15,
312 	4, 6, 3,  32, 3, 11, 2,  4,  4,  4,  4,  4, 0, 0,  5, 5, 5, 5,  9,
313 	4, 6, 3,  40, 3, 14, 2,  6,  6,  4,  6,  6, 4, 4,  5, 5, 5, 5,  12,
314 	4, 6, 3,  32, 3,  8, 2,  4,  4,  1,  2,  2, 0, 0,  4, 4, 4, 4,  7,
315 	4, 7, 3,  44, 4, 18, 5,  6,  6,  6,  8,  8, 6, 6,  6, 6, 6, 6,  24,
316 	4, 6, 3,  38, 3, 14, 4,  4,  4,  2,  6,  6, 4, 4,  5, 5, 5, 5,  15,
317 	4, 5, 3,  44, 3, 18, 5,  8,  6,  6,  8,  8, 8, 8,  6, 6, 6, 6,  24,
318 	4, 6, 3,  38, 3, 14, 4,  4,  4,  4,  6,  6, 4, 4,  5, 5, 5, 5,  16,
319 	4, 7, 3,  38, 4, 14, 4,  6,  6,  6,  6,  6, 6, 6,  5, 5, 5, 5,  19,
320 	4, 6, 3,  38, 3, 14, 3,  6,  6,  4,  6,  6, 6, 6,  5, 5, 5, 5,  14,
321 	4, 6, 3,  38, 3, 14, 5,  6,  4,  4,  6,  6, 6, 6,  5, 5, 5, 5,  17,
322 	4, 7, 3,  20, 5,  6, 4,  4,  2,  2,  0,  0, 6, 6,  4, 4, 4, 4,  9,
323 	4, 7, 3,  13, 6,  3, 4,  0,  2,  2,  0,  0, 2, 2,  2, 2, 2, 2,  5,
324 	4, 7, 3,  19, 5,  5, 4,  2,  2,  2,  2,  2, 0, 0,  4, 4, 4, 4,  7,
325 	4, 7, 3,  17, 5,  5, 4,  2,  2,  2,  2,  2, 0, 0,  3, 3, 3, 3,  6,
326 	4, 7, 3,  20, 5,  6, 5,  4,  2,  2,  0,  0, 6, 6,  4, 4, 4, 4,  12,
327 	4, 7, 3,  18, 5,  5, 5,  2,  2,  2,  0,  0, 6, 6,  4, 4, 4, 4,  9,
328 	4, 7, 3,  24, 5,  6, 4,  4,  2,  2,  0,  0,10,10,  4, 4, 4, 4,  11,
329 	4, 7, 3,  20, 5,  6, 4,  2,  2,  2,  0,  0, 8, 8,  4, 4, 4, 4,  10,
330 	4, 6, 3,  44, 3, 11, 5,  4,  4,  4,  4,  4, 2, 2,  5, 5, 5, 5,  14,
331 	4, 6, 3,  36, 3, 12, 4,  4,  4,  4,  6,  6, 2, 2,  5, 5, 5, 5,  14,
332 	3, 5, 2,  74, 2, 21, 3, 10,  8,  8, 20, 20, 2, 2,  4, 4, 7, -1, 24,
333 	3, 5, 2,  80, 2, 24, 4, 10,  8,  8, 20, 20, 2, 2,  8, 8, 8, -1, 31,
334 	3, 5, 2,  74, 2, 21, 4,  8,  8,  6, 16, 16, 4, 4,  7, 7, 7, -1, 27,
335 	3, 5, 2,  80, 2, 24, 3, 12, 12, 10, 22, 22, 2, 2,  7, 7, 7, -1, 27,
336 	3, 5, 2,  74, 2, 21, 3, 10, 10,  8, 20, 20, 2, 2,  7, 7, 7, -1, 24,
337 	3, 5, 1, 112, 1, 27, 2, 12, 12, 12, 24, 24, 0, 0,  9, 9, 9, -1, 27,
338 	3, 5, 1,  96, 1, 24, 2, 12, 12, 10, 20, 20, 0, 0,  8, 8, 8, -1, 24,
339 	3, 5, 2,  80, 2, 23, 2, 10, 10,  8, 20, 20, 0, 0,  7, 7, 7, -1, 23,
340 	3, 5, 2,  74, 2, 21, 2, 10,  8,  8, 16, 16, 4, 4,  7, 7, 7, -1, 20,
341 	4, 6, 3,  37, 3, 12, 4,  4,  4,  2,  6,  6, 4, 4,  5, 5, 5, 5,  14,
342 	4, 7, 3,  16, 5,  5, 5,  2,  2,  2,  0,  0, 4, 4,  4, 4, 4, 4,  10,
343 	4, 7, 3,  11, 6,  3, 4,  2,  2,  2,  0,  0, 2, 2,  2, 2, 2, 2,  5,
344 	4, 7, 3,  26, 5,  6, 4,  4,  2,  2,  2,  2, 6, 6,  4, 4, 4, 4,  12,
345 	4, 7, 3,  20, 5,  6, 4,  4,  2,  2,  0,  0, 6, 6,  4, 4, 4, 4,  11,
346 	4, 7, 3,  17, 5,  5, 4,  2,  2,  2,  0,  0, 6, 6,  4, 4, 4, 4,  9,
347 	4, 7, 3,   7, 6,  3, 4,  0,  2,  2,  0,  0, 2, 2,  2, 2, 2, 2,  4,
348 	4, 6, 3,  40, 3, 15, 4,  4,  4,  4,  8,  8, 6, 6,  5, 5, 5, 5,  17,
349 	4, 6, 3,  44, 3, 15, 4,  8,  8,  6, 10, 10, 2, 2,  6, 6, 6, 6,  20,
350 	4, 6, 3,  38, 3, 14, 4,  4,  4,  4,  6,  6, 6, 6,  5, 5, 5, 5,  15,
351 	4, 5, 3,  44, 3, 18, 5,  8,  6,  6,  8,  8, 8, 8,  6, 6, 6, 6,  24,
352 	4, 6, 3,  36, 3,  9, 5,  4,  4,  2,  4,  4, 2, 2,  5, 5, 5, 5,  13,
353 	3, 5, 2,  50, 2, 14, 2,  6,  6,  6,  8,  8, 0, 0,  6, 6, 6, -1, 14,
354 	3, 5, 1, 136, 1, 30, 1,  8, 14, 14, 28, 28, 0, 0,  9, 9, 9, -1, 27,
355 	3, 5, 1, 120, 1, 27, 5, 16, 14, 14, 28, 28, 2, 2,  9, 9, 9, -1, 43,
356 /*72*/  3, 5, 1, 120, 2, 21, 5, 15, 17, 15, 25, 25, 7, 7,  9, 9, 9, -1, 36,
357 /*73*/  3, 5, 1,  90, 3, 18, 4, 13, 15, 13, 20, 20, 6, 6,  5, 5, 5,  5, 28,
358 /*74*/  4, 7, 3,   6, 6,  3, 4,  2,  2,  2, 20, 20, 6, 6,  2, 2, 3,  3,  5,
359 /*75*/  3, 5, 1, 110, 2, 20, 4, 14, 15, 11, 26, 26, 8, 8,  7, 8, 9, -1, 34,
360 
361 /*int bs, fs, ta, guns, class, hull, qual, crew1, crew2, crew3, gunL, gunR, carL, carR, rig1, rig2, rig3, rig4, pts*/
362 };
363 
364 struct windeffects {
365 	int A, B, C, D;
366 } WET[7][6] = {
367 	{ {9,9,9,9}, {9,9,9,9}, {9,9,9,9}, {9,9,9,9}, {9,9,9,9}, {9,9,9,9} },
368 	{ {3,2,2,0}, {3,2,1,0}, {3,2,1,0}, {3,2,1,0}, {2,1,0,0}, {2,1,0,0} },
369 	{ {1,1,1,0}, {1,1,0,0}, {1,0,0,0}, {1,0,0,0}, {1,0,0,0}, {1,0,0,0} },
370 	{ {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0} },
371 	{ {0,0,0,0}, {1,0,0,0}, {1,1,0,0}, {1,1,0,0}, {2,2,1,0}, {2,2,1,0} },
372 	{ {1,0,0,0}, {1,1,0,0}, {1,1,1,0}, {1,1,1,0}, {3,2,2,0}, {3,2,2,0} },
373 	{ {2,1,1,0}, {3,2,1,0}, {3,2,1,0}, {3,2,1,0}, {3,3,2,0}, {3,3,2,0} }
374 };
375 struct Tables {
376 	int H, G, C, R;
377 } RigTable[11][6] = {
378 	 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1, 0,0,1,0 ,
379 	 0,0,0,0, 0,0,0,0, 0,0,0,1, 0,0,1,0, 1,0,0,1, 0,1,1,1 ,
380 	 0,0,0,0, 0,0,0,1, 0,0,1,1, 0,1,0,1, 0,1,0,1, 1,0,1,2 ,
381 	 0,0,0,0, 0,0,1,1, 0,1,0,1, 0,0,0,2, 0,1,0,2, 1,0,1,2 ,
382 	 0,1,0,1, 1,0,0,1, 0,1,1,2, 0,1,0,2, 0,0,1,3, 1,0,1,4 ,
383 	 0,0,1,1, 0,1,0,2, 1,0,0,3, 0,1,1,3, 1,0,0,4, 1,1,1,4 ,
384 	 0,0,1,2, 0,1,1,2, 1,1,0,3, 0,1,0,4, 1,0,0,4, 1,0,1,5 ,
385 	 0,0,1,2, 0,1,0,3, 1,1,0,3, 1,0,2,4, 0,2,1,5, 2,1,0,5 ,
386 	 0,2,1,3, 1,0,0,3, 2,1,0,4, 0,1,1,4, 0,1,0,5, 1,0,2,6 ,
387 	 1,1,0,4, 1,0,1,4, 2,0,0,5, 0,2,1,5, 0,1,2,6, 0,2,0,7 ,
388 	 1,0,1,5, 0,2,0,6, 1,2,0,6, 1,1,1,6, 2,0,2,6, 1,1,2,7 ,
389 };
390 struct Tables HullTable[11][6] = {
391 	 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 1,0,0,0, 0,1,0,0 ,
392 	 0,0,0,0, 0,0,0,0, 0,1,0,0, 1,1,0,0, 1,0,1,0, 1,0,1,1 ,
393 	 0,1,0,0, 1,0,0,0, 1,1,0,0, 1,0,1,0, 1,0,1,1, 2,1,0,0 ,
394 	 0,1,1,0, 1,0,0,0, 1,1,1,0, 2,0,0,1, 2,0,1,0, 2,2,0,0 ,
395 	 0,1,1,0, 1,0,0,1, 2,1,0,1, 2,2,1,0, 3,0,1,0, 3,1,0,0 ,
396 	 1,1,1,0, 2,0,2,1, 2,1,1,0, 2,2,0,0, 3,1,0,1, 3,1,1,0 ,
397 	 1,2,2,0, 2,0,2,1, 2,1,0,1, 2,2,0,0, 3,1,1,0, 4,2,1,0 ,
398 	 2,1,1,0, 2,0,1,1, 3,2,2,0, 3,2,0,0, 4,2,1,0, 4,2,1,1 ,
399 	 2,1,2,0, 3,1,1,1, 3,2,2,0, 4,2,1,0, 4,1,0,2, 4,2,2,0 ,
400 	 2,3,1,0, 3,2,2,0, 3,2,2,1, 4,2,2,0, 4,1,0,3, 5,1,2,0 ,
401 	 2,2,4,0, 3,3,1,1, 4,2,1,1, 5,1,0,2, 5,1,2,1, 6,2,2,0 ,
402 };
403 
404 int AMMO[9][4] = {
405 	{-1,1,0,1},
406 	{-1,1,0,1},
407 	{-2,1,0,1},
408 	{-2,1,0,2},
409 	{-3,2,0,2},
410 	{-3,2,0,2},
411 	{-4,2,0,2},
412 	{-4,2,0,3},
413 	{-4,2,0,3}
414 };
415 
416 int HDT[9][10] = {
417 	{1,0,-1,-2,-3,-3,-4,-4,-4,-4},
418 	{1,1,0,-1,-2,-2,-3,-3,-3,-3},
419 	{2,1,0,-1,-2,-2,-3,-3,-3,-3},
420 	{2,2,1,0,-1,-1,-2,-2,-2,-2},
421 	{3,2,1,0,-1,-1,-2,-2,-2,-2},
422 	{3,3,2,1,0,0,-1,-1,-1,-1},
423 	{4,3,2,1,0,0,-1,-1,-1,-1},
424 	{4,4,3,2,1,1,0,0,0,0},
425 	{5,4,3,2,1,1,0,0,0,0}
426 };
427 
428 int HDTrake[9][10] = {
429 	{2,1,0,-1,-2,-2,-3,-3,-3,-3},
430 	{2,2,1,0,-1,-1,-2,-2,-2,-2},
431 	{3,2,1,0,-1,-1,-2,-2,-2,-2},
432 	{4,3,2,1,0,0,-1,-1,-1,-1},
433 	{5,4,3,2,1,1,0,0,0,0},
434 	{6,5,4,3,2,2,1,1,1,1},
435 	{7,6,5,4,3,3,2,2,2,2},
436 	{8,7,6,5,4,4,3,3,3,3},
437 	{9,8,7,6,5,5,4,4,4,4}
438 };
439 
440 int QUAL[9][5] = {
441 	{-1,0,0,1,1},
442 	{-1,0,0,1,1},
443 	{-1,0,0,1,2},
444 	{-1,0,0,1,2},
445 	{-1,0,0,2,2},
446 	{-1,-1,0,2,2},
447 	{-2,-1,0,2,2},
448 	{-2,-1,0,2,2},
449 	{-2,-1,0,2,3}
450 };
451 
452 int MT[9][3] = {
453 	{1,0,0},
454 	{1,1,0},
455 	{2,1,0},
456 	{2,1,1},
457 	{2,2,1},
458 	{3,2,1},
459 	{3,2,2},
460 	{4,3,2},
461 	{4,4,2}
462 };
463 
464 int loaded, fired, changed, repaired, buffercount, xlast, ylast;
465 long lastsync;
466 int winddir, windspeed, turn, viewrow, viewcol;
467 int player = -1, nation[5], scroll = 18, game;
468 int MIGHTYCAPTAIN;
469 char Outbuf[BUFSIZE], movebuf[10], loadwith[20];
470 FILE *syncfile;
471 
472