diff options
author | christos <christos@NetBSD.org> | 1997-10-13 19:42:53 +0000 |
---|---|---|
committer | christos <christos@NetBSD.org> | 1997-10-13 19:42:53 +0000 |
commit | 7e5c0c57606f0f1e9335aa74ef5ea8c8048a9b2c (patch) | |
tree | e32f911a4774980914f141c9b101745fb106eefe /sail | |
parent | c1a3f2353b38d22d94cbc0101f3115b8e2eefc30 (diff) | |
download | bsdgames-darwin-7e5c0c57606f0f1e9335aa74ef5ea8c8048a9b2c.tar.gz bsdgames-darwin-7e5c0c57606f0f1e9335aa74ef5ea8c8048a9b2c.tar.zst bsdgames-darwin-7e5c0c57606f0f1e9335aa74ef5ea8c8048a9b2c.zip |
Warns fixes:
use varargs properly
use unsigned chars where appropriate
fix typos
eliminate gcc warnings
Diffstat (limited to 'sail')
-rw-r--r-- | sail/Makefile | 3 | ||||
-rw-r--r-- | sail/assorted.c | 29 | ||||
-rw-r--r-- | sail/dr_1.c | 34 | ||||
-rw-r--r-- | sail/dr_2.c | 53 | ||||
-rw-r--r-- | sail/dr_3.c | 57 | ||||
-rw-r--r-- | sail/dr_4.c | 14 | ||||
-rw-r--r-- | sail/dr_5.c | 15 | ||||
-rw-r--r-- | sail/dr_main.c | 12 | ||||
-rw-r--r-- | sail/extern.h | 168 | ||||
-rw-r--r-- | sail/game.c | 17 | ||||
-rw-r--r-- | sail/globals.c | 595 | ||||
-rw-r--r-- | sail/lo_main.c | 6 | ||||
-rw-r--r-- | sail/main.c | 26 | ||||
-rw-r--r-- | sail/misc.c | 49 | ||||
-rw-r--r-- | sail/parties.c | 28 | ||||
-rw-r--r-- | sail/pl_1.c | 34 | ||||
-rw-r--r-- | sail/pl_2.c | 18 | ||||
-rw-r--r-- | sail/pl_3.c | 57 | ||||
-rw-r--r-- | sail/pl_4.c | 29 | ||||
-rw-r--r-- | sail/pl_5.c | 53 | ||||
-rw-r--r-- | sail/pl_6.c | 31 | ||||
-rw-r--r-- | sail/pl_7.c | 109 | ||||
-rw-r--r-- | sail/pl_main.c | 15 | ||||
-rw-r--r-- | sail/sync.c | 127 | ||||
-rw-r--r-- | sail/version.c | 5 |
25 files changed, 979 insertions, 605 deletions
diff --git a/sail/Makefile b/sail/Makefile index 8fa96fce..267a53ea 100644 --- a/sail/Makefile +++ b/sail/Makefile @@ -1,7 +1,6 @@ -# $NetBSD: Makefile,v 1.6 1997/10/12 14:21:50 lukem Exp $ +# $NetBSD: Makefile,v 1.7 1997/10/13 19:42:53 christos Exp $ # @(#)Makefile 8.1 (Berkeley) 5/31/93 -WARNS=0 PROG= sail SRCS= main.c pl_main.c pl_1.c pl_2.c pl_3.c pl_4.c pl_5.c pl_6.c pl_7.c \ dr_main.c dr_1.c dr_2.c dr_3.c dr_4.c dr_5.c lo_main.c \ diff --git a/sail/assorted.c b/sail/assorted.c index 34daf665..a9b8963b 100644 --- a/sail/assorted.c +++ b/sail/assorted.c @@ -1,4 +1,4 @@ -/* $NetBSD: assorted.c,v 1.4 1997/01/07 12:42:14 tls Exp $ */ +/* $NetBSD: assorted.c,v 1.5 1997/10/13 19:43:05 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,25 +33,32 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)assorted.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$NetBSD: assorted.c,v 1.4 1997/01/07 12:42:14 tls Exp $"; +__RCSID("$NetBSD: assorted.c,v 1.5 1997/10/13 19:43:05 christos Exp $"); #endif #endif /* not lint */ #include "extern.h" +#include <stdlib.h> +#include <unistd.h> +#include <err.h> +static void strike __P((struct ship *, struct ship *)); + +void table(rig, shot, hittable, on, from, roll) struct ship *on, *from; int rig, shot, hittable, roll; { - register int hhits = 0, chits = 0, ghits = 0, rhits = 0; + int hhits = 0, chits = 0, ghits = 0, rhits = 0; int Ghit = 0, Hhit = 0, Rhit = 0, Chit = 0; int guns, car, pc, hull; int crew[3]; - register int n; + int n; int rigg[4]; char *message; struct Tables *tp; @@ -158,6 +165,10 @@ int rig, shot, hittable, roll; break; case L_EXPLODE: message = "exploding shot on %s (%c%c)"; + break; + default: + errx(1, "Unknown shot type %d", shot); + } makesignal(from, message, on); if (roll == 6 && rig) { @@ -183,6 +194,8 @@ int rig, shot, hittable, roll; case 7: message = "main topmast and mizzen mast shattered"; break; + default: + errx(1, "Bad Rhit = %d", Rhit); } makesignal(on, message, (struct ship *)0); } else if (roll == 6) { @@ -209,6 +222,8 @@ int rig, shot, hittable, roll; case 6: message = "shot holes below the water line"; break; + default: + errx(1, "Bad Hhit = %d", Hhit); } makesignal(on, message, (struct ship *)0); } @@ -228,8 +243,9 @@ int rig, shot, hittable, roll; strike(on, from); } +void Cleansnag(from, to, all, flag) -register struct ship *from, *to; +struct ship *from, *to; char all, flag; { if (flag & 1) { @@ -254,8 +270,9 @@ char all, flag; } } +static void strike(ship, from) -register struct ship *ship, *from; +struct ship *ship, *from; { int points; diff --git a/sail/dr_1.c b/sail/dr_1.c index de4c8c5f..cbcf9839 100644 --- a/sail/dr_1.c +++ b/sail/dr_1.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_1.c,v 1.4 1995/04/24 12:25:10 cgd Exp $ */ +/* $NetBSD: dr_1.c,v 1.5 1997/10/13 19:43:14 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,22 +33,25 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)dr_1.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: dr_1.c,v 1.4 1995/04/24 12:25:10 cgd Exp $"; +__RCSID("$NetBSD: dr_1.c,v 1.5 1997/10/13 19:43:14 christos Exp $"); #endif #endif /* not lint */ #include "driver.h" +#include <stdlib.h> +void unfoul() { - register struct ship *sp; + struct ship *sp; struct ship *to; - register int nat; - register i; + int nat; + int i; foreachship(sp) { if (sp->file->captain[0]) @@ -65,10 +68,11 @@ unfoul() } } +void boardcomp() { int crew[3]; - register struct ship *sp, *sq; + struct ship *sp, *sq; foreachship(sp) { if (*sp->file->captain) @@ -129,6 +133,7 @@ boardcomp() } } +int fightitout(from, to, key) struct ship *from, *to; int key; @@ -162,7 +167,7 @@ int key; fromstrength = menfrom * fromcap->specs->qual; strengthto = mento * tocap->specs->qual; for (count = 0; - (fromstrength < strengthto * 3 && strengthto < fromstrength * 3 + ((fromstrength < strengthto * 3 && strengthto < fromstrength * 3) || fromstrength == -1) && count < 4; count++) { index = fromstrength/10; @@ -230,10 +235,11 @@ int key; return 0; } +void resolve() { int thwart; - register struct ship *sp, *sq; + struct ship *sp, *sq; foreachship(sp) { if (sp->file->dir == 0) @@ -260,10 +266,11 @@ resolve() } } +void compcombat() { - register n; - register struct ship *sp; + int n; + struct ship *sp; struct ship *closest; int crew[3], men = 0, target, temp; int r, guns, ready, load, car; @@ -389,6 +396,7 @@ compcombat() } } +int next() { if (++turn % 55 == 0) @@ -397,8 +405,8 @@ next() else people = 0; if (people <= 0 || windspeed == 7) { - register struct ship *s; - struct ship *bestship; + struct ship *s; + struct ship *bestship = NULL; float net, best = 0.0; foreachship(s) { if (*s->file->captain) @@ -419,7 +427,7 @@ next() sizeof bestship->file->captain); bestship->file->captain [sizeof bestship->file->captain - 1] = 0; - log(bestship); + logger(bestship); } return -1; } diff --git a/sail/dr_2.c b/sail/dr_2.c index fbe58ba4..d44e8246 100644 --- a/sail/dr_2.c +++ b/sail/dr_2.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_2.c,v 1.4 1995/04/24 12:25:12 cgd Exp $ */ +/* $NetBSD: dr_2.c,v 1.5 1997/10/13 19:43:23 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,21 +33,24 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)dr_2.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: dr_2.c,v 1.4 1995/04/24 12:25:12 cgd Exp $"; +__RCSID("$NetBSD: dr_2.c,v 1.5 1997/10/13 19:43:23 christos Exp $"); #endif #endif /* not lint */ #include "driver.h" +#include <stdlib.h> #define couldwin(f,t) (f->specs->crew2 > t->specs->crew2 * 1.5) +void thinkofgrapples() { - register struct ship *sp, *sq; + struct ship *sp, *sq; char friendly; foreachship(sp) { @@ -75,10 +78,11 @@ thinkofgrapples() } } +void checkup() { - register struct ship *sp, *sq; - register char explode, sink; + struct ship *sp, *sq; + char explode, sink; foreachship(sp) { if (sp->file->dir == 0) @@ -105,9 +109,10 @@ checkup() } } +void prizecheck() { - register struct ship *sp; + struct ship *sp; foreachship(sp) { if (sp->file->captured == 0) @@ -123,18 +128,20 @@ prizecheck() } } +int strend(str) char *str; { - register char *p; + char *p; for (p = str; *p; p++) ; return p == str ? 0 : p[-1]; } +void closeon(from, to, command, ta, ma, af) -register struct ship *from, *to; +struct ship *from, *to; char command[]; int ma, ta, af; { @@ -148,14 +155,15 @@ int ma, ta, af; int dtab[] = {0,1,1,2,3,4,4,5}; /* diagonal distances in x==y */ +int score(movement, ship, to, onlytemp) char movement[]; -register struct ship *ship, *to; +struct ship *ship, *to; char onlytemp; { char drift; int row, col, dir, total, ran; - register struct File *fp = ship->file; + struct File *fp = ship->file; if ((dir = fp->dir) == 0) return 0; @@ -181,12 +189,13 @@ char onlytemp; return total; } +void move(p, ship, dir, row, col, drift) -register char *p; -register struct ship *ship; -register char *dir; -register short *row, *col; -register char *drift; +char *p; +struct ship *ship; +unsigned char *dir; +short *row, *col; +char *drift; { int dist; char moved = 0; @@ -215,7 +224,7 @@ register char *drift; } if (!moved) { if (windspeed != 0 && ++*drift > 2) { - if (ship->specs->class >= 3 && !snagged(ship) + if ((ship->specs->class >= 3 && !snagged(ship)) || (turn & 1) == 0) { *row -= dr[winddir]; *col -= dc[winddir]; @@ -225,12 +234,13 @@ register char *drift; *drift = 0; } +void try(command, temp, ma, ta, af, vma, dir, f, t, high, rakeme) -register struct ship *f, *t; +struct ship *f, *t; int ma, ta, af, *high, rakeme; char command[], temp[]; { - register int new, n; + int new, n; char st[4]; #define rakeyou (gunsbear(f, t) && !gunsbear(t, f)) @@ -247,10 +257,10 @@ char command[], temp[]; dir, f, t, high, rakeme); rmend(temp); } - if (ma > 0 && ta > 0 && (n = strend(temp)) != 'l' && n != 'r' || !strlen(temp)) { + if ((ma > 0 && ta > 0 && (n = strend(temp)) != 'l' && n != 'r') || !strlen(temp)) { (void) strcat(temp, "r"); new = score(temp, f, t, rakeme); - if (new > *high && (!rakeme || gunsbear(f, t) && !gunsbear(t, f))) { + if (new > *high && (!rakeme || (gunsbear(f, t) && !gunsbear(t, f)))) { *high = new; (void) strcpy(command, temp); } @@ -269,10 +279,11 @@ char command[], temp[]; } } +void rmend(str) char *str; { - register char *p; + char *p; for (p = str; *p; p++) ; diff --git a/sail/dr_3.c b/sail/dr_3.c index 389d9e92..8dd6ed28 100644 --- a/sail/dr_3.c +++ b/sail/dr_3.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_3.c,v 1.3 1995/04/22 10:36:49 cgd Exp $ */ +/* $NetBSD: dr_3.c,v 1.4 1997/10/13 19:43:32 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,21 +33,24 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)dr_3.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: dr_3.c,v 1.3 1995/04/22 10:36:49 cgd Exp $"; +__RCSID("$NetBSD: dr_3.c,v 1.4 1997/10/13 19:43:32 christos Exp $"); #endif #endif /* not lint */ #include "driver.h" +#include <stdlib.h> +void moveall() /* move all comp ships */ { - register struct ship *sp, *sq; /* r11, r10 */ - register int n; /* r9 */ - register int k, l; /* r8, r7 */ + struct ship *sp, *sq; + int n; + int k, l; int row[NSHIP], col[NSHIP], dir[NSHIP], drift[NSHIP]; char moved[NSHIP]; @@ -181,10 +184,11 @@ moveall() /* move all comp ships */ } } +int stillmoving(k) -register int k; +int k; { - register struct ship *sp; + struct ship *sp; foreachship(sp) if (sp->file->movebuf[k]) @@ -192,10 +196,11 @@ register int k; return 0; } +int isolated(ship) -register struct ship *ship; +struct ship *ship; { - register struct ship *sp; + struct ship *sp; foreachship(sp) { if (ship != sp && range(ship, sp) <= 10) @@ -204,10 +209,11 @@ register struct ship *ship; return 1; } +int push(from, to) -register struct ship *from, *to; +struct ship *from, *to; { - register int bs, sb; + int bs, sb; sb = to->specs->guns; bs = from->specs->guns; @@ -218,12 +224,13 @@ register struct ship *from, *to; return from < to; } +void step(com, sp, moved) char com; -register struct ship *sp; +struct ship *sp; char *moved; { - register int dist; + int dist; switch (com) { case 'r': @@ -249,7 +256,7 @@ char *moved; case 'd': if (!*moved) { if (windspeed != 0 && ++sp->file->drift > 2 && - (sp->specs->class >= 3 && !snagged(sp) + ((sp->specs->class >= 3 && !snagged(sp)) || (turn & 1) == 0)) { sp->file->row -= dr[winddir]; sp->file->col -= dc[winddir]; @@ -260,13 +267,14 @@ char *moved; } } +void sendbp(from, to, sections, isdefense) -register struct ship *from, *to; +struct ship *from, *to; int sections; char isdefense; { int n; - register struct BP *bp; + struct BP *bp; bp = isdefense ? from->file->DBP : from->file->OBP; for (n = 0; n < NBP && bp[n].turnsent; n++) @@ -282,12 +290,13 @@ char isdefense; } } +int toughmelee(ship, to, isdefense, count) -register struct ship *ship, *to; +struct ship *ship, *to; int isdefense, count; { - register struct BP *bp; - register obp = 0; + struct BP *bp; + int obp = 0; int n, OBP = 0, DBP = 0, dbp = 0; int qual; @@ -314,26 +323,28 @@ int isdefense, count; return 0; } +void reload() { - register struct ship *sp; + struct ship *sp; foreachship(sp) { sp->file->loadwith = 0; } } +void checksails() { - register struct ship *sp; - register int rig, full; + struct ship *sp; + int rig, full; struct ship *close; foreachship(sp) { if (sp->file->captain[0] != 0) continue; rig = sp->specs->rig1; - if (windspeed == 6 || windspeed == 5 && sp->specs->class > 4) + if (windspeed == 6 || (windspeed == 5 && sp->specs->class > 4)) rig = 0; if (rig && sp->specs->crew3) { close = closestenemy(sp, 0, 0); diff --git a/sail/dr_4.c b/sail/dr_4.c index ddf23e5c..fd8b0889 100644 --- a/sail/dr_4.c +++ b/sail/dr_4.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_4.c,v 1.4 1997/01/07 12:42:15 tls Exp $ */ +/* $NetBSD: dr_4.c,v 1.5 1997/10/13 19:43:39 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,20 +33,23 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)dr_4.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$NetBSD: dr_4.c,v 1.4 1997/01/07 12:42:15 tls Exp $"; +__RCSID("$NetBSD: dr_4.c,v 1.5 1997/10/13 19:43:39 christos Exp $"); #endif #endif /* not lint */ #include "extern.h" +#include <stdlib.h> +void ungrap(from, to) -register struct ship *from, *to; +struct ship *from, *to; { - register k; + int k; char friend; if ((k = grappled2(from, to)) == 0) @@ -60,8 +63,9 @@ register struct ship *from, *to; } } +void grap(from, to) -register struct ship *from, *to; +struct ship *from, *to; { if (capship(from)->nationality != capship(to)->nationality && die() > 2) return; diff --git a/sail/dr_5.c b/sail/dr_5.c index 425909f5..6040b7a9 100644 --- a/sail/dr_5.c +++ b/sail/dr_5.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_5.c,v 1.4 1997/01/07 12:42:15 tls Exp $ */ +/* $NetBSD: dr_5.c,v 1.5 1997/10/13 19:43:47 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,22 +33,24 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)dr_5.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$NetBSD: dr_5.c,v 1.4 1997/01/07 12:42:15 tls Exp $"; +__RCSID("$NetBSD: dr_5.c,v 1.5 1997/10/13 19:43:47 christos Exp $"); #endif #endif /* not lint */ #include "extern.h" +void subtract(from, totalfrom, crewfrom, fromcap, pcfrom) struct ship *from, *fromcap; int pcfrom; -register int totalfrom, crewfrom[3]; +int totalfrom, crewfrom[3]; { - register int n; + int n; if (fromcap == from && totalfrom) { /* if not captured */ for (n = 0; n < 3; n++) { @@ -68,15 +70,16 @@ register int totalfrom, crewfrom[3]; } } +int mensent(from, to, crew, captured, pc, isdefense) struct ship *from, *to, **captured; int crew[3], *pc; char isdefense; { /* returns # of crew squares sent */ int men = 0; - register int n; + int n; int c1, c2, c3; - register struct BP *bp; + struct BP *bp; *pc = from->file->pcrew; *captured = from->file->captured; diff --git a/sail/dr_main.c b/sail/dr_main.c index 265bdb32..1d2a36d9 100644 --- a/sail/dr_main.c +++ b/sail/dr_main.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_main.c,v 1.4 1995/04/22 10:36:52 cgd Exp $ */ +/* $NetBSD: dr_main.c,v 1.5 1997/10/13 19:43:54 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,20 +33,24 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)dr_main.c 8.2 (Berkeley) 4/16/94"; #else -static char rcsid[] = "$NetBSD: dr_main.c,v 1.4 1995/04/22 10:36:52 cgd Exp $"; +__RCSID("$NetBSD: dr_main.c,v 1.5 1997/10/13 19:43:54 christos Exp $"); #endif #endif /* not lint */ #include "driver.h" +#include <stdlib.h> +#include <unistd.h> +int dr_main() { - register int n; - register struct ship *sp; + int n; + struct ship *sp; int nat[NNATION]; int value = 0; diff --git a/sail/extern.h b/sail/extern.h index 6774867d..caf7cff3 100644 --- a/sail/extern.h +++ b/sail/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.3 1997/04/19 07:35:33 thorpej Exp $ */ +/* $NetBSD: extern.h,v 1.4 1997/10/13 19:44:01 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -185,10 +185,10 @@ struct File { int index; char captain[20]; /* 0 */ short points; /* 20 */ - char loadL; /* 22 */ - char loadR; /* 24 */ - char readyL; /* 26 */ - char readyR; /* 28 */ + unsigned char loadL; /* 22 */ + unsigned char loadR; /* 24 */ + unsigned char readyL; /* 26 */ + unsigned char readyR; /* 28 */ struct BP OBP[NBP]; /* 30 */ struct BP DBP[NBP]; /* 48 */ char struck; /* 66 */ @@ -206,7 +206,7 @@ struct File { char FS; /* 230 */ char explode; /* 232 */ char sink; /* 234 */ - char dir; + unsigned char dir; short col; short row; char loadwith; @@ -216,7 +216,7 @@ struct File { struct ship { char *shipname; /* 0 */ struct shipspecs *specs; /* 2 */ - char nationality; /* 4 */ + unsigned char nationality; /* 4 */ short shiprow; /* 6 */ short shipcol; /* 8 */ char shipdir; /* 10 */ @@ -227,7 +227,7 @@ struct scenario { char winddir; /* 0 */ char windspeed; /* 2 */ char windchange; /* 4 */ - char vessels; /* 12 */ + unsigned char vessels; /* 12 */ char *name; /* 14 */ struct ship ship[NSHIP]; /* 16 */ }; @@ -239,9 +239,9 @@ struct shipspecs { char fs; char ta; short guns; - char class; + unsigned char class; char hull; - char qual; + unsigned char qual; char crew1; char crew2; char crew3; @@ -298,16 +298,138 @@ int alive; int people; char hasdriver; -char *info(); -char *quality(); -double arctan(); -char *saywhat(); -struct ship *closestenemy(); - -char *calloc(); -char *rindex(); -char *strcpy(); -char *strcat(); -char *strncpy(); -char *getenv(); -char *gets(); +/* assorted.c */ +void table __P((int, int, int, struct ship *, struct ship *, int)); +void Cleansnag __P((struct ship *, struct ship *, int, int)); + +/* dr_1.c */ +void unfoul __P((void)); +void boardcomp __P((void)); +int fightitout __P((struct ship *, struct ship *, int)); +void resolve __P((void)); +void compcombat __P((void)); +int next __P((void)); + +/* dr_2.c */ +void thinkofgrapples __P((void)); +void checkup __P((void)); +void prizecheck __P((void)); +int strend __P((char *)); +void closeon __P((struct ship *, struct ship *, char[], int, int, int)); +int score __P((char[], struct ship *, struct ship *, int)); +void move __P((char *, struct ship *, unsigned char *, short *, short *, char *)); +void try __P((char[], char [], int, int, int, int, int, struct ship *, + struct ship *, int *, int)); +void rmend __P((char *)); + +/* dr_3.c */ +void moveall __P((void)); +int stillmoving __P((int)); +int isolated __P((struct ship *)); +int push __P((struct ship *, struct ship *)); +void step __P((int, struct ship *, char *)); +void sendbp __P((struct ship *, struct ship *, int, int)); +int toughmelee __P((struct ship *, struct ship *, int, int)); +void reload __P((void)); +void checksails __P((void)); + +/* dr_4.c */ +void ungrap __P((struct ship *, struct ship *)); +void grap __P((struct ship *, struct ship *)); + +/* dr_5.c */ +void subtract __P((struct ship *, int, int [3], struct ship *, int)); +int mensent __P((struct ship *, struct ship *, int[3], struct ship **, int *, + int)); + +/* dr_main.c */ +int dr_main __P((void)); + +/* game.c */ +int maxturns __P((struct ship *, char *)); +int maxmove __P((struct ship *, int, int)); + +/* lo_main.c */ +int lo_main __P((void)); + +/* misc.c */ +int range __P((struct ship *, struct ship *)); +struct ship *closestenemy __P((struct ship *, int, int)); +int angle __P((int, int)); +int gunsbear __P((struct ship *, struct ship *)); +int portside __P((struct ship *, struct ship *, int)); +int colours __P((struct ship *)); +void logger __P((struct ship *)); + +/* parties.c */ +int meleeing __P((struct ship *, struct ship *)); +int boarding __P((struct ship *, int)); +void unboard __P((struct ship *, struct ship *, int)); + +/* pl_1.c */ +void leave __P((int)); +void choke __P((int)); +void child __P((int)); + +/* pl_2.c */ +void play __P((void)); + +/* pl_3.c */ +void acceptcombat __P((void)); +void grapungrap __P((void)); +void unfoulplayer __P((void)); + +/* pl_4.c */ +void changesail __P((void)); +void acceptsignal __P((void)); +void lookout __P((void)); +char *saywhat __P((struct ship *, int)); +void eyeball __P((struct ship *)); + +/* pl_5.c */ +void acceptmove __P((void)); +void acceptboard __P((void)); +void parties __P((int[3], struct ship *, int, int)); + +/* pl_6.c */ +void repair __P((void)); +int turned __P((void)); +void loadplayer __P((void)); + +/* pl_7.c */ +void initscreen __P((void)); +void cleanupscreen __P((void)); +void newturn __P((int)); +void Signal __P((const char *, struct ship *, ...)); +void Msg __P((const char *, ...)); +void Scroll __P((void)); +void prompt __P((char *, struct ship *)); +void endprompt __P((int)); +int sgetch __P((char *, struct ship *, int)); +void sgetstr __P((char *, char *, int)); +void draw_screen __P((void)); +void draw_view __P((void)); +void draw_turn __P((void)); +void draw_stat __P((void)); +void draw_slot __P((void)); +void draw_board __P((void)); +void centerview __P((void)); +void upview __P((void)); +void downview __P((void)); +void leftview __P((void)); +void rightview __P((void)); +void adjustview __P((void)); + +/* pl_main.c */ +int pl_main __P((void)); +void initialize __P((void)); + +/* sync.c */ +void fmtship __P((char *, size_t, const char *, struct ship *)); +void makesignal __P((struct ship *, const char *, struct ship *, ...)); +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)); +int Sync __P((void)); +int sync_update __P((int, struct ship *, long, long, long, long)); diff --git a/sail/game.c b/sail/game.c index 7dbe3e56..645c6a4d 100644 --- a/sail/game.c +++ b/sail/game.c @@ -1,4 +1,4 @@ -/* $NetBSD: game.c,v 1.4 1997/01/07 12:42:19 tls Exp $ */ +/* $NetBSD: game.c,v 1.5 1997/10/13 19:44:09 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,24 +33,26 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)game.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$NetBSD: game.c,v 1.4 1997/01/07 12:42:19 tls Exp $"; +__RCSID("$NetBSD: game.c,v 1.5 1997/10/13 19:44:09 christos Exp $"); #endif #endif /* not lint */ #include "extern.h" +int maxturns(ship, af) -register struct ship *ship; +struct ship *ship; char *af; { - register int turns; + int turns; turns = ship->specs->ta; - if (*af = (ship->file->drift > 1 && turns)) { + if ((*af = (ship->file->drift > 1 && turns)) != NULL) { turns--; if (ship->file->FS == 1) turns = 0; @@ -58,11 +60,12 @@ char *af; return turns; } +int maxmove(ship, dir, fs) -register struct ship *ship; +struct ship *ship; int dir, fs; { - register int riggone = 0, Move, flank = 0; + int riggone = 0, Move, flank = 0; Move = ship->specs->bs; if (!ship->specs->rig1) diff --git a/sail/globals.c b/sail/globals.c index 7333e653..01c1415c 100644 --- a/sail/globals.c +++ b/sail/globals.c @@ -1,4 +1,4 @@ -/* $NetBSD: globals.c,v 1.5 1997/01/07 12:42:20 tls Exp $ */ +/* $NetBSD: globals.c,v 1.6 1997/10/13 19:44:17 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,11 +33,12 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)globals.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$NetBSD: globals.c,v 1.5 1997/01/07 12:42:20 tls Exp $"; +__RCSID("$NetBSD: globals.c,v 1.6 1997/10/13 19:44:17 christos Exp $"); #endif #endif /* not lint */ @@ -52,232 +53,264 @@ struct scenario scene[] = { * char *name; * struct ship ship[NSHIP]; */ - 5, 3, 5, 2, "Ranger vs. Drake", - { - { "Ranger", specs+0, N_A, 7, 20, 4, 0 }, - { "Drake", specs+1, N_B, 7, 31, 5, 0 } + { 5, 3, 5, 2, "Ranger vs. Drake", + { + { "Ranger", specs+0, N_A, 7, 20, 4, 0 }, + { "Drake", specs+1, N_B, 7, 31, 5, 0 } + } }, - 1, 3, 6, 2, "The Battle of Flamborough Head", - { - { "Bonhomme Rich", specs+2, N_A, 13, 40, 2, 0 }, - { "Serapis", specs+3, N_B, 2, 42, 2, 0 } + { 1, 3, 6, 2, "The Battle of Flamborough Head", + { + { "Bonhomme Rich", specs+2, N_A, 13, 40, 2, 0 }, + { "Serapis", specs+3, N_B, 2, 42, 2, 0 } + } }, - 5, 5, 5, 10, "Arbuthnot and Des Touches", - { - { "America", specs+4, N_B, 7, 37, 4, 0 }, - { "Befford", specs+5, N_B, 5, 35, 4, 0 }, - { "Adamant", specs+6, N_B, 3, 33, 4, 0 }, - { "London", specs+7, N_B, 1, 31, 4, 0 }, - { "Royal Oak", specs+8, N_B, -1, 29, 4, 0 }, - { "Neptune", specs+9, N_F, 6, 44, 4, 0 }, - { "Duc Bougogne", specs+10, N_F, 8, 46, 4, 0 }, - { "Conquerant", specs+48, N_F, 10, 48, 4, 0 }, - { "Provence", specs+11, N_F, 12, 50, 4, 0 }, - { "Romulus", specs+12, N_F, 20, 58, 4, 0 } + { 5, 5, 5, 10, "Arbuthnot and Des Touches", + { + { "America", specs+4, N_B, 7, 37, 4, 0 }, + { "Befford", specs+5, N_B, 5, 35, 4, 0 }, + { "Adamant", specs+6, N_B, 3, 33, 4, 0 }, + { "London", specs+7, N_B, 1, 31, 4, 0 }, + { "Royal Oak", specs+8, N_B, -1, 29, 4, 0 }, + { "Neptune", specs+9, N_F, 6, 44, 4, 0 }, + { "Duc Bougogne", specs+10, N_F, 8, 46, 4, 0 }, + { "Conquerant", specs+48, N_F, 10, 48, 4, 0 }, + { "Provence", specs+11, N_F, 12, 50, 4, 0 }, + { "Romulus", specs+12, N_F, 20, 58, 4, 0 } + } }, - 1, 3, 5, 10, "Suffren and Hughes", - { - { "Monmouth", specs+52, N_B, 9, 45, 2, 0 }, - { "Hero", specs+5, N_B, 13, 49, 2, 0 }, - { "Isis", specs+6, N_B, 12, 48, 2, 0 }, - { "Superb", specs+50, N_B, 10, 46, 2, 0 }, - { "Burford", specs+48, N_B, 11, 47, 2, 0 }, - { "Flamband", specs+13, N_F, 7, 59, 4, 0 }, - { "Annibal", specs+9, N_F, 4, 56, 4, 0 }, - { "Severe", specs+11, N_F, 2, 54, 4, 0 }, - { "Brilliant", specs+49, N_F, -1, 51, 4, 0 }, - { "Sphinx", specs+51, N_F, -5, 47, 4, 0 } + { 1, 3, 5, 10, "Suffren and Hughes", + { + { "Monmouth", specs+52, N_B, 9, 45, 2, 0 }, + { "Hero", specs+5, N_B, 13, 49, 2, 0 }, + { "Isis", specs+6, N_B, 12, 48, 2, 0 }, + { "Superb", specs+50, N_B, 10, 46, 2, 0 }, + { "Burford", specs+48, N_B, 11, 47, 2, 0 }, + { "Flamband", specs+13, N_F, 7, 59, 4, 0 }, + { "Annibal", specs+9, N_F, 4, 56, 4, 0 }, + { "Severe", specs+11, N_F, 2, 54, 4, 0 }, + { "Brilliant", specs+49, N_F, -1, 51, 4, 0 }, + { "Sphinx", specs+51, N_F, -5, 47, 4, 0 } + } }, - 1, 3, 4, 2, "Nymphe vs. Cleopatre", - { - { "Nymphe", specs+14, N_B, 13, 30, 2, 0 }, - { "Cleopatre", specs+15, N_F, 3, 41, 2, 0 } + { 1, 3, 4, 2, "Nymphe vs. Cleopatre", + { + { "Nymphe", specs+14, N_B, 13, 30, 2, 0 }, + { "Cleopatre", specs+15, N_F, 3, 41, 2, 0 } + } }, - 1, 3, 5, 2, "Mars vs. Hercule", - { - { "Mars", specs+16, N_B, 13, 30, 2, 0 }, - { "Hercule", specs+17, N_F, 3, 41, 2, 0 } + { 1, 3, 5, 2, "Mars vs. Hercule", + { + { "Mars", specs+16, N_B, 13, 30, 2, 0 }, + { "Hercule", specs+17, N_F, 3, 41, 2, 0 } + } }, - 5, 3, 5, 2, "Ambuscade vs. Baionnaise", - { - { "Ambuscade", specs+18, N_B, 13, 30, 2, 0 }, - { "Baionnaise", specs+19, N_F, 3, 41, 2, 0 } + { 5, 3, 5, 2, "Ambuscade vs. Baionnaise", + { + { "Ambuscade", specs+18, N_B, 13, 30, 2, 0 }, + { "Baionnaise", specs+19, N_F, 3, 41, 2, 0 } + } }, - 1, 5, 6, 2, "Constellation vs. Insurgent", - { - { "Constellation", specs+20, N_A, 9, 50, 8, 0 }, - { "Insurgent", specs+22, N_F, 4, 24, 2, 0 } + { 1, 5, 6, 2, "Constellation vs. Insurgent", + { + { "Constellation", specs+20, N_A, 9, 50, 8, 0 }, + { "Insurgent", specs+22, N_F, 4, 24, 2, 0 } + } }, - 1, 3, 5, 2, "Constellation vs. Vengeance", - { - { "Constellation", specs+20, N_A, 12, 40, 2, 0 }, - { "Vengeance", specs+21, N_F, 1, 43, 2, 0 } + { 1, 3, 5, 2, "Constellation vs. Vengeance", + { + { "Constellation", specs+20, N_A, 12, 40, 2, 0 }, + { "Vengeance", specs+21, N_F, 1, 43, 2, 0 } + } }, - 1, 3, 6, 10, "The Battle of Lissa", - { - { "Amphion", specs+23, N_B, 8, 50, 4, 0 }, - { "Active", specs+24, N_B, 6, 48, 4, 0 }, - { "Volage", specs+25, N_B, 4, 46, 4, 0 }, - { "Cerberus", specs+26, N_B, 2, 44, 4, 0 }, - { "Favorite", specs+27, N_F, 9, 34, 2, 0 }, - { "Flore", specs+21, N_F, 13, 39, 2, 0 }, - { "Danae", specs+64, N_F, 15, 37, 2, 0 }, - { "Bellona", specs+28, N_F, 17, 35, 2, 0 }, - { "Corona", specs+29, N_F, 12, 31, 2, 0 }, - { "Carolina", specs+30, N_F, 15, 28, 2, 0 } + { 1, 3, 6, 10, "The Battle of Lissa", + { + { "Amphion", specs+23, N_B, 8, 50, 4, 0 }, + { "Active", specs+24, N_B, 6, 48, 4, 0 }, + { "Volage", specs+25, N_B, 4, 46, 4, 0 }, + { "Cerberus", specs+26, N_B, 2, 44, 4, 0 }, + { "Favorite", specs+27, N_F, 9, 34, 2, 0 }, + { "Flore", specs+21, N_F, 13, 39, 2, 0 }, + { "Danae", specs+64, N_F, 15, 37, 2, 0 }, + { "Bellona", specs+28, N_F, 17, 35, 2, 0 }, + { "Corona", specs+29, N_F, 12, 31, 2, 0 }, + { "Carolina", specs+30, N_F, 15, 28, 2, 0 } + } }, - 2, 5, 6, 2, "Constitution vs. Guerriere", - { - { "Constitution", specs+31, N_A, 7, 35, 1, 0 }, - { "Guerriere", specs+32, N_B, 7, 47, 4, 0 } + { 2, 5, 6, 2, "Constitution vs. Guerriere", + { + { "Constitution", specs+31, N_A, 7, 35, 1, 0 }, + { "Guerriere", specs+32, N_B, 7, 47, 4, 0 } + } }, - 1, 3, 5, 2, "United States vs. Macedonian", - { - { "United States", specs+33, N_A, 1, 52, 6, 0 }, - { "Macedonian", specs+34, N_B, 14, 40, 1, 0 } + { 1, 3, 5, 2, "United States vs. Macedonian", + { + { "United States", specs+33, N_A, 1, 52, 6, 0 }, + { "Macedonian", specs+34, N_B, 14, 40, 1, 0 } + } }, - 1, 3, 6, 2, "Constitution vs. Java", - { - { "Constitution", specs+31, N_A, 1, 40, 2, 0 }, - { "Java", specs+35, N_B, 11, 40, 2, 0 } + { 1, 3, 6, 2, "Constitution vs. Java", + { + { "Constitution", specs+31, N_A, 1, 40, 2, 0 }, + { "Java", specs+35, N_B, 11, 40, 2, 0 } + } }, - 1, 3, 5, 2, "Chesapeake vs. Shannon", - { - { "Chesapeake", specs+36, N_A, 13, 40, 2, 0 }, - { "Shannon", specs+37, N_B, 1, 42, 2, 0 } + { 1, 3, 5, 2, "Chesapeake vs. Shannon", + { + { "Chesapeake", specs+36, N_A, 13, 40, 2, 0 }, + { "Shannon", specs+37, N_B, 1, 42, 2, 0 } + } }, - 1, 1, 6, 5, "The Battle of Lake Erie", - { - { "Lawrence", specs+38, N_A, 4, 55, 8, 0 }, - { "Niagara", specs+42, N_A, 7, 61, 8, 0 }, - { "Lady Prevost", specs+39, N_B, 4, 25, 2, 0 }, - { "Detroit", specs+40, N_B, 7, 22, 2, 0 }, - { "Q. Charlotte", specs+41, N_B, 10, 19, 2, 0 } + { 1, 1, 6, 5, "The Battle of Lake Erie", + { + { "Lawrence", specs+38, N_A, 4, 55, 8, 0 }, + { "Niagara", specs+42, N_A, 7, 61, 8, 0 }, + { "Lady Prevost", specs+39, N_B, 4, 25, 2, 0 }, + { "Detroit", specs+40, N_B, 7, 22, 2, 0 }, + { "Q. Charlotte", specs+41, N_B, 10, 19, 2, 0 } + } }, - 1, 1, 5, 2, "Wasp vs. Reindeer", - { - { "Wasp", specs+42, N_A, 3, 41, 2, 0 }, - { "Reindeer", specs+43, N_B, 10, 48, 2, 0 } + { 1, 1, 5, 2, "Wasp vs. Reindeer", + { + { "Wasp", specs+42, N_A, 3, 41, 2, 0 }, + { "Reindeer", specs+43, N_B, 10, 48, 2, 0 } + } }, - 1, 2, 5, 3, "Constitution vs. Cyane and Levant", - { - { "Constitution", specs+31, N_A, 10, 45, 2, 0 }, - { "Cyane", specs+44, N_B, 3, 37, 2, 0 }, - { "Levant", specs+45, N_B, 5, 35, 2, 0 } + { 1, 2, 5, 3, "Constitution vs. Cyane and Levant", + { + { "Constitution", specs+31, N_A, 10, 45, 2, 0 }, + { "Cyane", specs+44, N_B, 3, 37, 2, 0 }, + { "Levant", specs+45, N_B, 5, 35, 2, 0 } + } }, - 5, 5, 5, 3, "Pellew vs. Droits de L'Homme", - { - { "Indefatigable", specs+46, N_B, 12, 45, 6, 0 }, - { "Amazon", specs+47, N_B, 9, 48, 6, 0 }, - { "Droits L'Hom", specs+48, N_F, 3, 28, 5, 0 } + { 5, 5, 5, 3, "Pellew vs. Droits de L'Homme", + { + { "Indefatigable", specs+46, N_B, 12, 45, 6, 0 }, + { "Amazon", specs+47, N_B, 9, 48, 6, 0 }, + { "Droits L'Hom", specs+48, N_F, 3, 28, 5, 0 } + } }, - 2, 2, 3, 10, "Algeciras", - { - { "Caesar", specs+49, N_B, 7, 70, 6, 0 }, - { "Pompee", specs+50, N_B, 5, 72, 6, 0 }, - { "Spencer", specs+5, N_B, 3, 74, 6, 0 }, - { "Hannibal", specs+7, N_B, 1, 76, 6, 0 }, - { "Real-Carlos", specs+53, N_S, 9, 20, 3, 0 }, - { "San Fernando", specs+54, N_S, 11, 16, 3, 0 }, - { "Argonauta", specs+55, N_S, 10, 14, 4, 0 }, - { "San Augustine", specs+56, N_S, 6, 22, 4, 0 }, - { "Indomptable", specs+51, N_F, 7, 23, 5, 0 }, - { "Desaix", specs+52, N_F, 7, 27, 7, 0 } + { 2, 2, 3, 10, "Algeciras", + { + { "Caesar", specs+49, N_B, 7, 70, 6, 0 }, + { "Pompee", specs+50, N_B, 5, 72, 6, 0 }, + { "Spencer", specs+5, N_B, 3, 74, 6, 0 }, + { "Hannibal", specs+7, N_B, 1, 76, 6, 0 }, + { "Real-Carlos", specs+53, N_S, 9, 20, 3, 0 }, + { "San Fernando", specs+54, N_S, 11, 16, 3, 0 }, + { "Argonauta", specs+55, N_S, 10, 14, 4, 0 }, + { "San Augustine", specs+56, N_S, 6, 22, 4, 0 }, + { "Indomptable", specs+51, N_F, 7, 23, 5, 0 }, + { "Desaix", specs+52, N_F, 7, 27, 7, 0 } + } }, - 5, 3, 6, 7, "Lake Champlain", - { - { "Saratoga", specs+60, N_A, 8, 10, 1, 0 }, - { "Eagle", specs+61, N_A, 9, 13, 2, 0 }, - { "Ticonderoga", specs+62, N_A, 12, 17, 3, 0 }, - { "Preble", specs+63, N_A, 14, 20, 2, 0 }, - { "Confiance", specs+57, N_B, 4, 70, 6, 0 }, - { "Linnet", specs+58, N_B, 7, 68, 6, 0 }, - { "Chubb", specs+59, N_B, 10, 65, 6, 0 } + { 5, 3, 6, 7, "Lake Champlain", + { + { "Saratoga", specs+60, N_A, 8, 10, 1, 0 }, + { "Eagle", specs+61, N_A, 9, 13, 2, 0 }, + { "Ticonderoga", specs+62, N_A, 12, 17, 3, 0 }, + { "Preble", specs+63, N_A, 14, 20, 2, 0 }, + { "Confiance", specs+57, N_B, 4, 70, 6, 0 }, + { "Linnet", specs+58, N_B, 7, 68, 6, 0 }, + { "Chubb", specs+59, N_B, 10, 65, 6, 0 } + } }, - 5, 3, 6, 4, "Last Voyage of the USS President", - { - { "President", specs+67, N_A, 12, 42, 5, 0 }, - { "Endymion", specs+64, N_B, 5, 42, 5, 0 }, - { "Pomone", specs+65, N_B, 7, 82, 6, 0 }, - { "Tenedos", specs+66, N_B, 7, -1, 4, 0 } + { 5, 3, 6, 4, "Last Voyage of the USS President", + { + { "President", specs+67, N_A, 12, 42, 5, 0 }, + { "Endymion", specs+64, N_B, 5, 42, 5, 0 }, + { "Pomone", specs+65, N_B, 7, 82, 6, 0 }, + { "Tenedos", specs+66, N_B, 7, -1, 4, 0 } + } }, - 7, 5, 5, 2, "Hornblower and the Natividad", - { - { "Lydia", specs+68, N_B, 12, 40, 2, 0 }, - { "Natividad", specs+69, N_S, 2, 40, 4, 0 } + { 7, 5, 5, 2, "Hornblower and the Natividad", + { + { "Lydia", specs+68, N_B, 12, 40, 2, 0 }, + { "Natividad", specs+69, N_S, 2, 40, 4, 0 } + } }, - 1, 3, 6, 2, "Curse of the Flying Dutchman", - { - { "Piece of Cake", specs+19, N_S, 7, 40, 2, 0 }, - { "Flying Dutchy", specs+71, N_F, 7, 41, 1, 0 } + { 1, 3, 6, 2, "Curse of the Flying Dutchman", + { + { "Piece of Cake", specs+19, N_S, 7, 40, 2, 0 }, + { "Flying Dutchy", specs+71, N_F, 7, 41, 1, 0 } + } }, - 1, 4, 1, 4, "The South Pacific", - { - { "USS Scurvy", specs+70, N_A, 7, 40, 1, 0 }, - { "HMS Tahiti", specs+71, N_B, 12, 60, 1, 0 }, - { "Australian", specs+18, N_S, 5, 20, 8, 0 }, - { "Bikini Atoll", specs+63, N_F, 2, 60, 4, 0 } + { 1, 4, 1, 4, "The South Pacific", + { + { "USS Scurvy", specs+70, N_A, 7, 40, 1, 0 }, + { "HMS Tahiti", specs+71, N_B, 12, 60, 1, 0 }, + { "Australian", specs+18, N_S, 5, 20, 8, 0 }, + { "Bikini Atoll", specs+63, N_F, 2, 60, 4, 0 } + } }, - 7, 3, 6, 5, "Hornblower and the battle of Rosas bay", - { - { "Sutherland", specs+5, N_B, 13, 30, 2, 0 }, - { "Turenne", specs+10, N_F, 9, 35, 6, 0 }, - { "Nightmare", specs+9, N_F, 7, 37, 6, 0 }, - { "Paris", specs+53, N_F, 3, 45, 4, 0 }, - { "Napoleon", specs+56, N_F, 1, 40, 6, 0 } + { 7, 3, 6, 5, "Hornblower and the battle of Rosas bay", + { + { "Sutherland", specs+5, N_B, 13, 30, 2, 0 }, + { "Turenne", specs+10, N_F, 9, 35, 6, 0 }, + { "Nightmare", specs+9, N_F, 7, 37, 6, 0 }, + { "Paris", specs+53, N_F, 3, 45, 4, 0 }, + { "Napoleon", specs+56, N_F, 1, 40, 6, 0 } + } }, - 6, 4, 7, 5, "Cape Horn", - { - { "Concord", specs+51, N_A, 3, 20, 4, 0 }, - { "Berkeley", specs+7, N_A, 5, 50, 5, 0 }, - { "Thames", specs+71, N_B, 10, 40, 1, 0 }, - { "Madrid", specs+53, N_S, 13, 60, 8, 0 }, - { "Musket", specs+10, N_F, 10, 60, 7, 0 } + { 6, 4, 7, 5, "Cape Horn", + { + { "Concord", specs+51, N_A, 3, 20, 4, 0 }, + { "Berkeley", specs+7, N_A, 5, 50, 5, 0 }, + { "Thames", specs+71, N_B, 10, 40, 1, 0 }, + { "Madrid", specs+53, N_S, 13, 60, 8, 0 }, + { "Musket", specs+10, N_F, 10, 60, 7, 0 } + } }, - 8, 3, 7, 3, "New Orleans", - { - { "Alligator", specs+71, N_A, 13, 5, 1, 0 }, - { "Firefly", specs+50, N_B, 10, 20, 8, 0 }, - { "Cypress", specs+46, N_B, 5, 10, 6, 0 } + { 8, 3, 7, 3, "New Orleans", + { + { "Alligator", specs+71, N_A, 13, 5, 1, 0 }, + { "Firefly", specs+50, N_B, 10, 20, 8, 0 }, + { "Cypress", specs+46, N_B, 5, 10, 6, 0 } + } }, - 5, 3, 7, 3, "Botany Bay", - { - { "Shark", specs+11, N_B, 6, 15, 4, 0 }, - { "Coral Snake", specs+31, N_F, 3, 30, 6, 0 }, - { "Sea Lion", specs+33, N_F, 13, 50, 8, 0 } + { 5, 3, 7, 3, "Botany Bay", + { + { "Shark", specs+11, N_B, 6, 15, 4, 0 }, + { "Coral Snake", specs+31, N_F, 3, 30, 6, 0 }, + { "Sea Lion", specs+33, N_F, 13, 50, 8, 0 } + } }, - 4, 3, 6, 4, "Voyage to the Bottom of the Sea", - { - { "Seaview", specs+71, N_A, 6, 3, 3, 0 }, - { "Flying Sub", specs+64, N_A, 8, 3, 3, 0 }, - { "Mermaid", specs+70, N_B, 2, 5, 5, 0 }, - { "Giant Squid", specs+53, N_S, 10, 30, 8, 0 } + { 4, 3, 6, 4, "Voyage to the Bottom of the Sea", + { + { "Seaview", specs+71, N_A, 6, 3, 3, 0 }, + { "Flying Sub", specs+64, N_A, 8, 3, 3, 0 }, + { "Mermaid", specs+70, N_B, 2, 5, 5, 0 }, + { "Giant Squid", specs+53, N_S, 10, 30, 8, 0 } + } }, - 7, 3, 6, 3, "Frigate Action", - { - { "Killdeer", specs+21, N_A, 7, 20, 8, 0 }, - { "Sandpiper", specs+27, N_B, 5, 40, 8, 0 }, - { "Curlew", specs+34, N_S, 10, 60, 8, 0 } + { 7, 3, 6, 3, "Frigate Action", + { + { "Killdeer", specs+21, N_A, 7, 20, 8, 0 }, + { "Sandpiper", specs+27, N_B, 5, 40, 8, 0 }, + { "Curlew", specs+34, N_S, 10, 60, 8, 0 } + } }, - 7, 2, 5, 6, "The Battle of Midway", - { - { "Enterprise", specs+49, N_A, 10, 70, 8, 0 }, - { "Yorktown", specs+51, N_A, 3, 70, 7, 0 }, - { "Hornet", specs+52, N_A, 6, 70, 7, 0 }, - { "Akagi", specs+53, N_J, 6, 10, 4, 0 }, - { "Kaga", specs+54, N_J, 4, 12, 4, 0 }, - { "Soryu", specs+55, N_J, 2, 14, 4, 0 } + { 7, 2, 5, 6, "The Battle of Midway", + { + { "Enterprise", specs+49, N_A, 10, 70, 8, 0 }, + { "Yorktown", specs+51, N_A, 3, 70, 7, 0 }, + { "Hornet", specs+52, N_A, 6, 70, 7, 0 }, + { "Akagi", specs+53, N_J, 6, 10, 4, 0 }, + { "Kaga", specs+54, N_J, 4, 12, 4, 0 }, + { "Soryu", specs+55, N_J, 2, 14, 4, 0 } + } }, - 1, 3, 4, 8, "Star Trek", - { - { "Enterprise", specs+76, N_D,-10, 60, 7, 0 }, - { "Yorktown", specs+77, N_D, 0, 70, 7, 0 }, - { "Reliant", specs+78, N_D, 10, 70, 7, 0 }, - { "Galileo", specs+79, N_D, 20, 60, 7, 0 }, - { "Kobayashi Maru", specs+80, N_K, 0,120, 7, 0 }, - { "Klingon II", specs+81, N_K, 10,120, 7, 0 }, - { "Red Orion", specs+82, N_O, 0, 0, 3, 0 }, - { "Blue Orion", specs+83, N_O, 10, 0, 3, 0 } + { 1, 3, 4, 8, "Star Trek", + { + { "Enterprise", specs+76, N_D,-10, 60, 7, 0 }, + { "Yorktown", specs+77, N_D, 0, 70, 7, 0 }, + { "Reliant", specs+78, N_D, 10, 70, 7, 0 }, + { "Galileo", specs+79, N_D, 20, 60, 7, 0 }, + { "Kobayashi Maru", specs+80, N_K, 0,120, 7, 0 }, + { "Klingon II", specs+81, N_K, 10,120, 7, 0 }, + { "Red Orion", specs+82, N_O, 0, 0, 3, 0 }, + { "Blue Orion", specs+83, N_O, 10, 0, 3, 0 } + } } }; int nscene = sizeof scene / sizeof (struct scenario); @@ -285,90 +318,90 @@ int nscene = sizeof scene / sizeof (struct scenario); struct shipspecs specs[] = { /* bs fs ta guns hull crew1 crew3 gunR carR rig2 rig4 pts */ /* class qual crew2 gunL carL rig1 rig3 */ -/*00*/ 4, 7, 3, 19, 5, 5, 4, 2, 2, 2, 2, 2, 0, 0, 4, 4, 4, 4, 7, -/*01*/ 4, 7, 3, 17, 5, 5, 4, 2, 2, 2, 0, 0, 4, 4, 3, 3, 3, 3, 6, -/*02*/ 3, 5, 2, 42, 4, 7, 4, 2, 2, 2, 2, 2, 0, 0, 5, 5, 5, -1, 11, -/*03*/ 4, 6, 3, 44, 3, 7, 4, 2, 2, 2, 3, 3, 0, 0, 5, 5, 5, 5, 12, -/*04*/ 3, 5, 2, 64, 2, 17, 4, 8, 6, 6, 12, 12, 2, 2, 7, 7, 7, -1, 20, -/*05*/ 3, 5, 2, 74, 2, 20, 4, 8, 8, 8, 16, 16, 2, 2, 7, 7, 7, -1, 26, -/*06*/ 3, 5, 2, 50, 2, 12, 4, 6, 4, 4, 8, 8, 2, 2, 6, 6, 6, -1, 17, -/*07*/ 3, 5, 1, 98, 1, 23, 4, 10, 10, 10, 18, 18, 2, 2, 8, 8, 8, -1, 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-/*72*/ 3, 5, 1, 120, 2, 21, 5, 15, 17, 15, 25, 25, 7, 7, 9, 9, 9, -1, 36, -/*73*/ 3, 5, 1, 90, 3, 18, 4, 13, 15, 13, 20, 20, 6, 6, 5, 5, 5, 5, 28, -/*74*/ 4, 7, 3, 6, 6, 3, 4, 2, 2, 2, 20, 20, 6, 6, 2, 2, 3, 3, 5, -/*75*/ 3, 5, 1, 110, 2, 20, 4, 14, 15, 11, 26, 26, 8, 8, 7, 8, 9, -1, 34, -/*76*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75, -/*77*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75, -/*78*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75, -/*79*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75, -/*80*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75, -/*81*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75, -/*82*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75, -/*83*/ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75, +/*00*/{ 4, 7, 3, 19, 5, 5, 4, 2, 2, 2, 2, 2, 0, 0, 4, 4, 4, 4, 7 }, +/*01*/{ 4, 7, 3, 17, 5, 5, 4, 2, 2, 2, 0, 0, 4, 4, 3, 3, 3, 3, 6 }, +/*02*/{ 3, 5, 2, 42, 4, 7, 4, 2, 2, 2, 2, 2, 0, 0, 5, 5, 5, -1, 11 }, +/*03*/{ 4, 6, 3, 44, 3, 7, 4, 2, 2, 2, 3, 3, 0, 0, 5, 5, 5, 5, 12 }, +/*04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3, 44, 3, 15, 4, 8, 8, 6, 10, 10, 2, 2, 6, 6, 6, 6, 20 }, +/*66*/{ 4, 6, 3, 38, 3, 14, 4, 4, 4, 4, 6, 6, 6, 6, 5, 5, 5, 5, 15 }, +/*67*/{ 4, 5, 3, 44, 3, 18, 5, 8, 6, 6, 8, 8, 8, 8, 6, 6, 6, 6, 24 }, +/*68*/{ 4, 6, 3, 36, 3, 9, 5, 4, 4, 2, 4, 4, 2, 2, 5, 5, 5, 5, 13 }, +/*69*/{ 3, 5, 2, 50, 2, 14, 2, 6, 6, 6, 8, 8, 0, 0, 6, 6, 6, -1, 14 }, +/*70*/{ 3, 5, 1, 136, 1, 30, 1, 8, 14, 14, 28, 28, 0, 0, 9, 9, 9, -1, 27 }, +/*71*/{ 3, 5, 1, 120, 1, 27, 5, 16, 14, 14, 28, 28, 2, 2, 9, 9, 9, -1, 43 }, +/*72*/{ 3, 5, 1, 120, 2, 21, 5, 15, 17, 15, 25, 25, 7, 7, 9, 9, 9, -1, 36 }, +/*73*/{ 3, 5, 1, 90, 3, 18, 4, 13, 15, 13, 20, 20, 6, 6, 5, 5, 5, 5, 28 }, +/*74*/{ 4, 7, 3, 6, 6, 3, 4, 2, 2, 2, 20, 20, 6, 6, 2, 2, 3, 3, 5 }, +/*75*/{ 3, 5, 1, 110, 2, 20, 4, 14, 15, 11, 26, 26, 8, 8, 7, 8, 9, -1, 34 }, +/*76*/{ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75 }, +/*77*/{ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75 }, +/*78*/{ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75 }, +/*79*/{ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75 }, +/*80*/{ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75 }, +/*81*/{ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75 }, +/*82*/{ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75 }, +/*83*/{ 4, 7, 3, 450, 1, 99, 5, 50, 40, 40, 50, 50,25,25, 9, 9, 9, -1, 75 } /* bs fs ta guns hull crew1 crew3 gunR carR rig2 rig4 pts */ /* class qual crew2 gunL carL rig1 rig3 */ }; diff --git a/sail/lo_main.c b/sail/lo_main.c index 9857b4d7..92c50123 100644 --- a/sail/lo_main.c +++ b/sail/lo_main.c @@ -1,4 +1,4 @@ -/* $NetBSD: lo_main.c,v 1.4 1997/01/07 12:42:21 tls Exp $ */ +/* $NetBSD: lo_main.c,v 1.5 1997/10/13 19:44:24 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,11 +33,12 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)lo_main.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$NetBSD: lo_main.c,v 1.4 1997/01/07 12:42:21 tls Exp $"; +__RCSID("$NetBSD: lo_main.c,v 1.5 1997/10/13 19:44:24 christos Exp $"); #endif #endif /* not lint */ @@ -57,6 +58,7 @@ char *title[] = { "Commander", "Lieutenant" }; +int lo_main() { FILE *fp; diff --git a/sail/main.c b/sail/main.c index 615b0cb9..a5e28a18 100644 --- a/sail/main.c +++ b/sail/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.4 1997/01/07 12:42:22 tls Exp $ */ +/* $NetBSD: main.c,v 1.5 1997/10/13 19:44:30 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,33 +33,39 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1983, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; +__COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\ + The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint #if 0 static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$NetBSD: main.c,v 1.4 1997/01/07 12:42:22 tls Exp $"; +__RCSID("$NetBSD: main.c,v 1.5 1997/10/13 19:44:30 christos Exp $"); #endif #endif /* not lint */ #include "extern.h" +#include <unistd.h> +#include <stdlib.h> +#include <string.h> + +int main __P((int, char **)); /*ARGSUSED*/ +int main(argc, argv) int argc; - register char **argv; + char **argv; { - register char *p; + char *p; int i; (void) srand(getpid()); issetuid = getuid() != geteuid(); - if (p = rindex(*argv, '/')) + if ((p = strrchr(*argv, '/')) != '\0') p++; else p = *argv; @@ -81,7 +87,7 @@ main(argc, argv) debug++; break; case 'x': - randomize; + randomize++; break; case 'l': longfmt++; @@ -97,7 +103,7 @@ main(argc, argv) game = atoi(*argv); else game = -1; - if (i = setjmp(restart)) + if ((i = setjmp(restart)) != 0) mode = i; switch (mode) { case MODE_PLAYER: diff --git a/sail/misc.c b/sail/misc.c index 5b7591bb..c78e952f 100644 --- a/sail/misc.c +++ b/sail/misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.4 1997/01/07 12:42:23 tls Exp $ */ +/* $NetBSD: misc.c,v 1.5 1997/10/13 19:44:38 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,26 +33,31 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)misc.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$NetBSD: misc.c,v 1.4 1997/01/07 12:42:23 tls Exp $"; +__RCSID("$NetBSD: misc.c,v 1.5 1997/10/13 19:44:38 christos Exp $"); #endif #endif /* not lint */ +#include <fcntl.h> +#include <stdlib.h> +#include <unistd.h> #include "extern.h" #include "pathnames.h" #define distance(x,y) (abs(x) >= abs(y) ? abs(x) + abs(y)/2 : abs(y) + abs(x)/2) /* XXX */ +int range(from, to) struct ship *from, *to; { - register bow1r, bow1c, bow2r, bow2c; + int bow1r, bow1c, bow2r, bow2c; int stern1r, stern1c, stern2c, stern2r; - register int bb, bs, sb, ss, result; + int bb, bs, sb, ss, result; if (!to->file->dir) return -1; @@ -76,11 +81,11 @@ struct ship *from, *to; struct ship * closestenemy(from, side, anyship) -register struct ship *from; +struct ship *from; char side, anyship; { - register struct ship *sp; - register char a; + struct ship *sp; + char a; int olddist = 30000, dist; struct ship *closest = 0; @@ -103,10 +108,11 @@ char side, anyship; return closest; } +int angle(dr, dc) -register dr, dc; +int dr, dc; { - register i; + int i; if (dc >= 0 && dr > 0) i = 0; @@ -130,11 +136,12 @@ register dr, dc; return i % 8 + 1; } +int gunsbear(from, to) /* checks for target bow or stern */ -register struct ship *from, *to; +struct ship *from, *to; { int Dr, Dc, i; - register ang; + int ang; Dr = from->file->row - to->file->row; Dc = to->file->col - from->file->col; @@ -151,12 +158,13 @@ register struct ship *from, *to; return 0; } +int portside(from, on, quick) -register struct ship *from, *on; +struct ship *from, *on; int quick; /* returns true if fromship is */ { /* shooting at onship's starboard side */ - register ang; - register Dr, Dc; + int ang; + int Dr, Dc; Dr = from->file->row - on->file->row; Dc = on->file->col - from->file->col; @@ -171,10 +179,11 @@ int quick; /* returns true if fromship is */ return ang < 5; } +int colours(sp) -register struct ship *sp; +struct ship *sp; { - register char flag; + char flag = '\0'; if (sp->file->struck) flag = '!'; @@ -188,16 +197,16 @@ register struct ship *sp; return sp->file->FS ? flag : tolower(flag); } -#include <sys/file.h> -log(s) -register struct ship *s; +void +logger(s) +struct ship *s; { FILE *fp; int persons; int n; struct logs log[NLOG]; float net; - register struct logs *lp; + struct logs *lp; if ((fp = fopen(_PATH_LOGFILE, "r+")) == NULL) return; diff --git a/sail/parties.c b/sail/parties.c index 3fa8c182..3db054c3 100644 --- a/sail/parties.c +++ b/sail/parties.c @@ -1,4 +1,4 @@ -/* $NetBSD: parties.c,v 1.4 1997/01/07 12:42:23 tls Exp $ */ +/* $NetBSD: parties.c,v 1.5 1997/10/13 19:44:47 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,22 +33,24 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)parties.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$NetBSD: parties.c,v 1.4 1997/01/07 12:42:23 tls Exp $"; +__RCSID("$NetBSD: parties.c,v 1.5 1997/10/13 19:44:47 christos Exp $"); #endif #endif /* not lint */ #include "extern.h" +int meleeing(from, to) struct ship *from; -register struct ship *to; +struct ship *to; { - register struct BP *p = from->file->OBP; - register struct BP *q = p + NBP; + struct BP *p = from->file->OBP; + struct BP *q = p + NBP; for (; p < q; p++) if (p->turnsent && p->toship == to) @@ -56,12 +58,13 @@ register struct ship *to; return 0; } +int boarding(from, isdefense) -register struct ship *from; +struct ship *from; char isdefense; { - register struct BP *p = isdefense ? from->file->DBP : from->file->OBP; - register struct BP *q = p + NBP; + struct BP *p = isdefense ? from->file->DBP : from->file->OBP; + struct BP *q = p + NBP; for (; p < q; p++) if (p->turnsent) @@ -69,12 +72,13 @@ char isdefense; return 0; } +void unboard(ship, to, isdefense) -register struct ship *ship, *to; -register char isdefense; +struct ship *ship, *to; +char isdefense; { - register struct BP *p = isdefense ? ship->file->DBP : ship->file->OBP; - register n; + struct BP *p = isdefense ? ship->file->DBP : ship->file->OBP; + int n; for (n = 0; n < NBP; p++, n++) if (p->turnsent && (p->toship == to || isdefense || ship == to)) diff --git a/sail/pl_1.c b/sail/pl_1.c index 0abd1ac3..9c0e0100 100644 --- a/sail/pl_1.c +++ b/sail/pl_1.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_1.c,v 1.3 1995/04/22 10:37:07 cgd Exp $ */ +/* $NetBSD: pl_1.c,v 1.4 1997/10/13 19:44:53 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,11 +33,12 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)pl_1.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: pl_1.c,v 1.3 1995/04/22 10:37:07 cgd Exp $"; +__RCSID("$NetBSD: pl_1.c,v 1.4 1997/10/13 19:44:53 christos Exp $"); #endif #endif /* not lint */ @@ -53,6 +54,7 @@ static char rcsid[] = "$NetBSD: pl_1.c,v 1.3 1995/04/22 10:37:07 cgd Exp $"; * Of course, we don't do any more Sync()'s if we got here * because of a Sync() failure. */ +void leave(conditions) int conditions; { @@ -63,28 +65,24 @@ int conditions; (void) signal(SIGCHLD, SIG_IGN); if (done_curses) { - Signal("It looks like you've had it!", - (struct ship *)0); + Msg("It looks like you've had it!"); switch (conditions) { case LEAVE_QUIT: break; case LEAVE_CAPTURED: - Signal("Your ship was captured.", - (struct ship *)0); + Msg("Your ship was captured."); break; case LEAVE_HURRICAN: - Signal("Hurricane! All ships destroyed.", - (struct ship *)0); + Msg("Hurricane! All ships destroyed."); break; case LEAVE_DRIVER: - Signal("The driver died.", (struct ship *)0); + Msg("The driver died."); break; case LEAVE_SYNC: - Signal("Synchronization error.", (struct ship *)0); + Msg("Synchronization error."); break; default: - Signal("A funny thing happened (%d).", - (struct ship *)0, conditions); + Msg("A funny thing happened (%d).", conditions); } } else { switch (conditions) { @@ -106,7 +104,7 @@ int conditions; } if (ms != 0) { - log(ms); + logger(ms); if (conditions != LEAVE_SYNC) { makesignal(ms, "Captain %s relinquishing.", (struct ship *)0, mf->captain); @@ -119,14 +117,18 @@ int conditions; exit(0); } +/*ARGSUSED*/ void -choke() +choke(n) + int n; { leave(LEAVE_QUIT); } +/*ARGSUSED*/ void -child() +child(n) + int n; { union wait status; int pid; @@ -134,7 +136,7 @@ child() (void) signal(SIGCHLD, SIG_IGN); do { pid = wait3((int *)&status, WNOHANG, (struct rusage *)0); - if (pid < 0 || pid > 0 && !WIFSTOPPED(status)) + if (pid < 0 || (pid > 0 && !WIFSTOPPED(status))) hasdriver = 0; } while (pid > 0); (void) signal(SIGCHLD, child); diff --git a/sail/pl_2.c b/sail/pl_2.c index e1b975f1..1ac1d205 100644 --- a/sail/pl_2.c +++ b/sail/pl_2.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_2.c,v 1.3 1995/04/22 10:37:08 cgd Exp $ */ +/* $NetBSD: pl_2.c,v 1.4 1997/10/13 19:45:01 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,19 +33,21 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)pl_2.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: pl_2.c,v 1.3 1995/04/22 10:37:08 cgd Exp $"; +__RCSID("$NetBSD: pl_2.c,v 1.4 1997/10/13 19:45:01 christos Exp $"); #endif #endif /* not lint */ #include "player.h" +void play() { - register struct ship *sp; + struct ship *sp; for (;;) { switch (sgetch("~\b", (struct ship *)0, 0)) { @@ -62,7 +64,7 @@ play() unfoulplayer(); break; case 'v': - Signal("%s", (struct ship *)0, version); + Msg("%s", version); break; case 'b': acceptboard(); @@ -80,7 +82,7 @@ play() repair(); break; case 'B': - Signal("'Hands to stations!'", (struct ship *)0); + Msg("'Hands to stations!'"); unboard(ms, ms, 1); /* cancel DBP's */ unboard(ms, ms, 0); /* cancel offense */ break; @@ -96,10 +98,10 @@ play() mf->loadR = L_EMPTY; mf->readyL = R_EMPTY; mf->readyR = R_EMPTY; - Signal("Broadsides unloaded", (struct ship *)0); + Msg("Broadsides unloaded"); break; case 'q': - Signal("Type 'Q' to quit", (struct ship *)0); + Msg("Type 'Q' to quit"); break; case 'Q': leave(LEAVE_QUIT); @@ -111,7 +113,7 @@ play() break; case 'i': if ((sp = closestenemy(ms, 0, 1)) == 0) - Signal("No more ships left."); + Msg("No more ships left."); else eyeball(sp); break; diff --git a/sail/pl_3.c b/sail/pl_3.c index c860ec7c..e22ccffa 100644 --- a/sail/pl_3.c +++ b/sail/pl_3.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_3.c,v 1.3 1995/04/22 10:37:09 cgd Exp $ */ +/* $NetBSD: pl_3.c,v 1.4 1997/10/13 19:45:10 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,16 +33,19 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)pl_3.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: pl_3.c,v 1.3 1995/04/22 10:37:09 cgd Exp $"; +__RCSID("$NetBSD: pl_3.c,v 1.4 1997/10/13 19:45:10 christos Exp $"); #endif #endif /* not lint */ #include "player.h" +#include <stdlib.h> +void acceptcombat() { int men = 0; @@ -84,7 +87,7 @@ acceptcombat() guns = mc->gunL; car = mc->carL; } - if (!guns && !car || load == L_EMPTY || (ready & R_LOADED) == 0) + if ((!guns && !car) || load == L_EMPTY || (ready & R_LOADED) == 0) goto cant; if (mf->struck || !crew[2]) goto cant; @@ -94,9 +97,9 @@ acceptcombat() if (closest->file->struck) goto cant; target = range(ms, closest); - if (target > rangeofshot[load] || !guns && target >= 3) + if (target > rangeofshot[load] || (!guns && target >= 3)) goto cant; - Signal("%s (%c%c) within range of %s broadside.", + Signal("%$ within range of %s broadside.", closest, r ? "right" : "left"); if (load > L_CHAIN && target < 6) { switch (sgetch("Aim for hull or rigging? ", @@ -109,14 +112,12 @@ acceptcombat() break; default: shootat = -1; - Signal("'Avast there! Hold your fire.'", - (struct ship *)0); + Msg("'Avast there! Hold your fire.'"); } } else { if (sgetch("Fire? ", (struct ship *)0, 1) == 'n') { shootat = -1; - Signal("Belay that! Hold your fire.", - (struct ship *)0); + Msg("Belay that! Hold your fire."); } else shootat = RIGGING; } @@ -132,9 +133,9 @@ acceptcombat() sternrake = temp > 4 && temp < 6; if (rakehim) if (!sternrake) - Signal("Raking the %s!", closest); + Signal("%$ Raking the %s!", closest); else - Signal("Stern Rake! %s splintering!", closest); + Signal("%$ Stern Rake! %s splintering!", closest); index = guns; if (target < 3) index += car; @@ -193,10 +194,9 @@ acceptcombat() } table(shootat, load, hit, closest, ms, roll); } - Signal("Damage inflicted on the %s:", - (struct ship *)0, closest->shipname); - Signal("\t%d HULL, %d GUNS, %d CREW, %d RIGGING", - (struct ship *)0, hhits, ghits, chits, rhits); + Msg("Damage inflicted on the %s:", closest->shipname); + Msg("\t%d HULL, %d GUNS, %d CREW, %d RIGGING", + hhits, ghits, chits, rhits); if (!r) { mf->loadL = L_EMPTY; mf->readyL = R_EMPTY; @@ -206,18 +206,18 @@ acceptcombat() } continue; cant: - Signal("Unable to fire %s broadside", - (struct ship *)0, r ? "right" : "left"); + Msg("Unable to fire %s broadside", r ? "right" : "left"); } blockalarm(); draw_stat(); unblockalarm(); } +void grapungrap() { - register struct ship *sp; - register int i; + struct ship *sp; + int i; foreachship(sp) { if (sp == ms || sp->file->dir == 0) @@ -231,10 +231,10 @@ grapungrap() || 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); - Signal("Attempt succeeds!", (struct ship *)0); + Msg("Attempt succeeds!"); makesignal(ms, "grappled with %s (%c%c)", sp); } else - Signal("Attempt fails.", (struct ship *)0); + Msg("Attempt fails."); break; case 'u': for (i = grappled2(ms, sp); --i >= 0;) { @@ -242,24 +242,23 @@ grapungrap() == capship(sp)->nationality || die() < 3) { cleangrapple(ms, sp, 0); - Signal("Attempt succeeds!", - (struct ship *)0); + Msg("Attempt succeeds!"); makesignal(ms, "ungrappling with %s (%c%c)", sp); } else - Signal("Attempt fails.", - (struct ship *)0); + Msg("Attempt fails."); } break; } } } +void unfoulplayer() { - register struct ship *to; - register i; + struct ship *to; + int i; foreachship(to) { if (fouled2(ms, to) == 0) @@ -269,10 +268,10 @@ unfoulplayer() for (i = fouled2(ms, to); --i >= 0;) { if (die() <= 2) { cleanfoul(ms, to, 0); - Signal("Attempt succeeds!", (struct ship *)0); + Msg("Attempt succeeds!"); makesignal(ms, "Unfouling %s (%c%c)", to); } else - Signal("Attempt fails.", (struct ship *)0); + Msg("Attempt fails."); } } } diff --git a/sail/pl_4.c b/sail/pl_4.c index 535ed86b..6f7b914b 100644 --- a/sail/pl_4.c +++ b/sail/pl_4.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_4.c,v 1.4 1995/04/24 12:25:17 cgd Exp $ */ +/* $NetBSD: pl_4.c,v 1.5 1997/10/13 19:45:20 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,23 +33,25 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)pl_4.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: pl_4.c,v 1.4 1995/04/24 12:25:17 cgd Exp $"; +__RCSID("$NetBSD: pl_4.c,v 1.5 1997/10/13 19:45:20 christos Exp $"); #endif #endif /* not lint */ #include "player.h" +void changesail() { int rig, full; rig = mc->rig1; full = mf->FS; - if (windspeed == 6 || windspeed == 5 && mc->class > 4) + if (windspeed == 6 || (windspeed == 5 && mc->class > 4)) rig = 0; if (mc->crew3 && rig) { if (!full) { @@ -66,13 +68,14 @@ changesail() } } } else if (!rig) - Signal("Sails rent to pieces", (struct ship *)0); + Msg("Sails rent to pieces"); } +void acceptsignal() { char buf[60]; - register char *p = buf; + char *p = buf; *p++ = '"'; sgetstr("Message? ", p, sizeof buf - 2); @@ -83,11 +86,12 @@ acceptsignal() Write(W_SIGNAL, ms, 1, (long)buf, 0, 0, 0); } +void lookout() { - register struct ship *sp; + struct ship *sp; char buf[3]; - register char c; + char c; sgetstr("What ship? ", buf, sizeof buf); foreachship(sp) { @@ -102,7 +106,7 @@ lookout() char * saywhat(sp, flag) -register struct ship *sp; +struct ship *sp; char flag; { if (sp->file->captain[0]) @@ -117,18 +121,19 @@ char flag; return "(computer)"; } +void eyeball(ship) -register struct ship *ship; +struct ship *ship; { int i; if (ship->file->dir != 0) { - Signal("Sail ho! (range %d, %s)", - (struct ship *)0, range(ms, ship), saywhat(ship, 0)); + Msg("Sail ho! (range %d, %s)", + range(ms, ship), saywhat(ship, 0)); i = portside(ms, ship, 1) - mf->dir; if (i <= 0) i += 8; - Signal("%s (%c%c) %s %s %s.", + Signal("%$ %s %s %s.", ship, countryname[ship->nationality], classname[ship->specs->class], directionname[i]); } diff --git a/sail/pl_5.c b/sail/pl_5.c index f8df3291..089faf11 100644 --- a/sail/pl_5.c +++ b/sail/pl_5.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_5.c,v 1.4 1995/04/24 12:25:21 cgd Exp $ */ +/* $NetBSD: pl_5.c,v 1.5 1997/10/13 19:45:26 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,11 +33,12 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)pl_5.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: pl_5.c,v 1.4 1995/04/24 12:25:21 cgd Exp $"; +__RCSID("$NetBSD: pl_5.c,v 1.5 1997/10/13 19:45:26 christos Exp $"); #endif #endif /* not lint */ @@ -45,6 +46,7 @@ static char rcsid[] = "$NetBSD: pl_5.c,v 1.4 1995/04/24 12:25:21 cgd Exp $"; #define turnfirst(x) (*x == 'r' || *x == 'l') +void acceptmove() { int ta; @@ -54,10 +56,10 @@ acceptmove() int vma, dir; char prompt[60]; char buf[60], last = '\0'; - register char *p; + char *p; if (!mc->crew3 || snagged(ms) || !windspeed) { - Signal("Unable to move", (struct ship *)0); + Msg("Unable to move"); return; } @@ -77,22 +79,21 @@ acceptmove() else if (dir == 9) dir = 1; if (last == 't') { - Signal("Ship can't turn that fast.", - (struct ship *)0); + Msg("Ship can't turn that fast."); *p-- = '\0'; } last = 't'; ma--; ta--; vma = min(ma, maxmove(ms, dir, 0)); - if (ta < 0 && moved || vma < 0 && moved) + if ((ta < 0 && moved) || (vma < 0 && moved)) *p-- = '\0'; break; case 'b': ma--; vma--; last = 'b'; - if (ta < 0 && moved || vma < 0 && moved) + if ((ta < 0 && moved) || (vma < 0 && moved)) *p-- = '\0'; break; case '0': @@ -105,31 +106,29 @@ acceptmove() case '1': case '2': case '3': case '4': case '5': case '6': case '7': if (last == '0') { - Signal("Can't move that fast.", - (struct ship *)0); + Msg("Can't move that fast."); *p-- = '\0'; } last = '0'; moved = 1; ma -= *p - '0'; vma -= *p - '0'; - if (ta < 0 && moved || vma < 0 && moved) + if ((ta < 0 && moved) || (vma < 0 && moved)) *p-- = '\0'; break; default: if (!isspace(*p)) { - Signal("Input error.", (struct ship *)0); + Msg("Input error."); *p-- = '\0'; } } - if (ta < 0 && moved || vma < 0 && moved - || af && turnfirst(buf) && moved) { - Signal("Movement error.", (struct ship *)0); + if ((ta < 0 && moved) || (vma < 0 && moved) + || (af && turnfirst(buf) && moved)) { + Msg("Movement error."); if (ta < 0 && moved) { if (mf->FS == 1) { Write(W_FS, ms, 0, 0, 0, 0, 0); - Signal("No hands to set full sails.", - (struct ship *)0); + Msg("No hands to set full sails."); } } else if (ma >= 0) buf[1] = '\0'; @@ -137,8 +136,7 @@ acceptmove() if (af && !moved) { if (mf->FS == 1) { Write(W_FS, ms, 0, 0, 0, 0, 0); - Signal("No hands to set full sails.", - (struct ship *)0); + Msg("No hands to set full sails."); } } if (*buf) @@ -146,13 +144,14 @@ acceptmove() else (void) strcpy(movebuf, "d"); Write(W_MOVE, ms, 1, (long)movebuf, 0, 0, 0); - Signal("Helm: %s.", (struct ship *)0, movebuf); + Msg("Helm: %s.", movebuf); } +void acceptboard() { - register struct ship *sp; - register int n; + struct ship *sp; + int n; int crew[3]; int men = 0; char c; @@ -201,13 +200,14 @@ acceptboard() unblockalarm(); } +void parties(crew, to, isdefense, buf) -register struct ship *to; +struct ship *to; int crew[3]; char isdefense; char buf; { - register int k, j, men; + int k, j, men; struct BP *ptr; int temp[3]; @@ -227,8 +227,7 @@ char buf; buf--; } if (buf > '0') - Signal("Sending all crew sections.", - (struct ship *)0); + Msg("Sending all crew sections."); Write(isdefense ? W_DBP : W_OBP, ms, 0, j, turn, to->file->index, men); if (isdefense) { @@ -255,6 +254,6 @@ char buf; (void) wrefresh(slot_w); unblockalarm(); } else - Signal("Sending no crew sections.", (struct ship *)0); + Msg("Sending no crew sections."); } } diff --git a/sail/pl_6.c b/sail/pl_6.c index 03f339bd..e684035d 100644 --- a/sail/pl_6.c +++ b/sail/pl_6.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_6.c,v 1.3 1995/04/22 10:37:15 cgd Exp $ */ +/* $NetBSD: pl_6.c,v 1.4 1997/10/13 19:45:33 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,28 +33,30 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #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 $"; +__RCSID("$NetBSD: pl_6.c,v 1.4 1997/10/13 19:45:33 christos 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) { @@ -121,7 +123,7 @@ repair() 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) { diff --git a/sail/pl_7.c b/sail/pl_7.c index 1268c1fe..c1525b4c 100644 --- a/sail/pl_7.c +++ b/sail/pl_7.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_7.c,v 1.6 1995/04/22 10:37:17 cgd Exp $ */ +/* $NetBSD: pl_7.c,v 1.7 1997/10/13 19:45:39 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,16 +33,23 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)pl_7.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: pl_7.c,v 1.6 1995/04/22 10:37:17 cgd Exp $"; +__RCSID("$NetBSD: pl_7.c,v 1.7 1997/10/13 19:45:39 christos Exp $"); #endif #endif /* not lint */ #include <sys/ttydefaults.h> #include "player.h" +#ifdef __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif +#include <unistd.h> /* @@ -54,6 +61,7 @@ static char *sc_prompt; static char *sc_buf; static int sc_line; +void initscreen() { /* initscr() already done in SCREENTEST() */ @@ -71,6 +79,7 @@ initscreen() crmode(); } +void cleanupscreen() { /* alarm already turned off */ @@ -82,8 +91,10 @@ cleanupscreen() } } +/*ARGSUSED*/ void -newturn() +newturn(n) + int n; { repaired = loaded = fired = changed = 0; movebuf[0] = '\0'; @@ -135,23 +146,65 @@ newturn() } /*VARARGS2*/ -Signal(fmt, ship, a, b, c, d) -char *fmt; -register struct ship *ship; -int a, b, c, d; +void +#ifdef __STDC__ +Signal(const char *fmt, struct ship *ship, ...) +#else +Signal(va_alist) + va_dcl +#endif { + va_list ap; + char format[BUFSIZ]; +#ifndef __STDC__ + const char *fmt; + struct ship *ship; + + va_start(ap); + fmt = va_arg(ap, const char *); + ship = va_arg(ap, struct ship *); +#else + va_start(ap, ship); +#endif if (!done_curses) return; if (*fmt == '\7') putchar(*fmt++); - if (ship == 0) - (void) wprintw(scroll_w, fmt, a, b, c, d); - else - (void) wprintw(scroll_w, fmt, ship->shipname, - colours(ship), sterncolour(ship), a, b, c, d); + fmtship(format, sizeof(format), fmt, ship); + (void) vwprintw(scroll_w, format, ap); + va_end(ap); Scroll(); } +/*VARARGS2*/ +void +#ifdef __STDC__ +Msg(const char *fmt, ...) +#else +Msg(va_alist) + va_dcl +#endif +{ + va_list ap; +#ifndef __STDC__ + const char *fmt; + + va_start(ap); + fmt = va_arg(ap, const char *); +#else + va_start(ap, fmt); +#endif + + if (!done_curses) + return; + if (*fmt == '\7') + putchar(*fmt++); + (void) vwprintw(scroll_w, fmt, ap); + va_end(ap); + Scroll(); +} + +void Scroll() { if (++sc_line >= SCROLL_Y) @@ -160,8 +213,9 @@ Scroll() (void) wclrtoeol(scroll_w); } +void prompt(p, ship) -register char *p; +char *p; struct ship *ship; { static char buf[60]; @@ -177,6 +231,7 @@ struct ship *ship; (void) waddstr(scroll_w, p); } +void endprompt(flag) char flag; { @@ -185,12 +240,13 @@ char flag; Scroll(); } +int sgetch(p, ship, flag) char *p; struct ship *ship; char flag; { - register c; + int c; prompt(p, ship); blockalarm(); @@ -204,13 +260,14 @@ char flag; return c; } +void sgetstr(pr, buf, n) char *pr; -register char *buf; -register n; +char *buf; +int n; { - register c; - register char *p = buf; + int c; + char *p = buf; prompt(pr, (struct ship *)0); sc_buf = buf; @@ -242,6 +299,7 @@ register n; } } +void draw_screen() { draw_view(); @@ -251,9 +309,10 @@ draw_screen() (void) wrefresh(scroll_w); /* move the cursor */ } +void draw_view() { - register struct ship *sp; + struct ship *sp; (void) werase(view_w); foreachship(sp) { @@ -274,6 +333,7 @@ draw_view() (void) wrefresh(view_w); } +void draw_turn() { (void) wmove(turn_w, 0, 0); @@ -281,6 +341,7 @@ draw_turn() (void) wrefresh(turn_w); } +void draw_stat() { (void) wmove(stat_w, STAT_1, 0); @@ -321,6 +382,7 @@ draw_stat() (void) wrefresh(stat_w); } +void draw_slot() { if (!boarding(ms, 0)) { @@ -384,9 +446,10 @@ draw_slot() (void) wrefresh(slot_w); } +void draw_board() { - register int n; + int n; (void) clear(); (void) werase(view_w); @@ -431,32 +494,38 @@ draw_board() (void) refresh(); } +void centerview() { viewrow = mf->row - VIEW_Y / 2; viewcol = mf->col - VIEW_X / 2; } +void upview() { viewrow -= VIEW_Y / 3; } +void downview() { viewrow += VIEW_Y / 3; } +void leftview() { viewcol -= VIEW_X / 5; } +void rightview() { viewcol += VIEW_X / 5; } +void adjustview() { if (dont_adjust) diff --git a/sail/pl_main.c b/sail/pl_main.c index 9bd466a6..2467951f 100644 --- a/sail/pl_main.c +++ b/sail/pl_main.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_main.c,v 1.5 1995/04/24 12:25:25 cgd Exp $ */ +/* $NetBSD: pl_main.c,v 1.6 1997/10/13 19:45:48 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,21 +33,23 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)pl_main.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: pl_main.c,v 1.5 1995/04/24 12:25:25 cgd Exp $"; +__RCSID("$NetBSD: pl_main.c,v 1.6 1997/10/13 19:45:48 christos Exp $"); #endif #endif /* not lint */ #include "player.h" #include <sys/types.h> #include <sys/wait.h> - -void choke(), child(); +#include <stdlib.h> +#include <unistd.h> /*ARGSUSED*/ +int pl_main() { @@ -56,11 +58,12 @@ pl_main() exit(1); } initialize(); - Signal("Aye aye, Sir", (struct ship *)0); + Msg("Aye aye, Sir"); play(); return 0; /* for lint, play() never returns */ } +void initialize() { register struct File *fp; @@ -248,5 +251,5 @@ reprint: draw_board(); (void) sprintf(message, "Captain %s assuming command", captain); Write(W_SIGNAL, ms, 1, (long)message, 0, 0, 0); - newturn(); + newturn(0); } diff --git a/sail/sync.c b/sail/sync.c index d3389964..641ab324 100644 --- a/sail/sync.c +++ b/sail/sync.c @@ -1,4 +1,4 @@ -/* $NetBSD: sync.c,v 1.5 1997/01/07 12:42:27 tls Exp $ */ +/* $NetBSD: sync.c,v 1.6 1997/10/13 19:45:54 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,16 +33,26 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)sync.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$NetBSD: sync.c,v 1.5 1997/01/07 12:42:27 tls Exp $"; +__RCSID("$NetBSD: sync.c,v 1.6 1997/10/13 19:45:54 christos Exp $"); #endif #endif /* not lint */ -#include <sys/file.h> +#include <fcntl.h> #include <errno.h> +#ifdef __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> #include "extern.h" #define BUFSIZE 4096 @@ -56,26 +66,65 @@ static FILE *sync_fp; #define SF "/tmp/#sailsink.%d" #define LF "/tmp/#saillock.%d" +void +fmtship(buf, len, fmt, ship) + char *buf; + size_t len; + const char *fmt; + struct ship *ship; +{ + while (*fmt) { + if (len-- == 0) { + *buf = '\0'; + return; + } + if (*fmt == '%' && fmt[1] == '$') { + size_t l = snprintf(buf, len, "%s (%c%c)", + ship->shipname, colours(ship), sterncolour(ship)); + buf += l; + len -= l - 1; + fmt += 2; + } + else + *buf++ = *fmt++; + } + + if (len > 0) + *buf = '\0'; +} + + /*VARARGS3*/ -makesignal(from, fmt, ship, a, b, c) - struct ship *from; - char *fmt; - register struct ship *ship; - long a, b, c; +void +#ifdef __STDC__ +makesignal(struct ship *from, const char *fmt, struct ship *ship, ...) +#else +makesignal(va_alias) + va_dcl +#endif { - char message[80]; + char message[BUFSIZ]; + char format[BUFSIZ]; + va_list ap; +#ifndef __STDC__ + struct ship *from; + const char *fmt; + struct ship *ship; - if (ship == 0) - (void) sprintf(message, fmt, a, b, c); - else - (void) sprintf(message, fmt, - ship->shipname, colours(ship), - sterncolour(ship), a, b, c); + va_start(ap); + from = va_arg(ap, struct ship *); + fmt = va_arg(ap, const char *); + ship = va_arg(ap, struct ship *); +#else + va_start(ap, ship); +#endif + fmtship(format, sizeof(format), fmt, ship); + (void) vsprintf(message, format, ap); + va_end(ap); Write(W_SIGNAL, from, 1, (long)message, 0, 0, 0); } -#include <sys/types.h> -#include <sys/stat.h> +int sync_exists(game) { char buf[sizeof sync_file]; @@ -95,6 +144,7 @@ sync_exists(game) return 1; } +int sync_open() { if (sync_fp != NULL) @@ -113,6 +163,7 @@ sync_open() return 0; } +void sync_close(remove) char remove; { @@ -122,17 +173,19 @@ sync_close(remove) (void) unlink(sync_file); } +void Write(type, ship, isstr, a, b, c, d) int type; struct ship *ship; - char isstr; + int isstr; long a, b, c, d; { + if (isstr) (void) sprintf(sync_bp, "%d %d %d %s\n", - type, ship->file->index, isstr, a); + type, ship->file->index, isstr, (char *) a); else - (void) sprintf(sync_bp, "%d %d %d %d %d %d %d\n", + (void) sprintf(sync_bp, "%d %d %d %ld %ld %ld %ld\n", type, ship->file->index, isstr, a, b, c, d); while (*sync_bp++) ; @@ -142,10 +195,11 @@ Write(type, ship, isstr, a, b, c, d) (void) sync_update(type, ship, a, b, c, d); } +int Sync() { sig_t sighup, sigint; - register n; + int n; int type, shipnum, isstr; long a, b, c, d; char buf[80]; @@ -185,7 +239,7 @@ Sync() if (isstr != 0 && isstr != 1) goto bad; if (isstr) { - register char *p; + char *p; for (p = buf;;) { switch (*p++ = getc(sync_fp)) { case '\n': @@ -205,7 +259,7 @@ Sync() a = (long)p; b = c = d = 0; } else - if (fscanf(sync_fp, "%d%d%d%d", &a, &b, &c, &d) != 4) + 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) goto bad; @@ -231,28 +285,29 @@ out: return erred ? -1 : 0; } +int sync_update(type, ship, a, b, c, d) int type; - register struct ship *ship; + struct ship *ship; long a, b, c, d; { switch (type) { case W_DBP: { - register struct BP *p = &ship->file->DBP[a]; + struct BP *p = &ship->file->DBP[a]; p->turnsent = b; p->toship = SHIP(c); p->mensent = d; break; } case W_OBP: { - register struct BP *p = &ship->file->OBP[a]; + struct BP *p = &ship->file->OBP[a]; p->turnsent = b; p->toship = SHIP(c); p->mensent = d; break; } case W_FOUL: { - register struct snag *p = &ship->file->foul[a]; + struct snag *p = &ship->file->foul[a]; if (SHIP(a)->file->dir == 0) break; if (p->sn_count++ == 0) @@ -261,7 +316,7 @@ sync_update(type, ship, a, b, c, d) break; } case W_GRAP: { - register struct snag *p = &ship->file->grap[a]; + struct snag *p = &ship->file->grap[a]; if (SHIP(a)->file->dir == 0) break; if (p->sn_count++ == 0) @@ -270,7 +325,7 @@ sync_update(type, ship, a, b, c, d) break; } case W_UNFOUL: { - register struct snag *p = &ship->file->foul[a]; + struct snag *p = &ship->file->foul[a]; if (p->sn_count > 0) if (b) { ship->file->nfoul -= p->sn_count; @@ -282,7 +337,7 @@ sync_update(type, ship, a, b, c, d) break; } case W_UNGRAP: { - register struct snag *p = &ship->file->grap[a]; + struct snag *p = &ship->file->grap[a]; if (p->sn_count > 0) if (b) { ship->file->ngrap -= p->sn_count; @@ -296,12 +351,12 @@ sync_update(type, ship, a, b, c, d) case W_SIGNAL: if (mode == MODE_PLAYER) if (nobells) - Signal("%s (%c%c): %s", ship, a); + Signal("%$: %s", ship, a); else - Signal("\7%s (%c%c): %s", ship, a); + Signal("\7%$: %s", ship, a); break; case W_CREW: { - register struct shipspecs *s = ship->specs; + struct shipspecs *s = ship->specs; s->crew1 = a; s->crew2 = b; s->crew3 = c; @@ -332,13 +387,13 @@ sync_update(type, ship, a, b, c, d) ship->file->FS = a; break; case W_GUNL: { - register struct shipspecs *s = ship->specs; + struct shipspecs *s = ship->specs; s->gunL = a; s->carL = b; break; } case W_GUNR: { - register struct shipspecs *s = ship->specs; + struct shipspecs *s = ship->specs; s->gunR = a; s->carR = b; break; @@ -361,7 +416,7 @@ sync_update(type, ship, a, b, c, d) ship->specs->qual = a; break; case W_RIGG: { - register struct shipspecs *s = ship->specs; + struct shipspecs *s = ship->specs; s->rig1 = a; s->rig2 = b; s->rig3 = c; diff --git a/sail/version.c b/sail/version.c index f1d818ab..68ac04d0 100644 --- a/sail/version.c +++ b/sail/version.c @@ -1,4 +1,4 @@ -/* $NetBSD: version.c,v 1.3 1995/04/22 10:37:27 cgd Exp $ */ +/* $NetBSD: version.c,v 1.4 1997/10/13 19:46:01 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -33,11 +33,12 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)version.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$NetBSD: version.c,v 1.3 1995/04/22 10:37:27 cgd Exp $"; +__RCSID("$NetBSD: version.c,v 1.4 1997/10/13 19:46:01 christos Exp $"); #endif #endif /* not lint */ |