]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - trek/torped.c
Add 3 from me.
[bsdgames-darwin.git] / trek / torped.c
index 5e42d30968c328cb716df8990bdb1bec7ee24058..d2305ca2c396a0f066ac7da295bbe4a9d71b220d 100644 (file)
@@ -1,6 +1,8 @@
+/*     $NetBSD: torped.c,v 1.6 2000/07/03 03:57:44 matt Exp $  */
+
 /*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * SUCH DAMAGE.
  */
 
+#include <sys/cdefs.h>
 #ifndef lint
-static char sccsid[] = "@(#)torped.c   5.4 (Berkeley) 6/1/90";
+#if 0
+static char sccsid[] = "@(#)torped.c   8.1 (Berkeley) 5/31/93";
+#else
+__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
@@ -57,28 +67,34 @@ static char sccsid[] = "@(#)torped.c        5.4 (Berkeley) 6/1/90";
 **     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 */
@@ -112,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;
@@ -215,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)