diff options
-rw-r--r-- | sail/assorted.c | 17 | ||||
-rw-r--r-- | sail/dr_1.c | 27 | ||||
-rw-r--r-- | sail/dr_2.c | 54 | ||||
-rw-r--r-- | sail/dr_3.c | 38 | ||||
-rw-r--r-- | sail/dr_4.c | 10 | ||||
-rw-r--r-- | sail/dr_5.c | 14 | ||||
-rw-r--r-- | sail/dr_main.c | 14 | ||||
-rw-r--r-- | sail/extern.h | 8 | ||||
-rw-r--r-- | sail/game.c | 12 | ||||
-rw-r--r-- | sail/lo_main.c | 11 | ||||
-rw-r--r-- | sail/main.c | 6 | ||||
-rw-r--r-- | sail/misc.c | 50 | ||||
-rw-r--r-- | sail/parties.c | 16 | ||||
-rw-r--r-- | sail/pl_1.c | 29 | ||||
-rw-r--r-- | sail/pl_2.c | 6 | ||||
-rw-r--r-- | sail/pl_3.c | 10 | ||||
-rw-r--r-- | sail/pl_4.c | 17 | ||||
-rw-r--r-- | sail/pl_5.c | 38 | ||||
-rw-r--r-- | sail/pl_6.c | 10 | ||||
-rw-r--r-- | sail/pl_7.c | 299 | ||||
-rw-r--r-- | sail/sync.c | 123 |
21 files changed, 328 insertions, 481 deletions
diff --git a/sail/assorted.c b/sail/assorted.c index 8bd2bec7..ae418741 100644 --- a/sail/assorted.c +++ b/sail/assorted.c @@ -1,4 +1,4 @@ -/* $NetBSD: assorted.c,v 1.9 2000/11/30 22:02:20 jwise Exp $ */ +/* $NetBSD: assorted.c,v 1.10 2001/01/01 21:57:37 jwise 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.9 2000/11/30 22:02:20 jwise Exp $"); +__RCSID("$NetBSD: assorted.c,v 1.10 2001/01/01 21:57:37 jwise Exp $"); #endif #endif /* not lint */ @@ -47,12 +47,10 @@ __RCSID("$NetBSD: assorted.c,v 1.9 2000/11/30 22:02:20 jwise Exp $"); #include <unistd.h> #include <err.h> -static void strike __P((struct ship *, struct ship *)); +static void strike (struct ship *, struct ship *); void -table(rig, shot, hittable, on, from, roll) -struct ship *on, *from; -int rig, shot, hittable, roll; +table(int rig, int shot, int hittable, struct ship *on, struct ship *from, int roll) { int hhits = 0, chits = 0, ghits = 0, rhits = 0; int Ghit = 0, Hhit = 0, Rhit = 0, Chit = 0; @@ -244,9 +242,7 @@ int rig, shot, hittable, roll; } void -Cleansnag(from, to, all, flag) -struct ship *from, *to; -char all, flag; +Cleansnag(struct ship *from, struct ship *to, int all, int flag) { if (flag & 1) { Write(W_UNGRAP, from, to->file->index, all, 0, 0); @@ -271,8 +267,7 @@ char all, flag; } static void -strike(ship, from) -struct ship *ship, *from; +strike(struct ship *ship, struct ship *from) { int points; diff --git a/sail/dr_1.c b/sail/dr_1.c index 9437c8b6..bc6a6cca 100644 --- a/sail/dr_1.c +++ b/sail/dr_1.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_1.c,v 1.11 2000/11/30 22:02:20 jwise Exp $ */ +/* $NetBSD: dr_1.c,v 1.12 2001/01/01 21:57:37 jwise 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.11 2000/11/30 22:02:20 jwise Exp $"); +__RCSID("$NetBSD: dr_1.c,v 1.12 2001/01/01 21:57:37 jwise Exp $"); #endif #endif /* not lint */ @@ -46,7 +46,7 @@ __RCSID("$NetBSD: dr_1.c,v 1.11 2000/11/30 22:02:20 jwise Exp $"); #include <stdlib.h> void -unfoul() +unfoul(void) { struct ship *sp; struct ship *to; @@ -69,7 +69,7 @@ unfoul() } void -boardcomp() +boardcomp(void) { int crew[3]; struct ship *sp, *sq; @@ -134,9 +134,7 @@ boardcomp() } int -fightitout(from, to, key) -struct ship *from, *to; -int key; +fightitout(struct ship *from, struct ship *to, int key) { struct ship *fromcap, *tocap; int crewfrom[3], crewto[3], menfrom, mento; @@ -190,7 +188,7 @@ int key; subtract(from, totalfrom, crewfrom, fromcap, pcfrom); subtract(to, totalto, crewto, tocap, pcto); makemsg(from, "boarders from %s repelled", to->shipname); - (void) sprintf(message, "killed in melee: %d. %s: %d", + sprintf(message, "killed in melee: %d. %s: %d", totalto, from->shipname, totalfrom); Writestr(W_SIGNAL, to, message); if (key) @@ -222,8 +220,7 @@ int key; subtract(to, mento, crewto, tocap, pcto); subtract(from, - mento, crewfrom, to, 0); } - (void) sprintf(message, "captured by the %s!", - to->shipname); + sprintf(message, "captured by the %s!", to->shipname); Writestr(W_SIGNAL, from, message); (void) sprintf(message, "killed in melee: %d. %s: %d", totalto, from->shipname, totalfrom); @@ -236,7 +233,7 @@ int key; } void -resolve() +resolve(void) { int thwart; struct ship *sp, *sq; @@ -246,7 +243,7 @@ resolve() continue; for (sq = sp + 1; sq < ls; sq++) if (sq->file->dir && meleeing(sp, sq) && meleeing(sq, sp)) - (void) fightitout(sp, sq, 0); + fightitout(sp, sq, 0); thwart = 2; foreachship(sq) { if (sq->file->dir && meleeing(sq, sp)) @@ -267,7 +264,7 @@ resolve() } void -compcombat() +compcombat(void) { int n; struct ship *sp; @@ -399,7 +396,7 @@ compcombat() } int -next() +next(void) { if (++turn % 55 == 0) { if (alive) @@ -430,7 +427,7 @@ next() *tp = toupper(*tp); p = tp; } - (void) strncpy(bestship->file->captain, p, + strncpy(bestship->file->captain, p, sizeof bestship->file->captain); bestship->file->captain [sizeof bestship->file->captain - 1] = 0; diff --git a/sail/dr_2.c b/sail/dr_2.c index 13366a98..236faac7 100644 --- a/sail/dr_2.c +++ b/sail/dr_2.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_2.c,v 1.12 2000/11/30 22:02:20 jwise Exp $ */ +/* $NetBSD: dr_2.c,v 1.13 2001/01/01 21:57:37 jwise 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.12 2000/11/30 22:02:20 jwise Exp $"); +__RCSID("$NetBSD: dr_2.c,v 1.13 2001/01/01 21:57:37 jwise Exp $"); #endif #endif /* not lint */ @@ -48,7 +48,7 @@ __RCSID("$NetBSD: dr_2.c,v 1.12 2000/11/30 22:02:20 jwise Exp $"); #define couldwin(f,t) (f->specs->crew2 > t->specs->crew2 * 1.5) void -thinkofgrapples() +thinkofgrapples(void) { struct ship *sp, *sq; char friendly; @@ -79,7 +79,7 @@ thinkofgrapples() } void -checkup() +checkup(void) { struct ship *sp, *sq; char explode, sink; @@ -110,7 +110,7 @@ checkup() } void -prizecheck() +prizecheck(void) { struct ship *sp; @@ -128,8 +128,7 @@ prizecheck() } int -str_end(str) - const char *str; +str_end(const char *str) { const char *p; @@ -139,10 +138,7 @@ str_end(str) } void -closeon(from, to, command, ta, ma, af) -struct ship *from, *to; -char command[]; -int ma, ta, af; +closeon(struct ship *from, struct ship *to, char *command, int ta, int ma, int af) { int high; char temp[10]; @@ -155,10 +151,7 @@ int ma, ta, af; const int dtab[] = {0,1,1,2,3,4,4,5}; /* diagonal distances in x==y */ int -score(movement, ship, to, onlytemp) -char movement[]; -struct ship *ship, *to; -char onlytemp; +score(char *movement, struct ship *ship, struct ship *to, int onlytemp) { char drift; int row, col, dir, total, ran; @@ -171,7 +164,7 @@ char onlytemp; drift = fp->drift; move_ship(movement, ship, &fp->dir, &fp->row, &fp->col, &drift); if (!*movement) - (void) strcpy(movement, "d"); + strcpy(movement, "d"); ran = range(ship, to); total = -50 * ran; @@ -189,12 +182,7 @@ char onlytemp; } void -move_ship(p, ship, dir, row, col, drift) -const char *p; -struct ship *ship; -unsigned char *dir; -short *row, *col; -char *drift; +move_ship(const char *p, struct ship *ship, unsigned char *dir, short *row, short *col, char *drift) { int dist; char moved = 0; @@ -234,10 +222,7 @@ char *drift; } void -try(command, temp, ma, ta, af, vma, dir, f, t, high, rakeme) -struct ship *f, *t; -int ma, ta, af, vma, dir, *high, rakeme; -char command[], temp[]; +try(char *command, char *temp, int ma, int ta, int af, int vma, int dir, struct ship *f, struct ship *t, int *high, int rakeme) { int new, n; char st[4]; @@ -245,33 +230,33 @@ char command[], temp[]; if ((n = str_end(temp)) < '1' || n > '9') for (n = 1; vma - n >= 0; n++) { - (void) sprintf(st, "%d", n); - (void) strcat(temp, st); + sprintf(st, "%d", n); + strcat(temp, st); new = score(temp, f, t, rakeme); if (new > *high && (!rakeme || rakeyou)) { *high = new; - (void) strcpy(command, temp); + strcpy(command, temp); } try(command, temp, ma-n, ta, af, vma-n, dir, f, t, high, rakeme); rmend(temp); } if ((ma > 0 && ta > 0 && (n = str_end(temp)) != 'l' && n != 'r') || !strlen(temp)) { - (void) strcat(temp, "r"); + strcat(temp, "r"); new = score(temp, f, t, rakeme); if (new > *high && (!rakeme || (gunsbear(f, t) && !gunsbear(t, f)))) { *high = new; - (void) strcpy(command, temp); + strcpy(command, temp); } try(command, temp, ma-1, ta-1, af, min(ma-1, maxmove(f, (dir == 8 ? 1 : dir+1), 0)), (dir == 8 ? 1 : dir+1),f,t,high,rakeme); rmend(temp); } if ((ma > 0 && ta > 0 && (n = str_end(temp)) != 'l' && n != 'r') || !strlen(temp)){ - (void) strcat(temp, "l"); + strcat(temp, "l"); new = score(temp, f, t, rakeme); if (new > *high && (!rakeme || (gunsbear(f, t) && !gunsbear(t, f)))){ *high = new; - (void) strcpy(command, temp); + strcpy(command, temp); } try(command, temp, ma-1, ta-1, af, (min(ma-1,maxmove(f, (dir-1 ? dir-1 : 8), 0))), (dir-1 ? dir -1 : 8), f, t, high, rakeme); rmend(temp); @@ -279,8 +264,7 @@ char command[], temp[]; } void -rmend(str) -char *str; +rmend(char *str) { char *p; diff --git a/sail/dr_3.c b/sail/dr_3.c index a1e893b6..b10fae42 100644 --- a/sail/dr_3.c +++ b/sail/dr_3.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_3.c,v 1.8 2000/11/30 22:02:20 jwise Exp $ */ +/* $NetBSD: dr_3.c,v 1.9 2001/01/01 21:57:37 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,15 +38,16 @@ #if 0 static char sccsid[] = "@(#)dr_3.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: dr_3.c,v 1.8 2000/11/30 22:02:20 jwise Exp $"); +__RCSID("$NetBSD: dr_3.c,v 1.9 2001/01/01 21:57:37 jwise Exp $"); #endif #endif /* not lint */ #include "driver.h" #include <stdlib.h> +/* move all comp ships */ void -moveall() /* move all comp ships */ +moveall(void) { struct ship *sp, *sq; int n; @@ -86,10 +87,10 @@ moveall() /* move all comp ships */ n = 0; foreachship(sp) { if (snagged(sp)) - (void) strcpy(sp->file->movebuf, "d"); + strcpy(sp->file->movebuf, "d"); else if (*sp->file->movebuf != 'd') - (void) strcat(sp->file->movebuf, "d"); + strcat(sp->file->movebuf, "d"); row[n] = sp->file->row; col[n] = sp->file->col; dir[n] = sp->file->dir; @@ -183,8 +184,7 @@ moveall() /* move all comp ships */ } int -stillmoving(k) -int k; +stillmoving(int k) { struct ship *sp; @@ -195,8 +195,7 @@ int k; } int -is_isolated(ship) -struct ship *ship; +is_isolated(struct ship *ship) { struct ship *sp; @@ -208,8 +207,7 @@ struct ship *ship; } int -push(from, to) -struct ship *from, *to; +push(struct ship *from, struct ship *to) { int bs, sb; @@ -223,10 +221,7 @@ struct ship *from, *to; } void -step(com, sp, moved) -char com; -struct ship *sp; -char *moved; +step(int com, struct ship *sp, char *moved) { int dist; @@ -266,10 +261,7 @@ char *moved; } void -sendbp(from, to, sections, isdefense) -struct ship *from, *to; -int sections; -char isdefense; +sendbp(struct ship *from, struct ship *to, int sections, int isdefense) { int n; struct BP *bp; @@ -288,9 +280,7 @@ char isdefense; } int -is_toughmelee(ship, to, isdefense, count) -struct ship *ship, *to; -int isdefense, count; +is_toughmelee(struct ship *ship, struct ship *to, int isdefense, int count) { struct BP *bp; int obp = 0; @@ -321,7 +311,7 @@ int isdefense, count; } void -reload() +reload(void) { struct ship *sp; @@ -331,7 +321,7 @@ reload() } void -checksails() +checksails(void) { struct ship *sp; int rig, full; diff --git a/sail/dr_4.c b/sail/dr_4.c index 1738f149..2617ddcc 100644 --- a/sail/dr_4.c +++ b/sail/dr_4.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_4.c,v 1.8 2000/11/30 22:02:20 jwise Exp $ */ +/* $NetBSD: dr_4.c,v 1.9 2001/01/01 21:57:37 jwise 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.8 2000/11/30 22:02:20 jwise Exp $"); +__RCSID("$NetBSD: dr_4.c,v 1.9 2001/01/01 21:57:37 jwise Exp $"); #endif #endif /* not lint */ @@ -46,8 +46,7 @@ __RCSID("$NetBSD: dr_4.c,v 1.8 2000/11/30 22:02:20 jwise Exp $"); #include <stdlib.h> void -ungrap(from, to) -struct ship *from, *to; +ungrap(struct ship *from, struct ship *to) { int k; char friend; @@ -64,8 +63,7 @@ struct ship *from, *to; } void -grap(from, to) -struct ship *from, *to; +grap(struct ship *from, struct ship *to) { if (capship(from)->nationality != capship(to)->nationality && dieroll() > 2) return; diff --git a/sail/dr_5.c b/sail/dr_5.c index 316a8da4..a48e549e 100644 --- a/sail/dr_5.c +++ b/sail/dr_5.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_5.c,v 1.6 1999/02/10 00:45:45 hubertf Exp $ */ +/* $NetBSD: dr_5.c,v 1.7 2001/01/01 21:57:38 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,17 +38,14 @@ #if 0 static char sccsid[] = "@(#)dr_5.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: dr_5.c,v 1.6 1999/02/10 00:45:45 hubertf Exp $"); +__RCSID("$NetBSD: dr_5.c,v 1.7 2001/01/01 21:57:38 jwise Exp $"); #endif #endif /* not lint */ #include "extern.h" void -subtract(from, totalfrom, crewfrom, fromcap, pcfrom) -struct ship *from, *fromcap; -int pcfrom; -int totalfrom, crewfrom[3]; +subtract(struct ship *from, int totalfrom, int *crewfrom, struct ship *fromcap, int pcfrom) { int n; @@ -71,10 +68,7 @@ int totalfrom, crewfrom[3]; } int -mensent(from, to, crew, captured, pc, isdefense) -struct ship *from, *to, **captured; -int crew[3], *pc; -char isdefense; +mensent(struct ship *from, struct ship *to, int *crew, struct ship **captured, int *pc, int isdefense) { /* returns # of crew squares sent */ int men = 0; int n; diff --git a/sail/dr_main.c b/sail/dr_main.c index 38bb33ec..4e7778c9 100644 --- a/sail/dr_main.c +++ b/sail/dr_main.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_main.c,v 1.6 2000/02/09 22:27:55 jsm Exp $ */ +/* $NetBSD: dr_main.c,v 1.7 2001/01/01 21:57:38 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)dr_main.c 8.2 (Berkeley) 4/16/94"; #else -__RCSID("$NetBSD: dr_main.c,v 1.6 2000/02/09 22:27:55 jsm Exp $"); +__RCSID("$NetBSD: dr_main.c,v 1.7 2001/01/01 21:57:38 jwise Exp $"); #endif #endif /* not lint */ @@ -47,16 +47,16 @@ __RCSID("$NetBSD: dr_main.c,v 1.6 2000/02/09 22:27:55 jsm Exp $"); #include <unistd.h> int -dr_main() +dr_main(void) { int n; struct ship *sp; int nat[NNATION]; int value = 0; - (void) signal(SIGINT, SIG_IGN); - (void) signal(SIGQUIT, SIG_IGN); - (void) signal(SIGTSTP, SIG_IGN); + signal(SIGINT, SIG_IGN); + signal(SIGQUIT, SIG_IGN); + signal(SIGTSTP, SIG_IGN); if (game < 0 || game >= NSCENE) { fprintf(stderr, "DRIVER: Bad game number %d\n", game); exit(1); @@ -72,7 +72,7 @@ dr_main() foreachship(sp) { if (sp->file == NULL && (sp->file = (struct File *)calloc(1, sizeof (struct File))) == NULL) { - (void) fprintf(stderr, "DRIVER: Out of memory.\n"); + fprintf(stderr, "DRIVER: Out of memory.\n"); exit(1); } sp->file->index = sp - SHIP(0); diff --git a/sail/extern.h b/sail/extern.h index be09b24b..65f06bf9 100644 --- a/sail/extern.h +++ b/sail/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.17 2000/11/30 22:06:04 jwise Exp $ */ +/* $NetBSD: extern.h,v 1.18 2001/01/01 21:57:38 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -317,10 +317,10 @@ void thinkofgrapples (void); void checkup (void); void prizecheck (void); int str_end (const char *); -void closeon (struct ship *, struct ship *, char[], int, int, int); -int score (char[], struct ship *, struct ship *, int); +void closeon (struct ship *, struct ship *, char *, int, int, int); +int score (char *, struct ship *, struct ship *, int); void move_ship (const char *, struct ship *, unsigned char *, short *, short *, char *); -void try (char[], char [], int, int, int, int, int, struct ship *, +void try (char *, char *, int, int, int, int, int, struct ship *, struct ship *, int *, int); void rmend (char *); diff --git a/sail/game.c b/sail/game.c index 1b524dc5..ae871273 100644 --- a/sail/game.c +++ b/sail/game.c @@ -1,4 +1,4 @@ -/* $NetBSD: game.c,v 1.6 1999/09/17 17:07:11 jsm Exp $ */ +/* $NetBSD: game.c,v 1.7 2001/01/01 21:57:38 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,16 +38,14 @@ #if 0 static char sccsid[] = "@(#)game.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: game.c,v 1.6 1999/09/17 17:07:11 jsm Exp $"); +__RCSID("$NetBSD: game.c,v 1.7 2001/01/01 21:57:38 jwise Exp $"); #endif #endif /* not lint */ #include "extern.h" int -maxturns(ship, af) -struct ship *ship; -char *af; +maxturns(struct ship *ship, char *af) { int turns; @@ -62,9 +60,7 @@ char *af; } int -maxmove(ship, dir, fs) -struct ship *ship; -int dir, fs; +maxmove(struct ship *ship, int dir, int fs) { int riggone = 0, Move, flank = 0; diff --git a/sail/lo_main.c b/sail/lo_main.c index 3909864e..f1914ad7 100644 --- a/sail/lo_main.c +++ b/sail/lo_main.c @@ -1,4 +1,4 @@ -/* $NetBSD: lo_main.c,v 1.7 2000/07/03 03:57:43 matt Exp $ */ +/* $NetBSD: lo_main.c,v 1.8 2001/01/01 21:57:38 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)lo_main.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: lo_main.c,v 1.7 2000/07/03 03:57:43 matt Exp $"); +__RCSID("$NetBSD: lo_main.c,v 1.8 2001/01/01 21:57:38 jwise Exp $"); #endif #endif /* not lint */ @@ -60,7 +60,7 @@ const char *const title[] = { }; int -lo_main() +lo_main(void) { FILE *fp; char sbuf[32]; @@ -86,10 +86,9 @@ lo_main() while (fread((char *)&log, sizeof log, 1, fp) == 1 && log.l_name[0] != '\0') { if (longfmt && (pass = getpwuid(log.l_uid)) != NULL) - (void) sprintf(sbuf, "%10.10s (%s)", - log.l_name, pass->pw_name); + sprintf(sbuf, "%10.10s (%s)", log.l_name, pass->pw_name); else - (void) sprintf(sbuf, "%20.20s", log.l_name); + sprintf(sbuf, "%20.20s", log.l_name); ship = &scene[log.l_gamenum].ship[log.l_shipnum]; printf("%-10s %21s of the %15s %3d points, %5.2f equiv\n", title[n++], sbuf, ship->shipname, log.l_netpoints, diff --git a/sail/main.c b/sail/main.c index ba4b3cfc..63830153 100644 --- a/sail/main.c +++ b/sail/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.13 2000/11/30 22:07:24 jwise Exp $ */ +/* $NetBSD: main.c,v 1.14 2001/01/01 21:57:38 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\ #if 0 static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: main.c,v 1.13 2000/11/30 22:07:24 jwise Exp $"); +__RCSID("$NetBSD: main.c,v 1.14 2001/01/01 21:57:38 jwise Exp $"); #endif #endif /* not lint */ @@ -53,8 +53,6 @@ __RCSID("$NetBSD: main.c,v 1.13 2000/11/30 22:07:24 jwise Exp $"); #include <stdlib.h> #include <string.h> -int main (int, char **); - int main(int argc, char **argv) { diff --git a/sail/misc.c b/sail/misc.c index 3247cff7..a1e91ce3 100644 --- a/sail/misc.c +++ b/sail/misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.6 2000/02/09 22:27:56 jsm Exp $ */ +/* $NetBSD: misc.c,v 1.7 2001/01/01 21:57:38 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: misc.c,v 1.6 2000/02/09 22:27:56 jsm Exp $"); +__RCSID("$NetBSD: misc.c,v 1.7 2001/01/01 21:57:38 jwise Exp $"); #endif #endif /* not lint */ @@ -52,8 +52,7 @@ __RCSID("$NetBSD: misc.c,v 1.6 2000/02/09 22:27:56 jsm Exp $"); /* XXX */ int -range(from, to) -struct ship *from, *to; +range(struct ship *from, struct ship *to) { int bow1r, bow1c, bow2r, bow2c; int stern1r, stern1c, stern2c, stern2r; @@ -80,9 +79,7 @@ struct ship *from, *to; } struct ship * -closestenemy(from, side, anyship) -struct ship *from; -char side, anyship; +closestenemy(struct ship *from, int side, int anyship) { struct ship *sp; char a; @@ -109,8 +106,7 @@ char side, anyship; } int -angle(dr, dc) -int dr, dc; +angle(int dr, int dc) { int i; @@ -136,9 +132,9 @@ int dr, dc; return i % 8 + 1; } +/* checks for target bow or stern */ int -gunsbear(from, to) /* checks for target bow or stern */ -struct ship *from, *to; +gunsbear(struct ship *from, struct ship *to) { int Dr, Dc, i; int ang; @@ -158,11 +154,10 @@ struct ship *from, *to; return 0; } +/* returns true if fromship is shooting at onship's starboard side */ int -portside(from, on, quick) -struct ship *from, *on; -int quick; /* returns true if fromship is */ -{ /* shooting at onship's starboard side */ +portside(struct ship *from, struct ship *on, int quick) +{ int ang; int Dr, Dc; @@ -180,8 +175,7 @@ int quick; /* returns true if fromship is */ } int -colours(sp) -struct ship *sp; +colours(struct ship *sp) { char flag = '\0'; @@ -198,8 +192,7 @@ struct ship *sp; } void -logger(s) -struct ship *s; +logger(struct ship *s) { FILE *fp; int persons; @@ -226,27 +219,24 @@ struct ship *s; = lp->l_gamenum = lp->l_netpoints = 0; rewind(fp); if (persons < 0) - (void) putw(1, fp); + putw(1, fp); else - (void) putw(persons + 1, fp); + putw(persons + 1, fp); for (lp = log; lp < &log[NLOG]; lp++) if (net > (float)lp->l_netpoints / scene[lp->l_gamenum].ship[lp->l_shipnum].specs->pts) { - (void) fwrite((char *)log, - sizeof (struct logs), lp - log, fp); - (void) strcpy(log[NLOG-1].l_name, s->file->captain); + fwrite((char *)log, sizeof (struct logs), lp - log, fp); + strcpy(log[NLOG-1].l_name, s->file->captain); log[NLOG-1].l_uid = getuid(); log[NLOG-1].l_shipnum = s->file->index; log[NLOG-1].l_gamenum = game; log[NLOG-1].l_netpoints = s->file->points; - (void) fwrite((char *)&log[NLOG-1], - sizeof (struct logs), 1, fp); - (void) fwrite((char *)lp, - sizeof (struct logs), &log[NLOG-1] - lp, fp); + fwrite((char *)&log[NLOG-1], sizeof (struct logs), 1, fp); + fwrite((char *)lp, sizeof (struct logs), &log[NLOG-1] - lp, fp); break; } #ifdef LOCK_EX - (void) flock(fileno(fp), LOCK_UN); + flock(fileno(fp), LOCK_UN); #endif - (void) fclose(fp); + fclose(fp); } diff --git a/sail/parties.c b/sail/parties.c index 4e6994c5..f4df352a 100644 --- a/sail/parties.c +++ b/sail/parties.c @@ -1,4 +1,4 @@ -/* $NetBSD: parties.c,v 1.6 1999/02/10 00:45:46 hubertf Exp $ */ +/* $NetBSD: parties.c,v 1.7 2001/01/01 21:57:38 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,16 +38,14 @@ #if 0 static char sccsid[] = "@(#)parties.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: parties.c,v 1.6 1999/02/10 00:45:46 hubertf Exp $"); +__RCSID("$NetBSD: parties.c,v 1.7 2001/01/01 21:57:38 jwise Exp $"); #endif #endif /* not lint */ #include "extern.h" int -meleeing(from, to) -struct ship *from; -struct ship *to; +meleeing(struct ship *from, struct ship *to) { struct BP *p = from->file->OBP; struct BP *q = p + NBP; @@ -59,9 +57,7 @@ struct ship *to; } int -boarding(from, isdefense) -struct ship *from; -char isdefense; +boarding(struct ship *from, int isdefense) { struct BP *p = isdefense ? from->file->DBP : from->file->OBP; struct BP *q = p + NBP; @@ -73,9 +69,7 @@ char isdefense; } void -unboard(ship, to, isdefense) -struct ship *ship, *to; -char isdefense; +unboard(struct ship *ship, struct ship *to, int isdefense) { struct BP *p = isdefense ? ship->file->DBP : ship->file->OBP; int n; diff --git a/sail/pl_1.c b/sail/pl_1.c index fe1b008f..56d7ad3b 100644 --- a/sail/pl_1.c +++ b/sail/pl_1.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_1.c,v 1.8 2000/07/03 03:57:43 matt Exp $ */ +/* $NetBSD: pl_1.c,v 1.9 2001/01/01 21:57:38 jwise 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.8 2000/07/03 03:57:43 matt Exp $"); +__RCSID("$NetBSD: pl_1.c,v 1.9 2001/01/01 21:57:38 jwise Exp $"); #endif #endif /* not lint */ @@ -57,14 +57,13 @@ __RCSID("$NetBSD: pl_1.c,v 1.8 2000/07/03 03:57:43 matt Exp $"); * because of a Sync() failure. */ void -leave(conditions) -int conditions; +leave(int conditions) { - (void) signal(SIGHUP, SIG_IGN); - (void) signal(SIGINT, SIG_IGN); - (void) signal(SIGQUIT, SIG_IGN); - (void) signal(SIGALRM, SIG_IGN); - (void) signal(SIGCHLD, SIG_IGN); + signal(SIGHUP, SIG_IGN); + signal(SIGINT, SIG_IGN); + signal(SIGQUIT, SIG_IGN); + signal(SIGALRM, SIG_IGN); + signal(SIGCHLD, SIG_IGN); if (done_curses) { Msg("It looks like you've had it!"); @@ -111,7 +110,7 @@ int conditions; makemsg(ms, "Captain %s relinquishing.", mf->captain); Write(W_END, ms, 0, 0, 0, 0); - (void) Sync(); + Sync(); } } sync_close(!hasdriver); @@ -122,25 +121,23 @@ int conditions; /*ARGSUSED*/ void -choke(n) - int n __attribute__((__unused__)); +choke(int n __attribute__((__unused__))) { leave(LEAVE_QUIT); } /*ARGSUSED*/ void -child(n) - int n __attribute__((__unused__)); +child(int n __attribute__((__unused__))) { union wait status; int pid; - (void) signal(SIGCHLD, SIG_IGN); + signal(SIGCHLD, SIG_IGN); do { pid = wait3((int *)&status, WNOHANG, (struct rusage *)0); if (pid < 0 || (pid > 0 && !WIFSTOPPED(status))) hasdriver = 0; } while (pid > 0); - (void) signal(SIGCHLD, child); + signal(SIGCHLD, child); } diff --git a/sail/pl_2.c b/sail/pl_2.c index 1ac1d205..f69f7ebe 100644 --- a/sail/pl_2.c +++ b/sail/pl_2.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_2.c,v 1.4 1997/10/13 19:45:01 christos Exp $ */ +/* $NetBSD: pl_2.c,v 1.5 2001/01/01 21:57:38 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,14 +38,14 @@ #if 0 static char sccsid[] = "@(#)pl_2.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_2.c,v 1.4 1997/10/13 19:45:01 christos Exp $"); +__RCSID("$NetBSD: pl_2.c,v 1.5 2001/01/01 21:57:38 jwise Exp $"); #endif #endif /* not lint */ #include "player.h" void -play() +play(void) { struct ship *sp; diff --git a/sail/pl_3.c b/sail/pl_3.c index 9b476f6c..0fc3588b 100644 --- a/sail/pl_3.c +++ b/sail/pl_3.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_3.c,v 1.9 2000/11/30 22:02:20 jwise Exp $ */ +/* $NetBSD: pl_3.c,v 1.10 2001/01/01 21:57:38 jwise 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.9 2000/11/30 22:02:20 jwise Exp $"); +__RCSID("$NetBSD: pl_3.c,v 1.10 2001/01/01 21:57:38 jwise Exp $"); #endif #endif /* not lint */ @@ -46,7 +46,7 @@ __RCSID("$NetBSD: pl_3.c,v 1.9 2000/11/30 22:02:20 jwise Exp $"); #include <stdlib.h> void -acceptcombat() +acceptcombat(void) { int men = 0; int target, temp; @@ -219,7 +219,7 @@ acceptcombat() } void -grapungrap() +grapungrap(void) { struct ship *sp; int i; @@ -259,7 +259,7 @@ grapungrap() } void -unfoulplayer() +unfoulplayer(void) { struct ship *to; int i; diff --git a/sail/pl_4.c b/sail/pl_4.c index 37c16446..bff20cbc 100644 --- a/sail/pl_4.c +++ b/sail/pl_4.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_4.c,v 1.8 1999/09/08 21:17:59 jsm Exp $ */ +/* $NetBSD: pl_4.c,v 1.9 2001/01/01 21:57:38 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,14 +38,14 @@ #if 0 static char sccsid[] = "@(#)pl_4.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_4.c,v 1.8 1999/09/08 21:17:59 jsm Exp $"); +__RCSID("$NetBSD: pl_4.c,v 1.9 2001/01/01 21:57:38 jwise Exp $"); #endif #endif /* not lint */ #include "player.h" void -changesail() +changesail(void) { int rig, full; @@ -72,7 +72,7 @@ changesail() } void -acceptsignal() +acceptsignal(void) { char buf[60]; char *p = buf; @@ -87,7 +87,7 @@ acceptsignal() } void -lookout() +lookout(void) { struct ship *sp; char buf[3]; @@ -105,9 +105,7 @@ lookout() } const char * -saywhat(sp, flag) -struct ship *sp; -char flag; +saywhat(struct ship *sp, int flag) { if (sp->file->captain[0]) return sp->file->captain; @@ -122,8 +120,7 @@ char flag; } void -eyeball(ship) -struct ship *ship; +eyeball(struct ship *ship) { int i; diff --git a/sail/pl_5.c b/sail/pl_5.c index 4fd74786..fa873d50 100644 --- a/sail/pl_5.c +++ b/sail/pl_5.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_5.c,v 1.7 1999/02/10 00:45:46 hubertf Exp $ */ +/* $NetBSD: pl_5.c,v 1.8 2001/01/01 21:57:38 jwise 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.7 1999/02/10 00:45:46 hubertf Exp $"); +__RCSID("$NetBSD: pl_5.c,v 1.8 2001/01/01 21:57:38 jwise Exp $"); #endif #endif /* not lint */ @@ -47,7 +47,7 @@ __RCSID("$NetBSD: pl_5.c,v 1.7 1999/02/10 00:45:46 hubertf Exp $"); #define turnfirst(x) (*x == 'r' || *x == 'l') void -acceptmove() +acceptmove(void) { int ta; int ma; @@ -65,7 +65,7 @@ acceptmove() ta = maxturns(ms, &af); ma = maxmove(ms, mf->dir, 0); - (void) sprintf(prompt, "move (%d,%c%d): ", ma, af ? '\'' : ' ', ta); + sprintf(prompt, "move (%d,%c%d): ", ma, af ? '\'' : ' ', ta); sgetstr(prompt, buf, sizeof buf); dir = mf->dir; vma = ma; @@ -140,15 +140,15 @@ acceptmove() } } if (*buf) - (void) strcpy(movebuf, buf); + strcpy(movebuf, buf); else - (void) strcpy(movebuf, "d"); + strcpy(movebuf, "d"); Writestr(W_MOVE, ms, movebuf); Msg("Helm: %s.", movebuf); } void -acceptboard() +acceptboard(void) { struct ship *sp; int n; @@ -201,11 +201,7 @@ acceptboard() } void -parties(crew, to, isdefense, buf) -struct ship *to; -int crew[3]; -char isdefense; -char buf; +parties(int *crew, struct ship *to, int isdefense, int buf) { int k, j, men; struct BP *ptr; @@ -231,26 +227,26 @@ char buf; Write(isdefense ? W_DBP : W_OBP, ms, j, turn, to->file->index, men); if (isdefense) { - (void) wmove(slot_w, 2, 0); + wmove(slot_w, 2, 0); for (k=0; k < NBP; k++) if (temp[k] && !crew[k]) - (void) waddch(slot_w, k + '1'); + waddch(slot_w, k + '1'); else - (void) wmove(slot_w, 2, 1 + k); - (void) mvwaddstr(slot_w, 3, 0, "DBP"); + wmove(slot_w, 2, 1 + k); + mvwaddstr(slot_w, 3, 0, "DBP"); makemsg(ms, "repelling boarders"); } else { - (void) wmove(slot_w, 0, 0); + wmove(slot_w, 0, 0); for (k=0; k < NBP; k++) if (temp[k] && !crew[k]) - (void) waddch(slot_w, k + '1'); + waddch(slot_w, k + '1'); else - (void) wmove(slot_w, 0, 1 + k); - (void) mvwaddstr(slot_w, 1, 0, "OBP"); + wmove(slot_w, 0, 1 + k); + mvwaddstr(slot_w, 1, 0, "OBP"); makesignal(ms, "boarding the $$", to); } blockalarm(); - (void) wrefresh(slot_w); + wrefresh(slot_w); unblockalarm(); } else Msg("Sending no crew sections."); diff --git a/sail/pl_6.c b/sail/pl_6.c index 48902668..6e58bd7b 100644 --- a/sail/pl_6.c +++ b/sail/pl_6.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_6.c,v 1.5 1999/02/10 00:45:46 hubertf Exp $ */ +/* $NetBSD: pl_6.c,v 1.6 2001/01/01 21:57:38 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,14 +38,14 @@ #if 0 static char sccsid[] = "@(#)pl_6.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_6.c,v 1.5 1999/02/10 00:45:46 hubertf Exp $"); +__RCSID("$NetBSD: pl_6.c,v 1.6 2001/01/01 21:57:38 jwise Exp $"); #endif #endif /* not lint */ #include "player.h" void -repair() +repair(void) { char c; char *repairs; @@ -139,7 +139,7 @@ repair() } int -turned() +turned(void) { char *p; @@ -150,7 +150,7 @@ turned() } void -loadplayer() +loadplayer(void) { char c; int loadL, loadR, ready, load; diff --git a/sail/pl_7.c b/sail/pl_7.c index 1679b10b..b876edca 100644 --- a/sail/pl_7.c +++ b/sail/pl_7.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_7.c,v 1.15 2000/07/03 03:57:44 matt Exp $ */ +/* $NetBSD: pl_7.c,v 1.16 2001/01/01 21:57:38 jwise 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.15 2000/07/03 03:57:44 matt Exp $"); +__RCSID("$NetBSD: pl_7.c,v 1.16 2001/01/01 21:57:38 jwise Exp $"); #endif #endif /* not lint */ @@ -79,7 +79,7 @@ struct File *mf; /* ms->file */ struct shipspecs *mc; /* ms->specs */ void -initscreen() +initscreen(void) { if (!SCREENTEST()) { printf("Can't sail on this terminal.\n"); @@ -92,21 +92,21 @@ initscreen() stat_w = newwin(STAT_Y, STAT_X, STAT_T, STAT_L); turn_w = newwin(TURN_Y, TURN_X, TURN_T, TURN_L); done_curses++; - (void) leaveok(view_w, 1); - (void) leaveok(slot_w, 1); - (void) leaveok(stat_w, 1); - (void) leaveok(turn_w, 1); + leaveok(view_w, 1); + leaveok(slot_w, 1); + leaveok(stat_w, 1); + leaveok(turn_w, 1); noecho(); crmode(); } void -cleanupscreen() +cleanupscreen(void) { /* alarm already turned off */ if (done_curses) { - (void) wmove(scroll_w, SCROLL_Y - 1, 0); - (void) wclrtoeol(scroll_w); + wmove(scroll_w, SCROLL_Y - 1, 0); + wclrtoeol(scroll_w); draw_screen(); endwin(); } @@ -114,13 +114,12 @@ cleanupscreen() /*ARGSUSED*/ void -newturn(n) - int n __attribute__((__unused__)); +newturn(int n __attribute__((__unused__))) { repaired = loaded = fired = changed = 0; movebuf[0] = '\0'; - (void) alarm(0); + alarm(0); if (mf->readyL & R_LOADING) { if (mf->readyL & R_DOUBLE) mf->readyL = R_LOADING; @@ -137,15 +136,15 @@ newturn(n) Write(W_DDEAD, SHIP(0), 0, 0, 0, 0); if (sc_hasprompt) { - (void) wmove(scroll_w, sc_line, 0); - (void) wclrtoeol(scroll_w); + wmove(scroll_w, sc_line, 0); + wclrtoeol(scroll_w); } if (Sync() < 0) leave(LEAVE_SYNC); if (!hasdriver) leave(LEAVE_DRIVER); if (sc_hasprompt) - (void) wprintw(scroll_w, "%s%s", sc_prompt, sc_buf); + wprintw(scroll_w, "%s%s", sc_prompt, sc_buf); if (turn % 50 == 0) Write(W_ALIVE, SHIP(0), 0, 0, 0, 0); @@ -164,76 +163,51 @@ newturn(n) adjustview(); draw_screen(); - (void) signal(SIGALRM, newturn); - (void) alarm(7); + signal(SIGALRM, newturn); + alarm(7); } /*VARARGS2*/ 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++); fmtship(format, sizeof(format), fmt, ship); - (void) vwprintw(scroll_w, format, ap); + 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); + vwprintw(scroll_w, fmt, ap); va_end(ap); Scroll(); } void -Scroll() +Scroll(void) { if (++sc_line >= SCROLL_Y) sc_line = 0; - (void) wmove(scroll_w, sc_line, 0); - (void) wclrtoeol(scroll_w); + wmove(scroll_w, sc_line, 0); + wclrtoeol(scroll_w); } void @@ -247,12 +221,11 @@ prompt(p, ship) sc_prompt = buf; sc_buf = ""; sc_hasprompt = 1; - (void) waddstr(scroll_w, buf); + waddstr(scroll_w, buf); } void -endprompt(flag) -char flag; +endprompt(int flag) { sc_hasprompt = 0; if (flag) @@ -260,29 +233,23 @@ char flag; } int -sgetch(p, ship, flag) - const char *p; - struct ship *ship; - char flag; +sgetch(const char *p, struct ship *ship, int flag) { int c; prompt(p, ship); blockalarm(); - (void) wrefresh(scroll_w); + wrefresh(scroll_w); unblockalarm(); while ((c = wgetch(scroll_w)) == EOF) ; if (flag && c >= ' ' && c < 0x7f) - (void) waddch(scroll_w, c); + waddch(scroll_w, c); endprompt(flag); return c; } void -sgetstr(pr, buf, n) - const char *pr; - char *buf; - int n; +sgetstr(const char *pr, char *buf, int n) { int c; char *p = buf; @@ -292,7 +259,7 @@ sgetstr(pr, buf, n) for (;;) { *p = 0; blockalarm(); - (void) wrefresh(scroll_w); + wrefresh(scroll_w); unblockalarm(); while ((c = wgetch(scroll_w)) == EOF) ; @@ -303,248 +270,248 @@ sgetstr(pr, buf, n) return; case '\b': if (p > buf) { - (void) waddstr(scroll_w, "\b \b"); + waddstr(scroll_w, "\b \b"); p--; } break; default: if (c >= ' ' && c < 0x7f && p < buf + n - 1) { *p++ = c; - (void) waddch(scroll_w, c); + waddch(scroll_w, c); } else - (void) putchar('\a'); + putchar('\a'); } } } void -draw_screen() +draw_screen(void) { draw_view(); draw_turn(); draw_stat(); draw_slot(); - (void) wrefresh(scroll_w); /* move the cursor */ + wrefresh(scroll_w); /* move the cursor */ } void -draw_view() +draw_view(void) { struct ship *sp; - (void) werase(view_w); + werase(view_w); foreachship(sp) { if (sp->file->dir && sp->file->row > viewrow && sp->file->row < viewrow + VIEW_Y && sp->file->col > viewcol && sp->file->col < viewcol + VIEW_X) { - (void) wmove(view_w, sp->file->row - viewrow, + wmove(view_w, sp->file->row - viewrow, sp->file->col - viewcol); - (void) waddch(view_w, colours(sp)); - (void) wmove(view_w, + waddch(view_w, colours(sp)); + wmove(view_w, sternrow(sp) - viewrow, sterncol(sp) - viewcol); - (void) waddch(view_w, sterncolour(sp)); + waddch(view_w, sterncolour(sp)); } } - (void) wrefresh(view_w); + wrefresh(view_w); } void -draw_turn() +draw_turn(void) { - (void) wmove(turn_w, 0, 0); - (void) wprintw(turn_w, "%cTurn %d", dont_adjust?'*':'-', turn); - (void) wrefresh(turn_w); + wmove(turn_w, 0, 0); + wprintw(turn_w, "%cTurn %d", dont_adjust?'*':'-', turn); + wrefresh(turn_w); } void -draw_stat() +draw_stat(void) { - (void) wmove(stat_w, STAT_1, 0); - (void) wprintw(stat_w, "Points %3d\n", mf->points); - (void) wprintw(stat_w, "Fouls %2d\n", fouled(ms)); - (void) wprintw(stat_w, "Grapples %2d\n", grappled(ms)); + wmove(stat_w, STAT_1, 0); + wprintw(stat_w, "Points %3d\n", mf->points); + wprintw(stat_w, "Fouls %2d\n", fouled(ms)); + wprintw(stat_w, "Grapples %2d\n", grappled(ms)); - (void) wmove(stat_w, STAT_2, 0); - (void) wprintw(stat_w, " 0 %c(%c)\n", + wmove(stat_w, STAT_2, 0); + wprintw(stat_w, " 0 %c(%c)\n", maxmove(ms, winddir + 3, -1) + '0', maxmove(ms, winddir + 3, 1) + '0'); - (void) waddstr(stat_w, " \\|/\n"); - (void) wprintw(stat_w, " -^-%c(%c)\n", + waddstr(stat_w, " \\|/\n"); + wprintw(stat_w, " -^-%c(%c)\n", maxmove(ms, winddir + 2, -1) + '0', maxmove(ms, winddir + 2, 1) + '0'); - (void) waddstr(stat_w, " /|\\\n"); - (void) wprintw(stat_w, " | %c(%c)\n", + waddstr(stat_w, " /|\\\n"); + wprintw(stat_w, " | %c(%c)\n", maxmove(ms, winddir + 1, -1) + '0', maxmove(ms, winddir + 1, 1) + '0'); - (void) wprintw(stat_w, " %c(%c)\n", + wprintw(stat_w, " %c(%c)\n", maxmove(ms, winddir, -1) + '0', maxmove(ms, winddir, 1) + '0'); - (void) wmove(stat_w, STAT_3, 0); - (void) wprintw(stat_w, "Load %c%c %c%c\n", + wmove(stat_w, STAT_3, 0); + wprintw(stat_w, "Load %c%c %c%c\n", loadname[mf->loadL], readyname(mf->readyL), loadname[mf->loadR], readyname(mf->readyR)); - (void) wprintw(stat_w, "Hull %2d\n", mc->hull); - (void) wprintw(stat_w, "Crew %2d %2d %2d\n", + wprintw(stat_w, "Hull %2d\n", mc->hull); + wprintw(stat_w, "Crew %2d %2d %2d\n", mc->crew1, mc->crew2, mc->crew3); - (void) wprintw(stat_w, "Guns %2d %2d\n", mc->gunL, mc->gunR); - (void) wprintw(stat_w, "Carr %2d %2d\n", mc->carL, mc->carR); - (void) wprintw(stat_w, "Rigg %d %d %d ", mc->rig1, mc->rig2, mc->rig3); + wprintw(stat_w, "Guns %2d %2d\n", mc->gunL, mc->gunR); + wprintw(stat_w, "Carr %2d %2d\n", mc->carL, mc->carR); + wprintw(stat_w, "Rigg %d %d %d ", mc->rig1, mc->rig2, mc->rig3); if (mc->rig4 < 0) - (void) waddch(stat_w, '-'); + waddch(stat_w, '-'); else - (void) wprintw(stat_w, "%d", mc->rig4); - (void) wrefresh(stat_w); + wprintw(stat_w, "%d", mc->rig4); + wrefresh(stat_w); } void -draw_slot() +draw_slot(void) { if (!boarding(ms, 0)) { - (void) mvwaddstr(slot_w, 0, 0, " "); - (void) mvwaddstr(slot_w, 1, 0, " "); + mvwaddstr(slot_w, 0, 0, " "); + mvwaddstr(slot_w, 1, 0, " "); } else - (void) mvwaddstr(slot_w, 1, 0, "OBP"); + mvwaddstr(slot_w, 1, 0, "OBP"); if (!boarding(ms, 1)) { - (void) mvwaddstr(slot_w, 2, 0, " "); - (void) mvwaddstr(slot_w, 3, 0, " "); + mvwaddstr(slot_w, 2, 0, " "); + mvwaddstr(slot_w, 3, 0, " "); } else - (void) mvwaddstr(slot_w, 3, 0, "DBP"); + mvwaddstr(slot_w, 3, 0, "DBP"); - (void) wmove(slot_w, SLOT_Y-4, 0); + wmove(slot_w, SLOT_Y-4, 0); if (mf->RH) - (void) wprintw(slot_w, "%dRH", mf->RH); + wprintw(slot_w, "%dRH", mf->RH); else - (void) waddstr(slot_w, " "); - (void) wmove(slot_w, SLOT_Y-3, 0); + waddstr(slot_w, " "); + wmove(slot_w, SLOT_Y-3, 0); if (mf->RG) - (void) wprintw(slot_w, "%dRG", mf->RG); + wprintw(slot_w, "%dRG", mf->RG); else - (void) waddstr(slot_w, " "); - (void) wmove(slot_w, SLOT_Y-2, 0); + waddstr(slot_w, " "); + wmove(slot_w, SLOT_Y-2, 0); if (mf->RR) - (void) wprintw(slot_w, "%dRR", mf->RR); + wprintw(slot_w, "%dRR", mf->RR); else - (void) waddstr(slot_w, " "); + waddstr(slot_w, " "); #define Y (SLOT_Y/2) - (void) wmove(slot_w, 7, 1); - (void) wprintw(slot_w,"%d", windspeed); - (void) mvwaddch(slot_w, Y, 0, ' '); - (void) mvwaddch(slot_w, Y, 2, ' '); - (void) mvwaddch(slot_w, Y-1, 0, ' '); - (void) mvwaddch(slot_w, Y-1, 1, ' '); - (void) mvwaddch(slot_w, Y-1, 2, ' '); - (void) mvwaddch(slot_w, Y+1, 0, ' '); - (void) mvwaddch(slot_w, Y+1, 1, ' '); - (void) mvwaddch(slot_w, Y+1, 2, ' '); - (void) wmove(slot_w, Y - dr[winddir], 1 - dc[winddir]); + wmove(slot_w, 7, 1); + wprintw(slot_w,"%d", windspeed); + mvwaddch(slot_w, Y, 0, ' '); + mvwaddch(slot_w, Y, 2, ' '); + mvwaddch(slot_w, Y-1, 0, ' '); + mvwaddch(slot_w, Y-1, 1, ' '); + mvwaddch(slot_w, Y-1, 2, ' '); + mvwaddch(slot_w, Y+1, 0, ' '); + mvwaddch(slot_w, Y+1, 1, ' '); + mvwaddch(slot_w, Y+1, 2, ' '); + wmove(slot_w, Y - dr[winddir], 1 - dc[winddir]); switch (winddir) { case 1: case 5: - (void) waddch(slot_w, '|'); + waddch(slot_w, '|'); break; case 2: case 6: - (void) waddch(slot_w, '/'); + waddch(slot_w, '/'); break; case 3: case 7: - (void) waddch(slot_w, '-'); + waddch(slot_w, '-'); break; case 4: case 8: - (void) waddch(slot_w, '\\'); + waddch(slot_w, '\\'); break; } - (void) mvwaddch(slot_w, Y + dr[winddir], 1 + dc[winddir], '+'); - (void) wrefresh(slot_w); + mvwaddch(slot_w, Y + dr[winddir], 1 + dc[winddir], '+'); + wrefresh(slot_w); } void -draw_board() +draw_board(void) { int n; - (void) clear(); - (void) werase(view_w); - (void) werase(slot_w); - (void) werase(scroll_w); - (void) werase(stat_w); - (void) werase(turn_w); + clear(); + werase(view_w); + werase(slot_w); + werase(scroll_w); + werase(stat_w); + werase(turn_w); sc_line = 0; - (void) move(BOX_T, BOX_L); + move(BOX_T, BOX_L); for (n = 0; n < BOX_X; n++) - (void) addch('-'); - (void) move(BOX_B, BOX_L); + addch('-'); + move(BOX_B, BOX_L); for (n = 0; n < BOX_X; n++) - (void) addch('-'); + addch('-'); for (n = BOX_T+1; n < BOX_B; n++) { - (void) mvaddch(n, BOX_L, '|'); - (void) mvaddch(n, BOX_R, '|'); + mvaddch(n, BOX_L, '|'); + mvaddch(n, BOX_R, '|'); } - (void) mvaddch(BOX_T, BOX_L, '+'); - (void) mvaddch(BOX_T, BOX_R, '+'); - (void) mvaddch(BOX_B, BOX_L, '+'); - (void) mvaddch(BOX_B, BOX_R, '+'); - (void) refresh(); + mvaddch(BOX_T, BOX_L, '+'); + mvaddch(BOX_T, BOX_R, '+'); + mvaddch(BOX_B, BOX_L, '+'); + mvaddch(BOX_B, BOX_R, '+'); + refresh(); #define WSaIM "Wooden Ships & Iron Men" - (void) wmove(view_w, 2, (VIEW_X - sizeof WSaIM - 1) / 2); - (void) waddstr(view_w, WSaIM); - (void) wmove(view_w, 4, (VIEW_X - strlen(cc->name)) / 2); - (void) waddstr(view_w, cc->name); - (void) wrefresh(view_w); - - (void) move(LINE_T, LINE_L); - (void) printw("Class %d %s (%d guns) '%s' (%c%c)", + wmove(view_w, 2, (VIEW_X - sizeof WSaIM - 1) / 2); + waddstr(view_w, WSaIM); + wmove(view_w, 4, (VIEW_X - strlen(cc->name)) / 2); + waddstr(view_w, cc->name); + wrefresh(view_w); + + move(LINE_T, LINE_L); + printw("Class %d %s (%d guns) '%s' (%c%c)", mc->class, classname[mc->class], mc->guns, ms->shipname, colours(ms), sterncolour(ms)); - (void) refresh(); + refresh(); } void -centerview() +centerview(void) { viewrow = mf->row - VIEW_Y / 2; viewcol = mf->col - VIEW_X / 2; } void -upview() +upview(void) { viewrow -= VIEW_Y / 3; } void -downview() +downview(void) { viewrow += VIEW_Y / 3; } void -leftview() +leftview(void) { viewcol -= VIEW_X / 5; } void -rightview() +rightview(void) { viewcol += VIEW_X / 5; } void -adjustview() +adjustview(void) { if (dont_adjust) return; diff --git a/sail/sync.c b/sail/sync.c index b6e93e1d..16714ff1 100644 --- a/sail/sync.c +++ b/sail/sync.c @@ -1,4 +1,4 @@ -/* $NetBSD: sync.c,v 1.14 2000/02/09 22:27:56 jsm Exp $ */ +/* $NetBSD: sync.c,v 1.15 2001/01/01 21:57:38 jwise 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.14 2000/02/09 22:27:56 jsm Exp $"); +__RCSID("$NetBSD: sync.c,v 1.15 2001/01/01 21:57:38 jwise Exp $"); #endif #endif /* not lint */ @@ -69,11 +69,7 @@ static long sync_seek; static FILE *sync_fp; void -fmtship(buf, len, fmt, ship) - char *buf; - size_t len; - const char *fmt; - struct ship *ship; +fmtship(char *buf, size_t len, const char *fmt, struct ship *ship) { while (*fmt) { if (len-- == 0) { @@ -98,78 +94,50 @@ fmtship(buf, len, fmt, ship) /*VARARGS3*/ void -#ifdef __STDC__ makesignal(struct ship *from, const char *fmt, struct ship *ship, ...) -#else -makesignal(va_alias) - va_dcl -#endif { char message[BUFSIZ]; char format[BUFSIZ]; va_list ap; -#ifndef __STDC__ - struct ship *from; - const char *fmt; - struct ship *ship; - 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); + vsprintf(message, format, ap); va_end(ap); Writestr(W_SIGNAL, from, message); } +/*VARARGS2*/ void -#ifdef __STDC__ makemsg(struct ship *from, const char *fmt, ...) -#else -makemsg(va_alias) - va_dcl -#endif { char message[BUFSIZ]; va_list ap; -#ifndef __STDC__ - struct ship *from; - const char *fmt; - va_start(ap); - from = va_arg(ap, struct ship *); - fmt = va_arg(ap, const char *); -#else va_start(ap, fmt); -#endif - (void) vsprintf(message, fmt, ap); + vsprintf(message, fmt, ap); va_end(ap); Writestr(W_SIGNAL, from, message); } int -sync_exists(game) - int game; +sync_exists(int game) { char buf[sizeof sync_file]; struct stat s; time_t t; - (void) sprintf(buf, SF, game); - (void) time(&t); + sprintf(buf, SF, game); + time(&t); setegid(egid); if (stat(buf, &s) < 0) { setegid(gid); return 0; } if (s.st_mtime < t - 60*60*2) { /* 2 hours */ - (void) unlink(buf); - (void) sprintf(buf, LF, game); - (void) unlink(buf); + unlink(buf); + sprintf(buf, LF, game); + unlink(buf); setegid(gid); return 0; } else { @@ -179,18 +147,18 @@ sync_exists(game) } int -sync_open() +sync_open(void) { struct stat tmp; if (sync_fp != NULL) - (void) fclose(sync_fp); - (void) sprintf(sync_lock, LF, game); - (void) sprintf(sync_file, SF, game); + fclose(sync_fp); + sprintf(sync_lock, LF, game); + sprintf(sync_file, SF, game); setegid(egid); if (stat(sync_file, &tmp) < 0) { mode_t omask = umask(002); sync_fp = fopen(sync_file, "w+"); - (void) umask(omask); + umask(omask); } else sync_fp = fopen(sync_file, "r+"); setegid(gid); @@ -201,54 +169,45 @@ sync_open() } void -sync_close(remove) - char remove; +sync_close(int remove) { if (sync_fp != 0) - (void) fclose(sync_fp); + fclose(sync_fp); if (remove) { setegid(egid); - (void) unlink(sync_file); + unlink(sync_file); setegid(gid); } } void -Write(type, ship, a, b, c, d) - int type; - struct ship *ship; - long a, b, c, d; +Write(int type, struct ship *ship, long a, long b, long c, long d) { - (void) sprintf(sync_bp, "%d %d 0 %ld %ld %ld %ld\n", + 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); + sync_update(type, ship, NULL, a, b, c, d); } void -Writestr(type, ship, a) - int type; - struct ship *ship; - const char *a; +Writestr(int type, struct ship *ship, const char *a) { - - (void) sprintf(sync_bp, "%d %d 1 %s\n", - type, ship->file->index, a); + 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, 0, 0, 0, 0); + sync_update(type, ship, a, 0, 0, 0, 0); } int -Sync() +Sync(void) { sig_t sighup, sigint; int n; @@ -280,7 +239,7 @@ Sync() } if (n <= 0) return -1; - (void) fseek(sync_fp, sync_seek, SEEK_SET); + fseek(sync_fp, sync_seek, SEEK_SET); for (;;) { switch (fscanf(sync_fp, "%d%d%d", &type, &shipnum, &isstr)) { case 3: @@ -326,31 +285,27 @@ bad: erred++; out: if (!erred && sync_bp != sync_buf) { - (void) fseek(sync_fp, 0L, SEEK_END); - (void) fwrite(sync_buf, sizeof *sync_buf, sync_bp - sync_buf, + fseek(sync_fp, 0L, SEEK_END); + fwrite(sync_buf, sizeof *sync_buf, sync_bp - sync_buf, sync_fp); - (void) fflush(sync_fp); + fflush(sync_fp); sync_bp = sync_buf; } sync_seek = ftell(sync_fp); #ifdef LOCK_EX - (void) flock(fileno(sync_fp), LOCK_UN); + flock(fileno(sync_fp), LOCK_UN); #else setegid(egid); - (void) unlink(sync_lock); + unlink(sync_lock); setegid(gid); #endif - (void) signal(SIGHUP, sighup); - (void) signal(SIGINT, sigint); + signal(SIGHUP, sighup); + signal(SIGINT, sigint); return erred ? -1 : 0; } int -sync_update(type, ship, astr, a, b, c, d) - int type; - struct ship *ship; - const char *astr; - long a, b, c, d; +sync_update(int type, struct ship *ship, const char *astr, long a, long b, long c, long d) { switch (type) { case W_DBP: { @@ -427,7 +382,7 @@ sync_update(type, ship, astr, a, b, c, d) break; } case W_CAPTAIN: - (void) strncpy(ship->file->captain, astr, + strncpy(ship->file->captain, astr, sizeof ship->file->captain - 1); ship->file->captain[sizeof ship->file->captain - 1] = 0; break; @@ -466,7 +421,7 @@ sync_update(type, ship, astr, a, b, c, d) ship->specs->hull = a; break; case W_MOVE: - (void) strncpy(ship->file->movebuf, astr, + strncpy(ship->file->movebuf, astr, sizeof ship->file->movebuf - 1); ship->file->movebuf[sizeof ship->file->movebuf - 1] = 0; break; @@ -529,7 +484,7 @@ sync_update(type, ship, astr, a, b, c, d) windspeed = b; break; case W_BEGIN: - (void) strcpy(ship->file->captain, "begin"); + strcpy(ship->file->captain, "begin"); people++; break; case W_END: |