summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sail/assorted.c38
-rw-r--r--sail/dr_1.c20
-rw-r--r--sail/dr_2.c15
-rw-r--r--sail/dr_3.c20
-rw-r--r--sail/dr_4.c8
-rw-r--r--sail/dr_5.c8
-rw-r--r--sail/extern.h7
-rw-r--r--sail/parties.c6
-rw-r--r--sail/pl_1.c6
-rw-r--r--sail/pl_3.c8
-rw-r--r--sail/pl_4.c10
-rw-r--r--sail/pl_5.c12
-rw-r--r--sail/pl_6.c18
-rw-r--r--sail/pl_7.c12
-rw-r--r--sail/pl_main.c13
-rw-r--r--sail/sync.c63
16 files changed, 141 insertions, 123 deletions
diff --git a/sail/assorted.c b/sail/assorted.c
index d7074e76..4a4b143f 100644
--- a/sail/assorted.c
+++ b/sail/assorted.c
@@ -1,4 +1,4 @@
-/* $NetBSD: assorted.c,v 1.6 1997/10/13 21:02:57 christos Exp $ */
+/* $NetBSD: assorted.c,v 1.7 1999/02/10 00:45:45 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)assorted.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: assorted.c,v 1.6 1997/10/13 21:02:57 christos Exp $");
+__RCSID("$NetBSD: assorted.c,v 1.7 1999/02/10 00:45:45 hubertf Exp $");
#endif
#endif /* not lint */
@@ -139,17 +139,17 @@ int rig, shot, hittable, roll;
hull -= ghits;
if (Ghit)
Write(portside(from, on, 0) ? W_GUNR : W_GUNL,
- on, 0, guns, car, 0, 0);
+ on, guns, car, 0, 0);
hull -= hhits;
hull = hull < 0 ? 0 : hull;
if (on->file->captured != 0 && Chit)
- Write(W_PCREW, on, 0, pc, 0, 0, 0);
+ Write(W_PCREW, on, pc, 0, 0, 0);
if (Hhit)
- Write(W_HULL, on, 0, hull, 0, 0, 0);
+ Write(W_HULL, on, hull, 0, 0, 0);
if (Chit)
- Write(W_CREW, on, 0, crew[0], crew[1], crew[2], 0);
+ Write(W_CREW, on, crew[0], crew[1], crew[2], 0);
if (Rhit)
- Write(W_RIGG, on, 0, rigg[0], rigg[1], rigg[2], rigg[3]);
+ Write(W_RIGG, on, rigg[0], rigg[1], rigg[2], rigg[3]);
switch (shot) {
case L_ROUND:
message = "firing round shot on $$";
@@ -217,7 +217,7 @@ int rig, shot, hittable, roll;
break;
case 5:
message = "rudder cables shot through";
- Write(W_TA, on, 0, 0, 0, 0, 0);
+ Write(W_TA, on, 0, 0, 0, 0);
break;
case 6:
message = "shot holes below the water line";
@@ -233,10 +233,10 @@ int rig, shot, hittable, roll;
if (on->specs->qual <= 0) {
makemsg(on, "crew mutinying!");
on->specs->qual = 5;
- Write(W_CAPTURED, on, 0, on->file->index, 0, 0, 0);
+ Write(W_CAPTURED, on, on->file->index, 0, 0, 0);
} else
makemsg(on, "crew demoralized");
- Write(W_QUAL, on, 0, on->specs->qual, 0, 0, 0);
+ Write(W_QUAL, on, on->specs->qual, 0, 0, 0);
}
*/
if (!hull)
@@ -249,12 +249,12 @@ struct ship *from, *to;
char all, flag;
{
if (flag & 1) {
- Write(W_UNGRAP, from, 0, to->file->index, all, 0, 0);
- Write(W_UNGRAP, to, 0, from->file->index, all, 0, 0);
+ Write(W_UNGRAP, from, to->file->index, all, 0, 0);
+ Write(W_UNGRAP, to, from->file->index, all, 0, 0);
}
if (flag & 2) {
- Write(W_UNFOUL, from, 0, to->file->index, all, 0, 0);
- Write(W_UNFOUL, to, 0, from->file->index, all, 0, 0);
+ Write(W_UNFOUL, from, to->file->index, all, 0, 0);
+ Write(W_UNFOUL, to, from->file->index, all, 0, 0);
}
if (!snagged2(from, to)) {
if (!snagged(from)) {
@@ -278,20 +278,20 @@ struct ship *ship, *from;
if (ship->file->struck)
return;
- Write(W_STRUCK, ship, 0, 1, 0, 0, 0);
+ Write(W_STRUCK, ship, 1, 0, 0, 0);
points = ship->specs->pts + from->file->points;
- Write(W_POINTS, from, 0, points, 0, 0, 0);
+ Write(W_POINTS, from, points, 0, 0, 0);
unboard(ship, ship, 0); /* all offense */
unboard(ship, ship, 1); /* all defense */
switch (die()) {
case 3:
case 4: /* ship may sink */
- Write(W_SINK, ship, 0, 1, 0, 0, 0);
+ Write(W_SINK, ship, 1, 0, 0, 0);
break;
case 5:
case 6: /* ship may explode */
- Write(W_EXPLODE, ship, 0, 1, 0, 0, 0);
+ Write(W_EXPLODE, ship, 1, 0, 0, 0);
break;
}
- Write(W_SIGNAL, ship, 1, (int) "striking her colours!", 0, 0, 0);
+ Writestr(W_SIGNAL, ship, "striking her colours!");
}
diff --git a/sail/dr_1.c b/sail/dr_1.c
index 5f29c498..f2a5c8a1 100644
--- a/sail/dr_1.c
+++ b/sail/dr_1.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dr_1.c,v 1.7 1998/08/30 09:19:40 veego Exp $ */
+/* $NetBSD: dr_1.c,v 1.8 1999/02/10 00:45:45 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)dr_1.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: dr_1.c,v 1.7 1998/08/30 09:19:40 veego Exp $");
+__RCSID("$NetBSD: dr_1.c,v 1.8 1999/02/10 00:45:45 hubertf Exp $");
#endif
#endif /* not lint */
@@ -192,7 +192,7 @@ int key;
makemsg(from, "boarders from %s repelled", to->shipname);
(void) sprintf(message, "killed in melee: %d. %s: %d",
totalto, from->shipname, totalfrom);
- Write(W_SIGNAL, to, 1, (long) message, 0, 0, 0);
+ Writestr(W_SIGNAL, to, message);
if (key)
return 1;
} else if (strengthto >= fromstrength * 3) {
@@ -201,7 +201,7 @@ int key;
subtract(to, totalto, crewto, tocap, pcto);
if (key) {
if (fromcap != from)
- Write(W_POINTS, fromcap, 0,
+ Write(W_POINTS, fromcap,
fromcap->file->points -
from->file->struck
? from->specs->pts
@@ -212,11 +212,11 @@ int key;
I guess that what is going on here is that the pointer is multiplied
or something. */
- Write(W_CAPTURED, from, 0, to->file->index, 0, 0, 0);
+ Write(W_CAPTURED, from, to->file->index, 0, 0, 0);
topoints = 2 * from->specs->pts + to->file->points;
if (from->file->struck)
topoints -= from->specs->pts;
- Write(W_POINTS, to, 0, topoints, 0, 0, 0);
+ Write(W_POINTS, to, topoints, 0, 0, 0);
mento = crewto[0] ? crewto[0] : crewto[1];
if (mento) {
subtract(to, mento, crewto, tocap, pcto);
@@ -224,10 +224,10 @@ int key;
}
(void) sprintf(message, "captured by the %s!",
to->shipname);
- Write(W_SIGNAL, from, 1, (long) message, 0, 0, 0);
+ Writestr(W_SIGNAL, from, message);
(void) sprintf(message, "killed in melee: %d. %s: %d",
totalto, from->shipname, totalfrom);
- Write(W_SIGNAL, to, 1, (long) message, 0, 0, 0);
+ Writestr(W_SIGNAL, to, message);
mento = 0;
return 0;
}
@@ -434,7 +434,7 @@ next()
}
return -1;
}
- Write(W_TURN, SHIP(0), 0, turn, 0, 0, 0);
+ Write(W_TURN, SHIP(0), turn, 0, 0, 0);
if (turn % 7 == 0 && (die() >= cc->windchange || !windspeed)) {
switch (die()) {
case 1:
@@ -472,7 +472,7 @@ next()
}
else
windspeed++;
- Write(W_WIND, SHIP(0), 0, winddir, windspeed, 0, 0);
+ Write(W_WIND, SHIP(0), winddir, windspeed, 0, 0);
}
return 0;
}
diff --git a/sail/dr_2.c b/sail/dr_2.c
index 17b0693e..53730515 100644
--- a/sail/dr_2.c
+++ b/sail/dr_2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dr_2.c,v 1.8 1998/09/11 14:13:46 hubertf Exp $ */
+/* $NetBSD: dr_2.c,v 1.9 1999/02/10 00:45:45 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)dr_2.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: dr_2.c,v 1.8 1998/09/11 14:13:46 hubertf Exp $");
+__RCSID("$NetBSD: dr_2.c,v 1.9 1999/02/10 00:45:45 hubertf Exp $");
#endif
#endif /* not lint */
@@ -93,8 +93,8 @@ checkup()
continue;
if (die() < 5)
continue;
- Write(sink == 1 ? W_SINK : W_EXPLODE, sp, 0, 2, 0, 0, 0);
- Write(W_DIR, sp, 0, 0, 0, 0, 0);
+ Write(sink == 1 ? W_SINK : W_EXPLODE, sp, 2, 0, 0, 0);
+ Write(W_DIR, sp, 0, 0, 0, 0);
if (snagged(sp))
foreachship(sq)
cleansnag(sp, sq, 1);
@@ -120,10 +120,9 @@ prizecheck()
if (sp->file->struck || sp->file->dir == 0)
continue;
if (sp->specs->crew1 + sp->specs->crew2 + sp->specs->crew3 > sp->file->pcrew * 6) {
- Write(W_SIGNAL, sp, 1,
- (long)"prize crew overthrown", 0, 0, 0);
- Write(W_POINTS, sp->file->captured, 0, sp->file->captured->file->points - 2 * sp->specs->pts, 0, 0, 0);
- Write(W_CAPTURED, sp, 0, -1, 0, 0, 0);
+ Writestr(W_SIGNAL, sp, "prize crew overthrown");
+ Write(W_POINTS, sp->file->captured, sp->file->captured->file->points - 2 * sp->specs->pts, 0, 0, 0);
+ Write(W_CAPTURED, sp, -1, 0, 0, 0);
}
}
}
diff --git a/sail/dr_3.c b/sail/dr_3.c
index 17bf02f4..6c935269 100644
--- a/sail/dr_3.c
+++ b/sail/dr_3.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dr_3.c,v 1.5 1997/10/13 21:03:27 christos Exp $ */
+/* $NetBSD: dr_3.c,v 1.6 1999/02/10 00:45:45 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)dr_3.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: dr_3.c,v 1.5 1997/10/13 21:03:27 christos Exp $");
+__RCSID("$NetBSD: dr_3.c,v 1.6 1999/02/10 00:45:45 hubertf Exp $");
#endif
#endif /* not lint */
@@ -138,8 +138,8 @@ moveall() /* move all comp ships */
if (die() < 4) {
makesignal(sp, "fouled with $$",
sq);
- Write(W_FOUL, sp, 0, l, 0, 0, 0);
- Write(W_FOUL, sq, 0, n, 0, 0, 0);
+ Write(W_FOUL, sp, l, 0, 0, 0);
+ Write(W_FOUL, sq, n, 0, 0, 0);
}
snap++;
}
@@ -170,13 +170,13 @@ moveall() /* move all comp ships */
if (sp->file->dir != 0) {
*sp->file->movebuf = 0;
if (row[n] != sp->file->row)
- Write(W_ROW, sp, 0, sp->file->row, 0, 0, 0);
+ Write(W_ROW, sp, sp->file->row, 0, 0, 0);
if (col[n] != sp->file->col)
- Write(W_COL, sp, 0, sp->file->col, 0, 0, 0);
+ Write(W_COL, sp, sp->file->col, 0, 0, 0);
if (dir[n] != sp->file->dir)
- Write(W_DIR, sp, 0, sp->file->dir, 0, 0, 0);
+ Write(W_DIR, sp, sp->file->dir, 0, 0, 0);
if (drift[n] != sp->file->drift)
- Write(W_DRIFT, sp, 0, sp->file->drift, 0, 0, 0);
+ Write(W_DRIFT, sp, sp->file->drift, 0, 0, 0);
}
n++;
}
@@ -278,7 +278,7 @@ char isdefense;
for (n = 0; n < NBP && bp[n].turnsent; n++)
;
if (n < NBP && sections) {
- Write(isdefense ? W_DBP : W_OBP, from, 0,
+ Write(isdefense ? W_DBP : W_OBP, from,
n, turn, to->file->index, sections);
if (isdefense)
makemsg(from, "repelling boarders");
@@ -355,6 +355,6 @@ checksails()
} else
full = 0;
if ((sp->file->FS != 0) != full)
- Write(W_FS, sp, 0, full, 0, 0, 0);
+ Write(W_FS, sp, full, 0, 0, 0);
}
}
diff --git a/sail/dr_4.c b/sail/dr_4.c
index 4d786dcc..336bdcf5 100644
--- a/sail/dr_4.c
+++ b/sail/dr_4.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dr_4.c,v 1.6 1997/10/13 21:03:37 christos Exp $ */
+/* $NetBSD: dr_4.c,v 1.7 1999/02/10 00:45:45 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)dr_4.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: dr_4.c,v 1.6 1997/10/13 21:03:37 christos Exp $");
+__RCSID("$NetBSD: dr_4.c,v 1.7 1999/02/10 00:45:45 hubertf Exp $");
#endif
#endif /* not lint */
@@ -69,7 +69,7 @@ struct ship *from, *to;
{
if (capship(from)->nationality != capship(to)->nationality && die() > 2)
return;
- Write(W_GRAP, from, 0, to->file->index, 0, 0, 0);
- Write(W_GRAP, to, 0, from->file->index, 0, 0, 0);
+ Write(W_GRAP, from, to->file->index, 0, 0, 0);
+ Write(W_GRAP, to, from->file->index, 0, 0, 0);
makesignal(from, "grappled with $$", to);
}
diff --git a/sail/dr_5.c b/sail/dr_5.c
index 6040b7a9..316a8da4 100644
--- a/sail/dr_5.c
+++ b/sail/dr_5.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dr_5.c,v 1.5 1997/10/13 19:43:47 christos Exp $ */
+/* $NetBSD: dr_5.c,v 1.6 1999/02/10 00:45:45 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)dr_5.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: dr_5.c,v 1.5 1997/10/13 19:43:47 christos Exp $");
+__RCSID("$NetBSD: dr_5.c,v 1.6 1999/02/10 00:45:45 hubertf Exp $");
#endif
#endif /* not lint */
@@ -62,11 +62,11 @@ int totalfrom, crewfrom[3];
totalfrom = 0;
}
}
- Write(W_CREW, from, 0, crewfrom[0], crewfrom[1], crewfrom[2], 0);
+ Write(W_CREW, from, crewfrom[0], crewfrom[1], crewfrom[2], 0);
} else if (totalfrom) {
pcfrom -= totalfrom;
pcfrom = pcfrom < 0 ? 0 : pcfrom;
- Write(W_PCREW, from, 0, pcfrom, 0, 0, 0);
+ Write(W_PCREW, from, pcfrom, 0, 0, 0);
}
}
diff --git a/sail/extern.h b/sail/extern.h
index 935ec48c..73c4dded 100644
--- a/sail/extern.h
+++ b/sail/extern.h
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.8 1998/09/13 15:27:30 hubertf Exp $ */
+/* $NetBSD: extern.h,v 1.9 1999/02/10 00:45:45 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -435,6 +435,7 @@ void makemsg __P((struct ship *, const char *, ...))
int sync_exists __P((int));
int sync_open __P((void));
void sync_close __P((int));
-void Write __P((int, struct ship *, int, long, long, long, long));
+void Write __P((int, struct ship *, long, long, long, long));
+void Writestr __P((int, struct ship *, const char *));
int Sync __P((void));
-int sync_update __P((int, struct ship *, long, long, long, long));
+int sync_update __P((int, struct ship *, const char *, long, long, long, long));
diff --git a/sail/parties.c b/sail/parties.c
index 3db054c3..4e6994c5 100644
--- a/sail/parties.c
+++ b/sail/parties.c
@@ -1,4 +1,4 @@
-/* $NetBSD: parties.c,v 1.5 1997/10/13 19:44:47 christos Exp $ */
+/* $NetBSD: parties.c,v 1.6 1999/02/10 00:45:46 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)parties.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: parties.c,v 1.5 1997/10/13 19:44:47 christos Exp $");
+__RCSID("$NetBSD: parties.c,v 1.6 1999/02/10 00:45:46 hubertf Exp $");
#endif
#endif /* not lint */
@@ -82,5 +82,5 @@ char isdefense;
for (n = 0; n < NBP; p++, n++)
if (p->turnsent && (p->toship == to || isdefense || ship == to))
- Write(isdefense ? W_DBP : W_OBP, ship, 0, n, 0, 0, 0);
+ Write(isdefense ? W_DBP : W_OBP, ship, n, 0, 0, 0);
}
diff --git a/sail/pl_1.c b/sail/pl_1.c
index 2e461805..979d0c56 100644
--- a/sail/pl_1.c
+++ b/sail/pl_1.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl_1.c,v 1.5 1997/10/13 21:04:02 christos Exp $ */
+/* $NetBSD: pl_1.c,v 1.6 1999/02/10 00:45:46 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)pl_1.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pl_1.c,v 1.5 1997/10/13 21:04:02 christos Exp $");
+__RCSID("$NetBSD: pl_1.c,v 1.6 1999/02/10 00:45:46 hubertf Exp $");
#endif
#endif /* not lint */
@@ -109,7 +109,7 @@ int conditions;
if (conditions != LEAVE_SYNC) {
makemsg(ms, "Captain %s relinquishing.",
mf->captain);
- Write(W_END, ms, 0, 0, 0, 0, 0);
+ Write(W_END, ms, 0, 0, 0, 0);
(void) Sync();
}
}
diff --git a/sail/pl_3.c b/sail/pl_3.c
index 0a3bb092..4be189be 100644
--- a/sail/pl_3.c
+++ b/sail/pl_3.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl_3.c,v 1.6 1998/08/30 09:19:40 veego Exp $ */
+/* $NetBSD: pl_3.c,v 1.7 1999/02/10 00:45:46 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)pl_3.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pl_3.c,v 1.6 1998/08/30 09:19:40 veego Exp $");
+__RCSID("$NetBSD: pl_3.c,v 1.7 1999/02/10 00:45:46 hubertf Exp $");
#endif
#endif /* not lint */
@@ -234,8 +234,8 @@ grapungrap()
case 'g':
if (die() < 3
|| ms->nationality == capship(sp)->nationality) {
- Write(W_GRAP, ms, 0, sp->file->index, 0, 0, 0);
- Write(W_GRAP, sp, 0, player, 0, 0, 0);
+ Write(W_GRAP, ms, sp->file->index, 0, 0, 0);
+ Write(W_GRAP, sp, player, 0, 0, 0);
Msg("Attempt succeeds!");
makesignal(ms, "grappled with $$", sp);
} else
diff --git a/sail/pl_4.c b/sail/pl_4.c
index 30719300..163594d7 100644
--- a/sail/pl_4.c
+++ b/sail/pl_4.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl_4.c,v 1.6 1997/10/13 21:04:17 christos Exp $ */
+/* $NetBSD: pl_4.c,v 1.7 1999/02/10 00:45:46 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)pl_4.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pl_4.c,v 1.6 1997/10/13 21:04:17 christos Exp $");
+__RCSID("$NetBSD: pl_4.c,v 1.7 1999/02/10 00:45:46 hubertf Exp $");
#endif
#endif /* not lint */
@@ -58,12 +58,12 @@ changesail()
if (sgetch("Increase to Full sails? ",
(struct ship *)0, 1) == 'y') {
changed = 1;
- Write(W_FS, ms, 0, 1, 0, 0, 0);
+ Write(W_FS, ms, 1, 0, 0, 0);
}
} else {
if (sgetch("Reduce to Battle sails? ",
(struct ship *)0, 1) == 'y') {
- Write(W_FS, ms, 0, 0, 0, 0, 0);
+ Write(W_FS, ms, 0, 0, 0, 0);
changed = 1;
}
}
@@ -83,7 +83,7 @@ acceptsignal()
;
p[-1] = '"';
*p = 0;
- Write(W_SIGNAL, ms, 1, (long)buf, 0, 0, 0);
+ Writestr(W_SIGNAL, ms, buf);
}
void
diff --git a/sail/pl_5.c b/sail/pl_5.c
index 39991ba3..4fd74786 100644
--- a/sail/pl_5.c
+++ b/sail/pl_5.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl_5.c,v 1.6 1997/10/13 21:04:24 christos Exp $ */
+/* $NetBSD: pl_5.c,v 1.7 1999/02/10 00:45:46 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)pl_5.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pl_5.c,v 1.6 1997/10/13 21:04:24 christos Exp $");
+__RCSID("$NetBSD: pl_5.c,v 1.7 1999/02/10 00:45:46 hubertf Exp $");
#endif
#endif /* not lint */
@@ -127,7 +127,7 @@ acceptmove()
Msg("Movement error.");
if (ta < 0 && moved) {
if (mf->FS == 1) {
- Write(W_FS, ms, 0, 0, 0, 0, 0);
+ Write(W_FS, ms, 0, 0, 0, 0);
Msg("No hands to set full sails.");
}
} else if (ma >= 0)
@@ -135,7 +135,7 @@ acceptmove()
}
if (af && !moved) {
if (mf->FS == 1) {
- Write(W_FS, ms, 0, 0, 0, 0, 0);
+ Write(W_FS, ms, 0, 0, 0, 0);
Msg("No hands to set full sails.");
}
}
@@ -143,7 +143,7 @@ acceptmove()
(void) strcpy(movebuf, buf);
else
(void) strcpy(movebuf, "d");
- Write(W_MOVE, ms, 1, (long)movebuf, 0, 0, 0);
+ Writestr(W_MOVE, ms, movebuf);
Msg("Helm: %s.", movebuf);
}
@@ -228,7 +228,7 @@ char buf;
}
if (buf > '0')
Msg("Sending all crew sections.");
- Write(isdefense ? W_DBP : W_OBP, ms, 0,
+ Write(isdefense ? W_DBP : W_OBP, ms,
j, turn, to->file->index, men);
if (isdefense) {
(void) wmove(slot_w, 2, 0);
diff --git a/sail/pl_6.c b/sail/pl_6.c
index e684035d..48902668 100644
--- a/sail/pl_6.c
+++ b/sail/pl_6.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl_6.c,v 1.4 1997/10/13 19:45:33 christos Exp $ */
+/* $NetBSD: pl_6.c,v 1.5 1999/02/10 00:45:46 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)pl_6.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pl_6.c,v 1.4 1997/10/13 19:45:33 christos Exp $");
+__RCSID("$NetBSD: pl_6.c,v 1.5 1999/02/10 00:45:46 hubertf Exp $");
#endif
#endif /* not lint */
@@ -81,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;
}
@@ -90,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);
}
}
@@ -106,19 +106,19 @@ 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;
}
diff --git a/sail/pl_7.c b/sail/pl_7.c
index 0f91a469..3091a521 100644
--- a/sail/pl_7.c
+++ b/sail/pl_7.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl_7.c,v 1.9 1998/08/30 09:19:40 veego Exp $ */
+/* $NetBSD: pl_7.c,v 1.10 1999/02/10 00:45:46 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)pl_7.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pl_7.c,v 1.9 1998/08/30 09:19:40 veego Exp $");
+__RCSID("$NetBSD: pl_7.c,v 1.10 1999/02/10 00:45:46 hubertf Exp $");
#endif
#endif /* not lint */
@@ -113,7 +113,7 @@ newturn(n)
mf->readyR = R_LOADED;
}
if (!hasdriver)
- Write(W_DDEAD, SHIP(0), 0, 0, 0, 0, 0);
+ Write(W_DDEAD, SHIP(0), 0, 0, 0, 0);
if (sc_hasprompt) {
(void) wmove(scroll_w, sc_line, 0);
@@ -127,11 +127,11 @@ newturn(n)
(void) wprintw(scroll_w, "%s%s", sc_prompt, sc_buf);
if (turn % 50 == 0)
- Write(W_ALIVE, SHIP(0), 0, 0, 0, 0, 0);
+ Write(W_ALIVE, SHIP(0), 0, 0, 0, 0);
if (mf->FS && (!mc->rig1 || windspeed == 6))
- Write(W_FS, ms, 0, 0, 0, 0, 0);
+ Write(W_FS, ms, 0, 0, 0, 0);
if (mf->FS == 1)
- Write(W_FS, ms, 0, 2, 0, 0, 0);
+ Write(W_FS, ms, 2, 0, 0, 0);
if (mf->struck)
leave(LEAVE_QUIT);
diff --git a/sail/pl_main.c b/sail/pl_main.c
index 2467951f..64307e8b 100644
--- a/sail/pl_main.c
+++ b/sail/pl_main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl_main.c,v 1.6 1997/10/13 19:45:48 christos Exp $ */
+/* $NetBSD: pl_main.c,v 1.7 1999/02/10 00:45:46 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)pl_main.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pl_main.c,v 1.6 1997/10/13 19:45:48 christos Exp $");
+__RCSID("$NetBSD: pl_main.c,v 1.7 1999/02/10 00:45:46 hubertf Exp $");
#endif
#endif /* not lint */
@@ -181,7 +181,7 @@ reprint:
mf = ms->file;
mc = ms->specs;
- Write(W_BEGIN, ms, 0, 0, 0, 0, 0);
+ Write(W_BEGIN, ms, 0, 0, 0, 0);
if (Sync() < 0)
leave(LEAVE_SYNC);
@@ -214,7 +214,7 @@ reprint:
captain[strlen(captain) - 1] = '\0';
}
captain[sizeof captain - 1] = '\0';
- Write(W_CAPTAIN, ms, 1, (long)captain, 0, 0, 0);
+ Writestr(W_CAPTAIN, ms, captain);
for (n = 0; n < 2; n++) {
char buf[10];
@@ -249,7 +249,8 @@ reprint:
initscreen();
draw_board();
- (void) sprintf(message, "Captain %s assuming command", captain);
- Write(W_SIGNAL, ms, 1, (long)message, 0, 0, 0);
+ (void) snprintf(message, sizeof message, "Captain %s assuming command",
+ captain);
+ Writestr(W_SIGNAL, ms, message);
newturn(0);
}
diff --git a/sail/sync.c b/sail/sync.c
index 7bab0f9a..db9f4834 100644
--- a/sail/sync.c
+++ b/sail/sync.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sync.c,v 1.10 1998/09/11 14:15:46 hubertf Exp $ */
+/* $NetBSD: sync.c,v 1.11 1999/02/10 00:45:46 hubertf Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)sync.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: sync.c,v 1.10 1998/09/11 14:15:46 hubertf Exp $");
+__RCSID("$NetBSD: sync.c,v 1.11 1999/02/10 00:45:46 hubertf Exp $");
#endif
#endif /* not lint */
@@ -121,7 +121,7 @@ makesignal(va_alias)
fmtship(format, sizeof(format), fmt, ship);
(void) vsprintf(message, format, ap);
va_end(ap);
- Write(W_SIGNAL, from, 1, (long)message, 0, 0, 0);
+ Writestr(W_SIGNAL, from, message);
}
void
@@ -146,8 +146,9 @@ makemsg(va_alias)
#endif
(void) vsprintf(message, fmt, ap);
va_end(ap);
- Write(W_SIGNAL, from, 1, (long)message, 0, 0, 0);
+ Writestr(W_SIGNAL, from, message);
}
+
int
sync_exists(game)
int game;
@@ -199,25 +200,37 @@ sync_close(remove)
}
void
-Write(type, ship, isstr, a, b, c, d)
+Write(type, ship, a, b, c, d)
int type;
struct ship *ship;
- int isstr;
long a, b, c, d;
{
- if (isstr)
- (void) sprintf(sync_bp, "%d %d %d %s\n",
- type, ship->file->index, isstr, (char *) a);
- else
- (void) sprintf(sync_bp, "%d %d %d %ld %ld %ld %ld\n",
- type, ship->file->index, isstr, a, b, c, d);
+ (void) sprintf(sync_bp, "%d %d 0 %ld %ld %ld %ld\n",
+ type, ship->file->index, a, b, c, d);
+ while (*sync_bp++)
+ ;
+ sync_bp--;
+ if (sync_bp >= &sync_buf[sizeof sync_buf])
+ abort();
+ (void) sync_update(type, ship, NULL, a, b, c, d);
+}
+
+void
+Writestr(type, ship, a)
+ int type;
+ struct ship *ship;
+ const char *a;
+{
+
+ (void) sprintf(sync_bp, "%d %d 1 %s\n",
+ type, ship->file->index, a);
while (*sync_bp++)
;
sync_bp--;
if (sync_bp >= &sync_buf[sizeof sync_buf])
abort();
- (void) sync_update(type, ship, a, b, c, d);
+ (void) sync_update(type, ship, a, 0, 0, 0, 0);
}
int
@@ -226,6 +239,7 @@ Sync()
sig_t sighup, sigint;
int n;
int type, shipnum, isstr;
+ char *astr;
long a, b, c, d;
char buf[80];
char erred = 0;
@@ -280,19 +294,21 @@ Sync()
*p = 0;
for (p = buf; *p == ' '; p++)
;
- a = (long)p;
- b = c = d = 0;
- } else
+ astr = p;
+ a = b = c = d = 0;
+ } else {
if (fscanf(sync_fp, "%ld%ld%ld%ld", &a, &b, &c, &d) != 4)
goto bad;
- if (sync_update(type, SHIP(shipnum), a, b, c, d) < 0)
+ astr = NULL;
+ }
+ if (sync_update(type, SHIP(shipnum), astr, a, b, c, d) < 0)
goto bad;
}
bad:
erred++;
out:
if (!erred && sync_bp != sync_buf) {
- (void) fseek(sync_fp, 0L, 2);
+ (void) fseek(sync_fp, 0L, SEEK_END);
(void) fwrite(sync_buf, sizeof *sync_buf, sync_bp - sync_buf,
sync_fp);
(void) fflush(sync_fp);
@@ -310,9 +326,10 @@ out:
}
int
-sync_update(type, ship, a, b, c, d)
+sync_update(type, ship, astr, a, b, c, d)
int type;
struct ship *ship;
+ const char *astr;
long a, b, c, d;
{
switch (type) {
@@ -377,9 +394,9 @@ sync_update(type, ship, a, b, c, d)
case W_SIGNAL:
if (mode == MODE_PLAYER) {
if (nobells)
- Signal("$$: %s", ship, (char *) a);
+ Signal("$$: %s", ship, astr);
else
- Signal("\7$$: %s", ship, (char *) a);
+ Signal("\7$$: %s", ship, astr);
}
break;
case W_CREW: {
@@ -390,7 +407,7 @@ sync_update(type, ship, a, b, c, d)
break;
}
case W_CAPTAIN:
- (void) strncpy(ship->file->captain, (char *)a,
+ (void) strncpy(ship->file->captain, astr,
sizeof ship->file->captain - 1);
ship->file->captain[sizeof ship->file->captain - 1] = 0;
break;
@@ -429,7 +446,7 @@ sync_update(type, ship, a, b, c, d)
ship->specs->hull = a;
break;
case W_MOVE:
- (void) strncpy(ship->file->movebuf, (char *)a,
+ (void) strncpy(ship->file->movebuf, astr,
sizeof ship->file->movebuf - 1);
ship->file->movebuf[sizeof ship->file->movebuf - 1] = 0;
break;