Sun May 24 20:43:10 2009 UTC ()
whitespace


(dholland)
diff -r1.10 -r1.11 src/games/trek/torped.c

cvs diff -r1.10 -r1.11 src/games/trek/torped.c (expand / switch to unified diff)

--- src/games/trek/torped.c 2009/05/24 19:18:44 1.10
+++ src/games/trek/torped.c 2009/05/24 20:43:09 1.11
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: torped.c,v 1.10 2009/05/24 19:18:44 dholland Exp $ */ 1/* $NetBSD: torped.c,v 1.11 2009/05/24 20:43:09 dholland Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1980, 1993 4 * Copyright (c) 1980, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#ifndef lint 33#ifndef lint
34#if 0 34#if 0
35static char sccsid[] = "@(#)torped.c 8.1 (Berkeley) 5/31/93"; 35static char sccsid[] = "@(#)torped.c 8.1 (Berkeley) 5/31/93";
36#else 36#else
37__RCSID("$NetBSD: torped.c,v 1.10 2009/05/24 19:18:44 dholland Exp $"); 37__RCSID("$NetBSD: torped.c,v 1.11 2009/05/24 20:43:09 dholland Exp $");
38#endif 38#endif
39#endif /* not lint */ 39#endif /* not lint */
40 40
41#include <stdio.h> 41#include <stdio.h>
42#include <stdlib.h> 42#include <stdlib.h>
43#include <math.h> 43#include <math.h>
44#include "trek.h" 44#include "trek.h"
45#include "getpar.h" 45#include "getpar.h"
46 46
47/* 47/*
48** PHOTON TORPEDO CONTROL 48** PHOTON TORPEDO CONTROL
49** 49**
50** Either one or three photon torpedoes are fired. If three 50** Either one or three photon torpedoes are fired. If three
@@ -160,60 +160,61 @@ torped(int v __unused) @@ -160,60 +160,61 @@ torped(int v __unused)
160 { 160 {
161 ix = x += dx; 161 ix = x += dx;
162 iy = y += dy; 162 iy = y += dy;
163 if (x < 0.0 || x >= sectsize || y < 0.0 || y >= sectsize) 163 if (x < 0.0 || x >= sectsize || y < 0.0 || y >= sectsize)
164 { 164 {
165 printf("Torpedo missed\n"); 165 printf("Torpedo missed\n");
166 break; 166 break;
167 } 167 }
168 printf("%6.1f\t%4.1f\n", x, y); 168 printf("%6.1f\t%4.1f\n", x, y);
169 switch (Sect[ix][iy]) 169 switch (Sect[ix][iy])
170 { 170 {
171 case EMPTY: 171 case EMPTY:
172 continue; 172 continue;
173  173
174 case HOLE: 174 case HOLE:
175 printf("Torpedo disappears into a black hole\n"); 175 printf("Torpedo disappears into a black hole\n");
176 break; 176 break;
177 177
178 case KLINGON: 178 case KLINGON:
179 for (k = 0; k < Etc.nkling; k++) 179 for (k = 0; k < Etc.nkling; k++)
180 { 180 {
181 if (Etc.klingon[k].x != ix || Etc.klingon[k].y != iy) 181 if (Etc.klingon[k].x != ix || Etc.klingon[k].y != iy)
182 continue; 182 continue;
183 Etc.klingon[k].power -= 500 + ranf(501); 183 Etc.klingon[k].power -= 500 + ranf(501);
184 if (Etc.klingon[k].power > 0) 184 if (Etc.klingon[k].power > 0)
185 { 185 {
186 printf("*** Hit on Klingon at %d,%d: extensive damages\n", 186 printf("*** Hit on Klingon at %d,%d: extensive damages\n",
187 ix, iy); 187 ix, iy);
188 break; 188 break;
189 } 189 }
190 killk(ix, iy); 190 killk(ix, iy);
191 break; 191 break;
192 } 192 }
193 break; 193 break;
194  194
195 case STAR: 195 case STAR:
196 nova(ix, iy); 196 nova(ix, iy);
197 break; 197 break;
198  198
199 case INHABIT: 199 case INHABIT:
200 kills(ix, iy, -1); 200 kills(ix, iy, -1);
201 break; 201 break;
202  202
203 case BASE: 203 case BASE:
204 killb(Ship.quadx, Ship.quady); 204 killb(Ship.quadx, Ship.quady);
205 Game.killb += 1; 205 Game.killb += 1;
206 break; 206 break;
 207
207 default: 208 default:
208 printf("Unknown object %c at %d,%d destroyed\n", 209 printf("Unknown object %c at %d,%d destroyed\n",
209 Sect[ix][iy], ix, iy); 210 Sect[ix][iy], ix, iy);
210 Sect[ix][iy] = EMPTY; 211 Sect[ix][iy] = EMPTY;
211 break; 212 break;
212 } 213 }
213 break; 214 break;
214 } 215 }
215 if (damaged(TORPED) || Quad[Ship.quadx][Ship.quady].stars < 0) 216 if (damaged(TORPED) || Quad[Ship.quadx][Ship.quady].stars < 0)
216 break; 217 break;
217 course += burst; 218 course += burst;
218 } 219 }
219 Move.free = 0; 220 Move.free = 0;