]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - trek/phaser.c
Fix usage message
[bsdgames-darwin.git] / trek / phaser.c
index b3d4ea3cf29b9acd68809a391088e2d174ac7b41..4fbd784ec4b9ef61de72a378d2fad0d2ca320f5c 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: phaser.c,v 1.3 1995/04/22 10:59:17 cgd Exp $   */
+/*     $NetBSD: phaser.c,v 1.10 2007/12/15 19:44:44 perry Exp $        */
 
 /*
  * Copyright (c) 1980, 1993
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * SUCH DAMAGE.
  */
 
+#include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)phaser.c   8.1 (Berkeley) 5/31/93";
 #else
-static char rcsid[] = "$NetBSD: phaser.c,v 1.3 1995/04/22 10:59:17 cgd Exp $";
+__RCSID("$NetBSD: phaser.c,v 1.10 2007/12/15 19:44:44 perry Exp $");
 #endif
 #endif /* not lint */
 
-# include      "trek.h"
-# include      "getpar.h"
+#include <stdio.h>
+#include <math.h>
+#include "trek.h"
+#include "getpar.h"
 
 /* factors for phaser hits; see description below */
 
@@ -79,9 +78,9 @@ static char rcsid[] = "$NetBSD: phaser.c,v 1.3 1995/04/22 10:59:17 cgd Exp $";
 
 struct cvntab  Matab[] =
 {
-       "m",            "anual",                (int (*)())1,           0,
-       "a",            "utomatic",             0,              0,
-       0
+       { "m",          "anual",        (cmdfun) 1,     0 },
+       { "a",          "utomatic",     (cmdfun) 0,     0 },
+       { NULL,         NULL,           NULL,           0 }
 };
 
 struct banks
@@ -93,28 +92,37 @@ struct banks
 
 
 
-phaser()
+/*ARGSUSED*/
+void
+phaser(v)
+       int v __unused;
 {
-       register int            i;
-       int                     j;
-       register struct kling   *k;
-       double                  dx, dy;
-       double                  anglefactor, distfactor;
-       register struct banks   *b;
-       int                     manual, flag, extra;
-       int                     hit;
-       double                  tot;
-       int                     n;
-       int                     hitreqd[NBANKS];
-       struct banks            bank[NBANKS];
-       struct cvntab           *ptr;
+       int             i;
+       int             j;
+       struct kling    *k;
+       double          dx, dy;
+       double          anglefactor, distfactor;
+       struct banks    *b;
+       int             manual, flag, extra = 0;
+       int             hit;
+       double          tot;
+       int             n;
+       int             hitreqd[NBANKS];
+       struct banks    bank[NBANKS];
+       const struct cvntab     *ptr;
 
-       if (Ship.cond == DOCKED)
-               return(printf("Phasers cannot fire through starbase shields\n"));
-       if (damaged(PHASER))
-               return (out(PHASER));
-       if (Ship.shldup)
-               return (printf("Sulu: Captain, we cannot fire through shields.\n"));
+       if (Ship.cond == DOCKED) {
+               printf("Phasers cannot fire through starbase shields\n");
+               return;
+       }
+       if (damaged(PHASER)) {
+               out(PHASER);
+               return;
+       }
+       if (Ship.shldup) {
+               printf("Sulu: Captain, we cannot fire through shields.\n");
+               return;
+       }
        if (Ship.cloaked)
        {
                printf("Sulu: Captain, surely you must realize that we cannot fire\n");
@@ -128,13 +136,13 @@ phaser()
        {
                if (damaged(COMPUTER))
                {
-                       printf(Device[COMPUTER].name);
+                       printf("%s", Device[COMPUTER].name);
                        manual++;
                }
                else
                        if (damaged(SRSCAN))
                        {
-                               printf(Device[SRSCAN].name);
+                               printf("%s", Device[SRSCAN].name);
                                manual++;
                        }
                if (manual)
@@ -144,7 +152,7 @@ phaser()
        if (!manual)
        {
                ptr = getcodpar("Manual or automatic", Matab);
-               manual = (int) ptr->value;
+               manual = (long) ptr->value;
        }
        if (!manual && damaged(COMPUTER))
        {
@@ -198,8 +206,10 @@ phaser()
        else
        {
                /* automatic distribution of power */
-               if (Etc.nkling <= 0)
-                       return (printf("Sulu: But there are no Klingons in this quadrant\n"));
+               if (Etc.nkling <= 0) {
+                       printf("Sulu: But there are no Klingons in this quadrant\n");
+                       return;
+               }
                printf("Phasers locked on target.  ");
                while (flag)
                {