summaryrefslogtreecommitdiff
path: root/games/sail/pl_6.c
diff options
context:
space:
mode:
authorPaul Janzen <pjanzen@cvs.openbsd.org>1999-01-18 06:20:55 +0000
committerPaul Janzen <pjanzen@cvs.openbsd.org>1999-01-18 06:20:55 +0000
commit5134b02ec45c91ead7868a5b9f0cea921d296a7c (patch)
tree7a1b1519d35853321a624d35e4df02324a7b4e70 /games/sail/pl_6.c
parent44f356a1eef9aaed32b992d35566e9f7e7d0db8c (diff)
NetBSD merge with additional fixes from jsm28@cam.ac.uk. This game still
needs much more work.
Diffstat (limited to 'games/sail/pl_6.c')
-rw-r--r--games/sail/pl_6.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/games/sail/pl_6.c b/games/sail/pl_6.c
index 03f339bd3ba..932c3793196 100644
--- a/games/sail/pl_6.c
+++ b/games/sail/pl_6.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: pl_6.c,v 1.2 1999/01/18 06:20:53 pjanzen Exp $ */
/* $NetBSD: pl_6.c,v 1.3 1995/04/22 10:37:15 cgd Exp $ */
/*
@@ -37,24 +38,25 @@
#if 0
static char sccsid[] = "@(#)pl_6.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: pl_6.c,v 1.3 1995/04/22 10:37:15 cgd Exp $";
+static char rcsid[] = "$OpenBSD: pl_6.c,v 1.2 1999/01/18 06:20:53 pjanzen Exp $";
#endif
#endif /* not lint */
#include "player.h"
+void
repair()
{
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);
@@ -69,7 +71,7 @@ repair()
repairs = &mf->RR;
break;
default:
- Signal("Avast heaving!", (struct ship *)0);
+ Msg("Avast heaving!");
return;
}
if (++*repairs >= 3) {
@@ -79,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;
}
@@ -88,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);
}
}
@@ -104,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;
@@ -136,9 +138,10 @@ repair()
repaired = 1;
}
+int
turned()
{
- register char *p;
+ char *p;
for (p = movebuf; *p; p++)
if (*p == 'r' || *p == 'l')
@@ -146,13 +149,14 @@ turned()
return 0;
}
+void
loadplayer()
{
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;
@@ -165,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) {
@@ -186,8 +190,7 @@ loadplayer()
ready = 0;
break;
default:
- Signal("Broadside not loaded.",
- (struct ship *)0);
+ Msg("Broadside not loaded.");
return;
}
if (!loadR) {