]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - sail/pl_6.c
include sys/cdefs.h so that __attribute__ can be fixed later
[bsdgames-darwin.git] / sail / pl_6.c
index a3fcc0201b655cfbaa276cc3a1c4a9df0f96d57d..9e204b84eb8571f01c2c766c8298dcb034f566d7 100644 (file)
@@ -1,6 +1,8 @@
+/*     $NetBSD: pl_6.c,v 1.11 2003/08/07 09:37:44 agc Exp $    */
+
 /*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 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
  * 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
-/*static char sccsid[] = "from: @(#)pl_6.c     5.4 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: pl_6.c,v 1.2 1993/08/01 18:51:36 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)pl_6.c     8.1 (Berkeley) 5/31/93";
+#else
+__RCSID("$NetBSD: pl_6.c,v 1.11 2003/08/07 09:37:44 agc Exp $");
+#endif
 #endif /* not lint */
 
+#include <signal.h>
+#include "extern.h"
 #include "player.h"
 
-repair()
+static int     turned(void);
+
+void
+repair(void)
 {
        char c;
-       register char *repairs;
-       register struct shipspecs *ptr = mc;
-       register int count;
+       char *repairs;
+       struct shipspecs *ptr = mc;
+       int count;
 
 #define FIX(x, m) (m - ptr->x > count \
        ? (ptr->x += count, count = 0) : (count -= m - ptr->x, ptr->x = m))
 
        if (repaired || loaded || fired || changed || turned()) {
-               Signal("No hands free to repair", (struct ship *)0);
+               Msg("No hands free to repair");
                return;
        }
        c = sgetch("Repair (hull, guns, rigging)? ", (struct ship *)0, 1);
@@ -64,7 +71,7 @@ repair()
                        repairs = &mf->RR;
                        break;
                default:
-                       Signal("Avast heaving!", (struct ship *)0);
+                       Msg("Avast heaving!");
                        return;
        }
        if (++*repairs >= 3) {
@@ -74,7 +81,7 @@ repair()
                        int max = ptr->guns/4;
                        if (ptr->hull < max) {
                                FIX(hull, max);
-                               Write(W_HULL, ms, 0, ptr->hull, 0, 0, 0);
+                               Write(W_HULL, ms, ptr->hull, 0, 0, 0);
                        }
                        break;
                        }
@@ -83,14 +90,14 @@ repair()
                                int max = ptr->guns/5 - ptr->carL;
                                if (ptr->gunL < max) {
                                        FIX(gunL, max);
-                                       Write(W_GUNL, ms, 0, ptr->gunL,
+                                       Write(W_GUNL, ms, ptr->gunL,
                                                ptr->carL, 0, 0);
                                }
                        } else {
                                int max = ptr->guns/5 - ptr->carR;
                                if (ptr->gunR < max) {
                                        FIX(gunR, max);
-                                       Write(W_GUNR, ms, 0, ptr->gunR,
+                                       Write(W_GUNR, ms, ptr->gunR,
                                                ptr->carR, 0, 0);
                                }
                        }
@@ -99,24 +106,24 @@ repair()
 #define X 2
                        if (ptr->rig4 >= 0 && ptr->rig4 < X) {
                                FIX(rig4, X);
-                               Write(W_RIG4, ms, 0, ptr->rig4, 0, 0, 0);
+                               Write(W_RIG4, ms, ptr->rig4, 0, 0, 0);
                        }
                        if (count && ptr->rig3 < X) {
                                FIX(rig3, X);
-                               Write(W_RIG3, ms, 0, ptr->rig3, 0, 0, 0);
+                               Write(W_RIG3, ms, ptr->rig3, 0, 0, 0);
                        }
                        if (count && ptr->rig2 < X) {
                                FIX(rig2, X);
-                               Write(W_RIG2, ms, 0, ptr->rig2, 0, 0, 0);
+                               Write(W_RIG2, ms, ptr->rig2, 0, 0, 0);
                        }
                        if (count && ptr->rig1 < X) {
                                FIX(rig1, X);
-                               Write(W_RIG1, ms, 0, ptr->rig1, 0, 0, 0);
+                               Write(W_RIG1, ms, ptr->rig1, 0, 0, 0);
                        }
                        break;
                }
                if (count == 2) {
-                       Signal("Repairs completed.", (struct ship *)0);
+                       Msg("Repairs completed.");
                        *repairs = 2;
                } else {
                        *repairs = 0;
@@ -131,9 +138,10 @@ repair()
        repaired = 1;
 }
 
-turned()
+static int
+turned(void)
 {
-       register char *p;
+       char *p;
 
        for (p = movebuf; *p; p++)
                if (*p == 'r' || *p == 'l')
@@ -141,13 +149,14 @@ turned()
        return 0;
 }
 
-loadplayer()
+void
+loadplayer(void)
 {
        char c;
-       register loadL, loadR, ready, load;
+       int loadL, loadR, ready, load;
 
        if (!mc->crew3) {
-               Signal("Out of crew", (struct ship *)0);
+               Msg("Out of crew");
                return;
        }
        loadL = mf->loadL;
@@ -160,7 +169,7 @@ loadplayer()
                else
                        loadR = 1;
        }
-       if (!loadL && loadR || loadL && !loadR) {
+       if ((!loadL && loadR) || (loadL && !loadR)) {
                c = sgetch("Reload with (round, double, chain, grape)? ",
                        (struct ship *)0, 1);
                switch (c) {
@@ -181,8 +190,7 @@ loadplayer()
                        ready = 0;
                        break;
                default:
-                       Signal("Broadside not loaded.",
-                               (struct ship *)0);
+                       Msg("Broadside not loaded.");
                        return;
                }
                if (!loadR) {