]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - trek/shield.c
Fix grammar (bug reported by Thomas Bushnell BSG <tb@MIT.EDU> in
[bsdgames-darwin.git] / trek / shield.c
index 6b5d56fc4bc00d1465265168756bcb0edd35ade0..b49e037acbe3f1b7f27c6ee7e4e0b87b46c1cac6 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: shield.c,v 1.3 1995/04/22 10:59:28 cgd Exp $   */
+/*     $NetBSD: shield.c,v 1.8 2003/08/07 09:37:54 agc 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[] = "@(#)shield.c   8.1 (Berkeley) 5/31/93";
 #else
-static char rcsid[] = "$NetBSD: shield.c,v 1.3 1995/04/22 10:59:28 cgd Exp $";
+__RCSID("$NetBSD: shield.c,v 1.8 2003/08/07 09:37:54 agc Exp $");
 #endif
 #endif /* not lint */
 
-# include      "trek.h"
-# include      "getpar.h"
+#include <stdio.h>
+#include "trek.h"
+#include "getpar.h"
 
 /*
 **  SHIELD AND CLOAKING DEVICE CONTROL
@@ -61,31 +59,33 @@ static char rcsid[] = "$NetBSD: shield.c,v 1.3 1995/04/22 10:59:28 cgd Exp $";
 **     so you get partial hits.
 */
 
-struct cvntab Udtab[] =
+const struct cvntab Udtab[] =
 {
-       "u",            "p",                    (int (*)())1,           0,
-       "d",            "own",                  0,              0,
-       0
+       { "u",          "p",            (cmdfun)1,      0 },
+       { "d",          "own",          (cmdfun)0,      0 },
+       { NULL,         NULL,           NULL,           0 }
 };
 
+void
 shield(f)
 int    f;
 {
-       register int            i;
-       char                    c;
-       struct cvntab           *r;
-       char                    s[100];
-       char                    *device, *dev2, *dev3;
-       int                     ind;
-       char                    *stat;
+       int             i;
+       const struct cvntab     *r;
+       char            s[100];
+       const char      *device, *dev2, *dev3;
+       int             ind;
+       char            *stat;
 
        if (f > 0 && (Ship.shldup || damaged(SRSCAN)))
                return;
        if (f < 0)
        {
                /* cloaking device */
-               if (Ship.ship == QUEENE)
-                       return (printf("Ye Faire Queene does not have the cloaking device.\n"));
+               if (Ship.ship == QUEENE) {
+                       printf("Ye Faire Queene does not have the cloaking device.\n");
+                       return;
+               }
                device = "Cloaking device";
                dev2 = "is";
                ind = CLOAK;
@@ -115,7 +115,7 @@ int f;
        if (f <= 0 && !testnl())
        {
                r = getcodpar("Up or down", Udtab);
-               i = (int) r->value;
+               i = (long) r->value;
        }
        else
        {
@@ -136,11 +136,12 @@ int       f;
                        printf("down\n");
                return;
        }
-       if (i)
+       if (i) {
                if (f >= 0)
                        Ship.energy -= Param.shupengy;
                else
                        Ship.cloakgood = 0;
+       }
        Move.free = 0;
        if (f >= 0)
                Move.shldchg = 1;