]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - sail/pl_6.c
Don't use variables as format string.
[bsdgames-darwin.git] / sail / pl_6.c
index e05204827ed1191417389dbdad4edfd7494c2f83..0a5200664ff70f3d52b4ea33a35b5a3fffbafb64 100644 (file)
@@ -1,6 +1,8 @@
+/*     $NetBSD: pl_6.c,v 1.14 2009/03/15 03:33:56 dholland 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[] = "@(#)pl_6.c     5.4 (Berkeley) 6/1/90";
+#if 0
+static char sccsid[] = "@(#)pl_6.c     8.1 (Berkeley) 5/31/93";
+#else
+__RCSID("$NetBSD: pl_6.c,v 1.14 2009/03/15 03:33:56 dholland 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);
@@ -63,7 +71,7 @@ repair()
                        repairs = &mf->RR;
                        break;
                default:
-                       Signal("Avast heaving!", (struct ship *)0);
+                       Msg("Avast heaving!");
                        return;
        }
        if (++*repairs >= 3) {
@@ -73,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);
+                               send_hull(ms, ptr->hull);
                        }
                        break;
                        }
@@ -82,15 +90,13 @@ repair()
                                int max = ptr->guns/5 - ptr->carL;
                                if (ptr->gunL < max) {
                                        FIX(gunL, max);
-                                       Write(W_GUNL, ms, 0, ptr->gunL,
-                                               ptr->carL, 0, 0);
+                                       send_gunl(ms, ptr->gunL, ptr->carL);
                                }
                        } else {
                                int max = ptr->guns/5 - ptr->carR;
                                if (ptr->gunR < max) {
                                        FIX(gunR, max);
-                                       Write(W_GUNR, ms, 0, ptr->gunR,
-                                               ptr->carR, 0, 0);
+                                       send_gunr(ms, ptr->gunR, ptr->carR);
                                }
                        }
                        break;
@@ -98,41 +104,36 @@ repair()
 #define X 2
                        if (ptr->rig4 >= 0 && ptr->rig4 < X) {
                                FIX(rig4, X);
-                               Write(W_RIG4, ms, 0, ptr->rig4, 0, 0, 0);
+                               send_rig4(ms, ptr->rig4);
                        }
                        if (count && ptr->rig3 < X) {
                                FIX(rig3, X);
-                               Write(W_RIG3, ms, 0, ptr->rig3, 0, 0, 0);
+                               send_rig3(ms, ptr->rig3);
                        }
                        if (count && ptr->rig2 < X) {
                                FIX(rig2, X);
-                               Write(W_RIG2, ms, 0, ptr->rig2, 0, 0, 0);
+                               send_rig2(ms, ptr->rig2);
                        }
                        if (count && ptr->rig1 < X) {
                                FIX(rig1, X);
-                               Write(W_RIG1, ms, 0, ptr->rig1, 0, 0, 0);
+                               send_rig1(ms, ptr->rig1);
                        }
                        break;
                }
                if (count == 2) {
-                       Signal("Repairs completed.", (struct ship *)0);
+                       Msg("Repairs completed.");
                        *repairs = 2;
                } else {
                        *repairs = 0;
-                       blockalarm();
-                       draw_stat();
-                       unblockalarm();
                }
        }
-       blockalarm();
-       draw_slot();
-       unblockalarm();
        repaired = 1;
 }
 
-turned()
+static int
+turned(void)
 {
-       register char *p;
+       char *p;
 
        for (p = movebuf; *p; p++)
                if (*p == 'r' || *p == 'l')
@@ -140,13 +141,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;
@@ -159,7 +161,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) {
@@ -180,8 +182,7 @@ loadplayer()
                        ready = 0;
                        break;
                default:
-                       Signal("Broadside not loaded.",
-                               (struct ship *)0);
+                       Msg("Broadside not loaded.");
                        return;
                }
                if (!loadR) {