]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - trek/torped.c
Add 3 from me.
[bsdgames-darwin.git] / trek / torped.c
index dd11fe223e535c0c22e67ad658ed6761a1fb8cef..d2305ca2c396a0f066ac7da295bbe4a9d71b220d 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: torped.c,v 1.3 1995/04/22 10:59:34 cgd Exp $   */
+/*     $NetBSD: torped.c,v 1.6 2000/07/03 03:57:44 matt Exp $  */
 
 /*
  * Copyright (c) 1980, 1993
  * SUCH DAMAGE.
  */
 
+#include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)torped.c   8.1 (Berkeley) 5/31/93";
 #else
-static char rcsid[] = "$NetBSD: torped.c,v 1.3 1995/04/22 10:59:34 cgd Exp $";
+__RCSID("$NetBSD: torped.c,v 1.6 2000/07/03 03:57:44 matt Exp $");
 #endif
 #endif /* not lint */
 
-# include      <stdio.h>
-# include      "trek.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "trek.h"
+#include "getpar.h"
 
 /*
 **  PHOTON TORPEDO CONTROL
@@ -63,28 +67,34 @@ static char rcsid[] = "$NetBSD: torped.c,v 1.3 1995/04/22 10:59:34 cgd Exp $";
 **     the misfire damages your torpedo tubes.
 */
 
+static int randcourse __P((int));
 
-torped()
+/*ARGSUSED*/
+void
+torped(v)
+       int v __attribute__((__unused__));
 {
-       register int            ix, iy;
-       double                  x, y, dx, dy;
-       double                  angle;
-       int                     course, course2;
-       register int            k;
-       double                  bigger;
-       double                  sectsize;
-       int                     burst;
-       int                     n;
+       int             ix, iy;
+       double          x, y, dx, dy;
+       double          angle;
+       int             course, course2;
+       int             k;
+       double          bigger;
+       double          sectsize;
+       int             burst;
+       int             n;
 
        if (Ship.cloaked)
        {
-               return (printf("Federation regulations do not permit attack while cloaked.\n"));
+               printf("Federation regulations do not permit attack while cloaked.\n");
+               return;
        }
        if (check_out(TORPED))
                return;
        if (Ship.torped <= 0)
        {
-               return (printf("All photon torpedos expended\n"));
+               printf("All photon torpedos expended\n");
+               return;
        }
 
        /* get the course */
@@ -118,8 +128,10 @@ torped()
                burst = getintpar("burst angle");
                if (burst <= 0)
                        return;
-               if (burst > 15)
-                       return (printf("Maximum burst angle is 15 degrees\n"));
+               if (burst > 15) {
+                       printf("Maximum burst angle is 15 degrees\n");
+                       return;
+               }
        }
        sectsize = NSECTS;
        n = -1;
@@ -221,11 +233,12 @@ torped()
 **     to the tubes, etc.
 */
 
+static int
 randcourse(n)
 int    n;
 {
        double                  r;
-       register int            d;
+       int             d;
 
        d = ((franf() + franf()) - 1.0) * 20;
        if (abs(d) > 12)