summaryrefslogtreecommitdiffstats
path: root/sail
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2009-03-14 19:35:13 +0000
committerdholland <dholland@NetBSD.org>2009-03-14 19:35:13 +0000
commitfdc664b7bf17e7162301f1d0354f0094af2b08e5 (patch)
treed888f0121027af737b66f6d4abb9d3ef9f3abbaa /sail
parent458c440612e1d5d8ad36c7d3ab6f4a0a9e99aa93 (diff)
downloadbsdgames-darwin-fdc664b7bf17e7162301f1d0354f0094af2b08e5.tar.gz
bsdgames-darwin-fdc664b7bf17e7162301f1d0354f0094af2b08e5.tar.zst
bsdgames-darwin-fdc664b7bf17e7162301f1d0354f0094af2b08e5.zip
Lines <= 80 chars, remove trailing whitespace, other formatting adjustments.
No functional change.
Diffstat (limited to 'sail')
-rw-r--r--sail/assorted.c29
-rw-r--r--sail/display.h8
-rw-r--r--sail/dr_1.c22
-rw-r--r--sail/dr_2.c79
-rw-r--r--sail/dr_3.c23
-rw-r--r--sail/dr_4.c7
-rw-r--r--sail/dr_5.c10
-rw-r--r--sail/extern.h167
-rw-r--r--sail/game.c12
-rw-r--r--sail/globals.c19
-rw-r--r--sail/misc.c9
-rw-r--r--sail/pl_3.c7
-rw-r--r--sail/pl_5.c13
-rw-r--r--sail/pl_6.c6
-rw-r--r--sail/pl_7.c10
-rw-r--r--sail/pl_main.c7
-rw-r--r--sail/restart.h4
-rw-r--r--sail/sync.c13
18 files changed, 253 insertions, 192 deletions
diff --git a/sail/assorted.c b/sail/assorted.c
index cfc7d2ae..008fa630 100644
--- a/sail/assorted.c
+++ b/sail/assorted.c
@@ -1,4 +1,4 @@
-/* $NetBSD: assorted.c,v 1.15 2003/08/07 09:37:41 agc Exp $ */
+/* $NetBSD: assorted.c,v 1.16 2009/03/14 19:35:13 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)assorted.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: assorted.c,v 1.15 2003/08/07 09:37:41 agc Exp $");
+__RCSID("$NetBSD: assorted.c,v 1.16 2009/03/14 19:35:13 dholland Exp $");
#endif
#endif /* not lint */
@@ -42,10 +42,11 @@ __RCSID("$NetBSD: assorted.c,v 1.15 2003/08/07 09:37:41 agc Exp $");
#include <err.h>
#include "extern.h"
-static void strike (struct ship *, struct ship *);
+static void strike(struct ship *, struct ship *);
void
-table(struct ship *from, struct ship *on, int rig, int shot, int hittable, int roll)
+table(struct ship *from, struct ship *on,
+ int rig, int shot, int hittable, int roll)
{
int hhits = 0, chits = 0, ghits = 0, rhits = 0;
int Ghit = 0, Hhit = 0, Rhit = 0, Chit = 0;
@@ -65,9 +66,9 @@ table(struct ship *from, struct ship *on, int rig, int shot, int hittable, int r
rigg[1] = on->specs->rig2;
rigg[2] = on->specs->rig3;
rigg[3] = on->specs->rig4;
- if (shot == L_GRAPE)
+ if (shot == L_GRAPE) {
Chit = chits = hittable;
- else {
+ } else {
tp = &(rig ? RigTable : HullTable)[hittable][roll-1];
Chit = chits = tp->C;
Rhit = rhits = tp->R;
@@ -84,7 +85,7 @@ table(struct ship *from, struct ship *on, int rig, int shot, int hittable, int r
pc -= (chits + 1) / 2;
chits /= 2;
}
- for (n = 0; n < 3; n++)
+ for (n = 0; n < 3; n++) {
if (chits > crew[n]) {
chits -= crew[n];
crew[n] = 0;
@@ -92,14 +93,16 @@ table(struct ship *from, struct ship *on, int rig, int shot, int hittable, int r
crew[n] -= chits;
chits = 0;
}
- for (n = 0; n < 3; n++)
- if (rhits > rigg[n]){
+ }
+ for (n = 0; n < 3; n++) {
+ if (rhits > rigg[n]) {
rhits -= rigg[n];
rigg[n] = 0;
} else {
rigg[n] -= rhits;
rhits = 0;
}
+ }
if (rigg[3] != -1 && rhits > rigg[3]) {
rhits -= rigg[3];
rigg[3] = 0;
@@ -122,7 +125,7 @@ table(struct ship *from, struct ship *on, int rig, int shot, int hittable, int r
car -= ghits;
ghits = 0;
}
- if (ghits > guns){
+ if (ghits > guns) {
ghits -= guns;
guns = 0;
} else {
@@ -221,14 +224,16 @@ table(struct ship *from, struct ship *on, int rig, int shot, int hittable, int r
makemsg(on, message);
}
/*
- if (Chit > 1 && on->file->readyL&R_INITIAL && on->file->readyR&R_INITIAL) {
+ if (Chit > 1 && on->file->readyL & R_INITIAL &&
+ on->file->readyR & R_INITIAL) {
on->specs->qual--;
if (on->specs->qual <= 0) {
makemsg(on, "crew mutinying!");
on->specs->qual = 5;
Write(W_CAPTURED, on, on->file->index, 0, 0, 0);
- } else
+ } else {
makemsg(on, "crew demoralized");
+ }
Write(W_QUAL, on, on->specs->qual, 0, 0, 0);
}
*/
diff --git a/sail/display.h b/sail/display.h
index c7ad4a6d..034b477e 100644
--- a/sail/display.h
+++ b/sail/display.h
@@ -1,11 +1,11 @@
-/* $NetBSD: display.h,v 1.3 2008/04/28 20:22:54 martin Exp $ */
+/* $NetBSD: display.h,v 1.4 2009/03/14 19:35:13 dholland Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
- * by
+ * by
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,7 +30,9 @@
*/
#ifdef SIGTSTP
-#define SCREENTEST() (initscr() != NULL && signal(SIGTSTP, SIG_DFL) != SIG_ERR && STAT_R < COLS && SCROLL_Y > 0)
+#define SCREENTEST() (initscr() != NULL && \
+ signal(SIGTSTP, SIG_DFL) != SIG_ERR && \
+ STAT_R < COLS && SCROLL_Y > 0)
#else
#define SCREENTEST() (initscr() != NULL && STAT_R < COLS && SCROLL_Y > 0)
#endif
diff --git a/sail/dr_1.c b/sail/dr_1.c
index 5cdaef5d..eb7e2153 100644
--- a/sail/dr_1.c
+++ b/sail/dr_1.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dr_1.c,v 1.24 2009/03/09 04:38:39 dholland Exp $ */
+/* $NetBSD: dr_1.c,v 1.25 2009/03/14 19:35:13 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)dr_1.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: dr_1.c,v 1.24 2009/03/09 04:38:39 dholland Exp $");
+__RCSID("$NetBSD: dr_1.c,v 1.25 2009/03/14 19:35:13 dholland Exp $");
#endif
#endif /* not lint */
@@ -45,7 +45,7 @@ __RCSID("$NetBSD: dr_1.c,v 1.24 2009/03/09 04:38:39 dholland Exp $");
#include "extern.h"
#include "driver.h"
-static int fightitout(struct ship *, struct ship *, int);
+static int fightitout(struct ship *, struct ship *, int);
void
unfoul(void)
@@ -102,7 +102,7 @@ boardcomp(void)
/* OBP */
sendbp(sp, sq, crew[0]*100, 0);
crew[0] = 0;
- } else if (crew[1]){
+ } else if (crew[1]) {
/* OBP */
sendbp(sp, sq, crew[1]*10, 0);
crew[1] = 0;
@@ -247,7 +247,8 @@ resolve(void)
if (sp->file->dir == 0)
continue;
for (sq = sp + 1; sq < ls; sq++)
- if (sq->file->dir && meleeing(sp, sq) && meleeing(sq, sp))
+ if (sq->file->dir && meleeing(sp, sq) &&
+ meleeing(sq, sp))
fightitout(sp, sq, 0);
thwart = 2;
foreachship(sq) {
@@ -293,7 +294,7 @@ compcombat(void)
if (sp->file->DBP[n].turnsent)
men += sp->file->DBP[n].mensent;
}
- if (men){
+ if (men) {
crew[0] = men/100 ? 0 : crew[0] != 0;
crew[1] = (men%100)/10 ? 0 : crew[1] != 0;
crew[2] = men%10 ? 0 : crew[2] != 0;
@@ -319,7 +320,8 @@ compcombat(void)
closest = closestenemy(sp, r ? 'r' : 'l', 0);
if (closest == 0)
continue;
- if (range(closest, sp) > range(sp, closestenemy(sp, r ? 'r' : 'l', 1)))
+ if (range(closest, sp) >
+ range(sp, closestenemy(sp, r ? 'r' : 'l', 1)))
continue;
if (closest->file->struck)
continue;
@@ -360,13 +362,14 @@ compcombat(void)
if (rakehim && sternrake)
hit++;
hit += QUAL[indx][capship(sp)->specs->qual - 1];
- for (n = 0; n < 3 && sp->file->captured == 0; n++)
+ for (n = 0; n < 3 && sp->file->captured == 0; n++) {
if (!crew[n]) {
if (indx <= 5)
hit--;
else
hit -= 2;
}
+ }
if (ready & R_INITIAL) {
if (!r)
sp->file->readyL &= ~R_INITIAL;
@@ -394,7 +397,8 @@ compcombat(void)
if (hit >= 0) {
if (load != L_GRAPE)
hit = hit > 10 ? 10 : hit;
- table(sp, closest, shootat, load, hit, dieroll());
+ table(sp, closest, shootat, load, hit,
+ dieroll());
}
}
}
diff --git a/sail/dr_2.c b/sail/dr_2.c
index bbf145c0..56719fbd 100644
--- a/sail/dr_2.c
+++ b/sail/dr_2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dr_2.c,v 1.22 2009/03/14 18:32:47 dholland Exp $ */
+/* $NetBSD: dr_2.c,v 1.23 2009/03/14 19:35:13 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)dr_2.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: dr_2.c,v 1.22 2009/03/14 18:32:47 dholland Exp $");
+__RCSID("$NetBSD: dr_2.c,v 1.23 2009/03/14 19:35:13 dholland Exp $");
#endif
#endif /* not lint */
@@ -47,11 +47,15 @@ __RCSID("$NetBSD: dr_2.c,v 1.22 2009/03/14 18:32:47 dholland Exp $");
#define couldwin(f,t) (f->specs->crew2 > t->specs->crew2 * 1.5)
-static int str_end(const char *);
-static int score(struct ship *, struct ship *, char *, size_t, int);
-static void move_ship(struct ship *, const char *, unsigned char *, short *, short *, int *);
-static void try(struct ship *f, struct ship *t, char *command, size_t commandmax, char *temp, size_t tempmax, int ma, int ta, int af, int vma, int dir, int *high, int rakeme);
-static void rmend(char *);
+static int str_end(const char *);
+static int score(struct ship *, struct ship *, char *, size_t, int);
+static void move_ship(struct ship *, const char *, unsigned char *,
+ short *, short *, int *);
+static void try(struct ship *f, struct ship *t,
+ char *command, size_t commandmax, char *temp, size_t tempmax,
+ int ma, int ta, int af, int vma, int dir, int *high,
+ int rakeme);
+static void rmend(char *);
const int dtab[] = {0,1,1,2,3,4,4,5}; /* diagonal distances in x==y */
@@ -109,11 +113,14 @@ checkup(void)
if (sink != 1) {
makemsg(sp, "exploding!");
foreachship(sq) {
- if (sp != sq && sq->file->dir && range(sp, sq) < 4)
- table(sp, sq, RIGGING, L_EXPLODE, sp->specs->guns/13, 6);
+ if (sp != sq && sq->file->dir &&
+ range(sp, sq) < 4)
+ table(sp, sq, RIGGING, L_EXPLODE,
+ sp->specs->guns/13, 6);
}
- } else
+ } else {
makemsg(sp, "sinking!");
+ }
}
}
@@ -127,9 +134,13 @@ prizecheck(void)
continue;
if (sp->file->struck || sp->file->dir == 0)
continue;
- if (sp->specs->crew1 + sp->specs->crew2 + sp->specs->crew3 > sp->file->pcrew * 6) {
+ if (sp->specs->crew1 + sp->specs->crew2 + sp->specs->crew3 >
+ sp->file->pcrew * 6) {
Writestr(W_SIGNAL, sp, "prize crew overthrown");
- Write(W_POINTS, sp->file->captured, sp->file->captured->file->points - 2 * sp->specs->pts, 0, 0, 0);
+ Write(W_POINTS, sp->file->captured,
+ sp->file->captured->file->points
+ - 2 * sp->specs->pts,
+ 0, 0, 0);
Write(W_CAPTURED, sp, -1, 0, 0, 0);
}
}
@@ -146,18 +157,21 @@ str_end(const char *str)
}
void
-closeon(struct ship *from, struct ship *to, char *command, size_t commandmax, int ta, int ma, int af)
+closeon(struct ship *from, struct ship *to, char *command, size_t commandmax,
+ int ta, int ma, int af)
{
int high;
char temp[10];
temp[0] = command[0] = '\0';
high = -30000;
- try(from, to, command, commandmax, temp, sizeof(temp), ma, ta, af, ma, from->file->dir, &high, 0);
+ try(from, to, command, commandmax, temp, sizeof(temp),
+ ma, ta, af, ma, from->file->dir, &high, 0);
}
static int
-score(struct ship *ship, struct ship *to, char *movement, size_t movementmax, int onlytemp)
+score(struct ship *ship, struct ship *to, char *movement, size_t movementmax,
+ int onlytemp)
{
int drift;
int row, col, dir, total, ran;
@@ -188,7 +202,8 @@ score(struct ship *ship, struct ship *to, char *movement, size_t movementmax, in
}
static void
-move_ship(struct ship *ship, const char *p, unsigned char *dir, short *row, short *col, int *drift)
+move_ship(struct ship *ship, const char *p, unsigned char *dir,
+ short *row, short *col, int *drift)
{
int dist;
char moved = 0;
@@ -228,7 +243,10 @@ move_ship(struct ship *ship, const char *p, unsigned char *dir, short *row, shor
}
static void
-try(struct ship *f, struct ship *t, char *command, size_t commandmax, char *temp, size_t tempmax, int ma, int ta, int af, int vma, int dir, int *high, int rakeme)
+try(struct ship *f, struct ship *t,
+ char *command, size_t commandmax,
+ char *temp, size_t tempmax,
+ int ma, int ta, int af, int vma, int dir, int *high, int rakeme)
{
int new, n;
char st[4];
@@ -243,28 +261,39 @@ try(struct ship *f, struct ship *t, char *command, size_t commandmax, char *temp
*high = new;
strlcpy(command, temp, commandmax);
}
- try(f, t, command, commandmax, temp, tempmax, ma-n, ta, af, vma-n,
- dir, high, rakeme);
+ try(f, t, command, commandmax, temp, tempmax,
+ ma-n, ta, af, vma-n,
+ dir, high, rakeme);
rmend(temp);
}
- if ((ma > 0 && ta > 0 && (n = str_end(temp)) != 'l' && n != 'r') || !strlen(temp)) {
+ if ((ma > 0 && ta > 0 && (n = str_end(temp)) != 'l' && n != 'r') ||
+ !strlen(temp)) {
strlcat(temp, "r", tempmax);
new = score(f, t, temp, tempmax, rakeme);
- if (new > *high && (!rakeme || (gunsbear(f, t) && !gunsbear(t, f)))) {
+ if (new > *high && (!rakeme ||
+ (gunsbear(f, t) && !gunsbear(t, f)))) {
*high = new;
strlcpy(command, temp, commandmax);
}
- try(f, t, command, commandmax, temp, tempmax, ma-1, ta-1, af, min(ma-1, maxmove(f, (dir == 8 ? 1 : dir+1), 0)), (dir == 8 ? 1 : dir+1), high, rakeme);
+ try(f, t, command, commandmax, temp, tempmax,
+ ma-1, ta-1, af,
+ min(ma-1, maxmove(f, (dir == 8 ? 1 : dir+1), 0)),
+ (dir == 8 ? 1 : dir+1), high, rakeme);
rmend(temp);
}
- if ((ma > 0 && ta > 0 && (n = str_end(temp)) != 'l' && n != 'r') || !strlen(temp)){
+ if ((ma > 0 && ta > 0 && (n = str_end(temp)) != 'l' && n != 'r') ||
+ !strlen(temp)) {
strlcat(temp, "l", sizeof(temp));
new = score(f, t, temp, tempmax, rakeme);
- if (new > *high && (!rakeme || (gunsbear(f, t) && !gunsbear(t, f)))){
+ if (new > *high && (!rakeme ||
+ (gunsbear(f, t) && !gunsbear(t, f)))) {
*high = new;
strlcpy(command, temp, commandmax);
}
- try(f, t, command, commandmax, temp, tempmax, ma-1, ta-1, af, (min(ma-1,maxmove(f, (dir-1 ? dir-1 : 8), 0))), (dir-1 ? dir -1 : 8), high, rakeme);
+ try(f, t, command, commandmax, temp, tempmax,
+ ma-1, ta-1, af,
+ (min(ma-1,maxmove(f, (dir-1 ? dir-1 : 8), 0))),
+ (dir-1 ? dir -1 : 8), high, rakeme);
rmend(temp);
}
}
diff --git a/sail/dr_3.c b/sail/dr_3.c
index 06d335ae..2a66eafe 100644
--- a/sail/dr_3.c
+++ b/sail/dr_3.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dr_3.c,v 1.16 2009/03/14 18:32:47 dholland Exp $ */
+/* $NetBSD: dr_3.c,v 1.17 2009/03/14 19:35:13 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)dr_3.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: dr_3.c,v 1.16 2009/03/14 18:32:47 dholland Exp $");
+__RCSID("$NetBSD: dr_3.c,v 1.17 2009/03/14 19:35:13 dholland Exp $");
#endif
#endif /* not lint */
@@ -43,10 +43,10 @@ __RCSID("$NetBSD: dr_3.c,v 1.16 2009/03/14 18:32:47 dholland Exp $");
#include "extern.h"
#include "driver.h"
-static int stillmoving(int);
-static int is_isolated(struct ship *);
-static int push(struct ship *, struct ship *);
-static void step(struct ship *, int, char *);
+static int stillmoving(int);
+static int is_isolated(struct ship *);
+static int push(struct ship *, struct ship *);
+static void step(struct ship *, int, char *);
/* move all comp ships */
void
@@ -258,8 +258,9 @@ step(struct ship *sp, int com, char *moved)
sp->file->row -= dr[winddir];
sp->file->col -= dc[winddir];
}
- } else
+ } else {
sp->file->drift = 0;
+ }
break;
}
}
@@ -328,7 +329,7 @@ void
checksails(void)
{
struct ship *sp;
- int rig, full;
+ int rig, full;
struct ship *close;
foreachship(sp) {
@@ -344,10 +345,12 @@ checksails(void)
full = 1;
else
full = 0;
- } else
+ } else {
full = 0;
- } else
+ }
+ } else {
full = 0;
+ }
if ((sp->file->FS != 0) != full)
Write(W_FS, sp, full, 0, 0, 0);
}
diff --git a/sail/dr_4.c b/sail/dr_4.c
index ba17bfd8..347ca86b 100644
--- a/sail/dr_4.c
+++ b/sail/dr_4.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dr_4.c,v 1.13 2003/08/07 09:37:42 agc Exp $ */
+/* $NetBSD: dr_4.c,v 1.14 2009/03/14 19:35:13 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)dr_4.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: dr_4.c,v 1.13 2003/08/07 09:37:42 agc Exp $");
+__RCSID("$NetBSD: dr_4.c,v 1.14 2009/03/14 19:35:13 dholland Exp $");
#endif
#endif /* not lint */
@@ -61,7 +61,8 @@ ungrap(struct ship *from, struct ship *to)
void
grap(struct ship *from, struct ship *to)
{
- if (capship(from)->nationality != capship(to)->nationality && dieroll() > 2)
+ if (capship(from)->nationality != capship(to)->nationality &&
+ dieroll() > 2)
return;
Write(W_GRAP, from, to->file->index, 0, 0, 0);
Write(W_GRAP, to, from->file->index, 0, 0, 0);
diff --git a/sail/dr_5.c b/sail/dr_5.c
index 7eb0cb79..7fab0b48 100644
--- a/sail/dr_5.c
+++ b/sail/dr_5.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dr_5.c,v 1.12 2003/08/07 09:37:42 agc Exp $ */
+/* $NetBSD: dr_5.c,v 1.13 2009/03/14 19:35:13 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)dr_5.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: dr_5.c,v 1.12 2003/08/07 09:37:42 agc Exp $");
+__RCSID("$NetBSD: dr_5.c,v 1.13 2009/03/14 19:35:13 dholland Exp $");
#endif
#endif /* not lint */
@@ -42,7 +42,8 @@ __RCSID("$NetBSD: dr_5.c,v 1.12 2003/08/07 09:37:42 agc Exp $");
#include "extern.h"
void
-subtract(struct ship *from, struct ship *fromcap, int totalfrom, int *crewfrom, int pcfrom)
+subtract(struct ship *from, struct ship *fromcap, int totalfrom, int *crewfrom,
+ int pcfrom)
{
int n;
@@ -65,7 +66,8 @@ subtract(struct ship *from, struct ship *fromcap, int totalfrom, int *crewfrom,
}
int
-mensent(struct ship *from, struct ship *to, int *crew, struct ship **captured, int *pc, int 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/extern.h b/sail/extern.h
index a5a1ec2d..d6bcbd48 100644
--- a/sail/extern.h
+++ b/sail/extern.h
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.29 2009/03/14 18:32:47 dholland Exp $ */
+/* $NetBSD: extern.h,v 1.30 2009/03/14 19:35:13 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -62,15 +62,17 @@ extern gid_t egid;
#define fouled2(a, b) ((a)->file->foul[(b)->file->index].sn_count)
#define snagged2(a, b) (grappled2(a, b) + fouled2(a, b))
-#define Xgrappled2(a, b) ((a)->file->grap[(b)->file->index].sn_turn < turn-1 ? grappled2(a, b) : 0)
-#define Xfouled2(a, b) ((a)->file->foul[(b)->file->index].sn_turn < turn-1 ? fouled2(a, b) : 0)
+#define Xgrappled2(a, b) ((a)->file->grap[(b)->file->index].sn_turn < turn-1 \
+ ? grappled2(a, b) : 0)
+#define Xfouled2(a, b) ((a)->file->foul[(b)->file->index].sn_turn < turn-1 \
+ ? fouled2(a, b) : 0)
#define Xsnagged2(a, b) (Xgrappled2(a, b) + Xfouled2(a, b))
#define cleangrapple(a, b, c) Cleansnag(a, b, c, 1)
#define cleanfoul(a, b, c) Cleansnag(a, b, c, 2)
#define cleansnag(a, b, c) Cleansnag(a, b, c, 3)
-#define sterncolour(sp) ((sp)->file->stern+'0'-((sp)->file->captured?10:0))
+#define sterncolour(sp) ((sp)->file->stern+'0'-((sp)->file->captured ? 10 : 0))
#define sternrow(sp) ((sp)->file->row + dr[(sp)->file->dir])
#define sterncol(sp) ((sp)->file->col + dc[(sp)->file->dir])
@@ -290,124 +292,123 @@ extern int people;
extern int hasdriver;
/* assorted.c */
-void table (struct ship *, struct ship *, int, int, int, int);
-void Cleansnag (struct ship *, struct ship *, int, int);
+void table(struct ship *, struct ship *, int, int, int, int);
+void Cleansnag(struct ship *, struct ship *, int, int);
/* dr_1.c */
-void unfoul (void);
-void boardcomp (void);
-void resolve (void);
-void compcombat (void);
-int next (void);
+void unfoul(void);
+void boardcomp(void);
+void resolve(void);
+void compcombat(void);
+int next(void);
/* dr_2.c */
-void thinkofgrapples (void);
-void checkup (void);
-void prizecheck (void);
-void closeon (struct ship *, struct ship *, char *, size_t, int, int, int);
+void thinkofgrapples(void);
+void checkup(void);
+void prizecheck(void);
+void closeon(struct ship *, struct ship *, char *, size_t, int, int, int);
/* dr_3.c */
-void moveall (void);
-void sendbp (struct ship *, struct ship *, int, int);
-int is_toughmelee (struct ship *, struct ship *, int, int);
-void reload (void);
-void checksails (void);
+void moveall(void);
+void sendbp(struct ship *, struct ship *, int, int);
+int is_toughmelee(struct ship *, struct ship *, int, int);
+void reload(void);
+void checksails(void);
/* dr_4.c */
-void ungrap (struct ship *, struct ship *);
-void grap (struct ship *, struct ship *);
+void ungrap(struct ship *, struct ship *);
+void grap(struct ship *, struct ship *);
/* dr_5.c */
-void subtract (struct ship *, struct ship *, int, int [3], int);
-int mensent (struct ship *, struct ship *, int[3], struct ship **, int *,
- int);
+void subtract(struct ship *, struct ship *, int, int [3], int);
+int mensent(struct ship *, struct ship *, int[3], struct ship **, int *, int);
/* dr_main.c */
-int dr_main (void);
+int dr_main(void);
/* game.c */
-int maxturns (struct ship *, char *);
-int maxmove (struct ship *, int, int);
+int maxturns(struct ship *, char *);
+int maxmove(struct ship *, int, int);
/* lo_main.c */
-int lo_main (void);
+int lo_main(void);
/* misc.c */
-int range (struct ship *, struct ship *);
-struct ship *closestenemy (struct ship *, int, int);
-int gunsbear (struct ship *, struct ship *);
-int portside (struct ship *, struct ship *, int);
-int colours (struct ship *);
-void logger (struct ship *);
+int range(struct ship *, struct ship *);
+struct ship *closestenemy(struct ship *, int, int);
+int gunsbear(struct ship *, struct ship *);
+int portside(struct ship *, struct ship *, int);
+int colours(struct ship *);
+void logger(struct ship *);
/* parties.c */
-int meleeing (struct ship *, struct ship *);
-int boarding (struct ship *, int);
-void unboard (struct ship *, struct ship *, int);
+int meleeing(struct ship *, struct ship *);
+int boarding(struct ship *, int);
+void unboard(struct ship *, struct ship *, int);
/* pl_1.c */
-void leave (int) __attribute__((__noreturn__));
-void choke (int) __attribute__((__noreturn__));
-void child (int);
+void leave(int) __attribute__((__noreturn__));
+void choke(int) __attribute__((__noreturn__));
+void child(int);
/* pl_2.c */
-void play (void) __attribute__((__noreturn__));
+void play(void) __attribute__((__noreturn__));
/* pl_3.c */
-void acceptcombat (void);
-void grapungrap (void);
-void unfoulplayer (void);
+void acceptcombat(void);
+void grapungrap(void);
+void unfoulplayer(void);
/* pl_4.c */
-void changesail (void);
-void acceptsignal (void);
-void lookout (void);
-const char *saywhat (struct ship *, int);
-void eyeball (struct ship *);
+void changesail(void);
+void acceptsignal(void);
+void lookout(void);
+const char *saywhat(struct ship *, int);
+void eyeball(struct ship *);
/* pl_5.c */
-void acceptmove (void);
-void acceptboard (void);
+void acceptmove(void);
+void acceptboard(void);
/* pl_6.c */
-void repair (void);
-void loadplayer (void);
+void repair(void);
+void loadplayer(void);
/* pl_7.c */
-void initscreen (void);
-void cleanupscreen (void);
-void newturn (int);
-void Signal (const char *, struct ship *, ...)
+void initscreen(void);
+void cleanupscreen(void);
+void newturn(int);
+void Signal(const char *, struct ship *, ...)
__attribute__((__format__(__printf__,1,3)));
-void Msg (const char *, ...)
+void Msg(const char *, ...)
__attribute__((__format__(__printf__,1,2)));
-void prompt (const char *, struct ship *);
-int sgetch (const char *, struct ship *, int);
-void sgetstr (const char *, char *, int);
-void draw_screen (void);
-void draw_view (void);
-void draw_turn (void);
-void draw_stat (void);
-void draw_slot (void);
-void draw_board (void);
-void centerview (void);
-void upview (void);
-void downview (void);
-void leftview (void);
-void rightview (void);
+void prompt(const char *, struct ship *);
+int sgetch(const char *, struct ship *, int);
+void sgetstr(const char *, char *, int);
+void draw_screen(void);
+void draw_view(void);
+void draw_turn(void);
+void draw_stat(void);
+void draw_slot(void);
+void draw_board(void);
+void centerview(void);
+void upview(void);
+void downview(void);
+void leftview(void);
+void rightview(void);
/* pl_main.c */
-int pl_main (void);
+int pl_main(void);
/* sync.c */
-void fmtship (char *, size_t, const char *, struct ship *);
-void makesignal (struct ship *, const char *, struct ship *, ...)
+void fmtship(char *, size_t, const char *, struct ship *);
+void makesignal(struct ship *, const char *, struct ship *, ...)
__attribute__((__format__(__printf__,2,4)));
-void makemsg (struct ship *, const char *, ...)
+void makemsg(struct ship *, const char *, ...)
__attribute__((__format__(__printf__,2,3)));
-int sync_exists (int);
-int sync_open (void);
-void sync_close (int);
-void Write (int, struct ship *, long, long, long, long);
-void Writestr (int, struct ship *, const char *);
-int Sync (void);
+int sync_exists(int);
+int sync_open(void);
+void sync_close(int);
+void Write(int, struct ship *, long, long, long, long);
+void Writestr(int, struct ship *, const char *);
+int Sync(void);
diff --git a/sail/game.c b/sail/game.c
index 0e9e5f60..adab8266 100644
--- a/sail/game.c
+++ b/sail/game.c
@@ -1,4 +1,4 @@
-/* $NetBSD: game.c,v 1.11 2003/08/07 09:37:42 agc Exp $ */
+/* $NetBSD: game.c,v 1.12 2009/03/14 19:35:13 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)game.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: game.c,v 1.11 2003/08/07 09:37:42 agc Exp $");
+__RCSID("$NetBSD: game.c,v 1.12 2009/03/14 19:35:13 dholland Exp $");
#endif
#endif /* not lint */
@@ -76,13 +76,15 @@ maxmove(struct ship *ship, int dir, int fs)
}
if (dir == winddir)
Move -= 1 + WET[windspeed][ship->specs->class-1].B;
- else if (dir == winddir + 2 || dir == winddir - 2 || dir == winddir - 6 || dir == winddir + 6)
+ else if (dir == winddir + 2 || dir == winddir - 2 ||
+ dir == winddir - 6 || dir == winddir + 6)
Move -= 1 + WET[windspeed][ship->specs->class-1].C;
- else if (dir == winddir + 3 || dir == winddir - 3 || dir == winddir - 5 || dir == winddir + 5)
+ else if (dir == winddir + 3 || dir == winddir - 3 ||
+ dir == winddir - 5 || dir == winddir + 5)
Move = (flank ? 2 : 1) - WET[windspeed][ship->specs->class-1].D;
else if (dir == winddir + 4 || dir == winddir - 4)
Move = 0;
- else
+ else
Move -= WET[windspeed][ship->specs->class-1].A;
Move -= riggone;
Move = Move < 0 ? 0 : Move;
diff --git a/sail/globals.c b/sail/globals.c
index 03038d9a..ec0dcb1f 100644
--- a/sail/globals.c
+++ b/sail/globals.c
@@ -1,4 +1,4 @@
-/* $NetBSD: globals.c,v 1.13 2003/08/07 09:37:42 agc Exp $ */
+/* $NetBSD: globals.c,v 1.14 2009/03/14 19:35:13 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)globals.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: globals.c,v 1.13 2003/08/07 09:37:42 agc Exp $");
+__RCSID("$NetBSD: globals.c,v 1.14 2009/03/14 19:35:13 dholland Exp $");
#endif
#endif /* not lint */
@@ -452,7 +452,7 @@ const char AMMO[9][4] = {
{ -3, 2, 0, 3 },
{ -3, 2, 0, 3 }
};
-
+
const char HDT[9][10] = {
{ 1, 0,-1,-2,-3,-3,-4,-4,-4,-4 },
{ 1, 1, 0,-1,-2,-2,-3,-3,-3,-3 },
@@ -536,7 +536,14 @@ const char *const directionname[] = {
"dead ahead"
};
-const char *const qualname[] = { "dead", "mutinous", "green", "mundane", "crack", "elite" };
+const char *const qualname[] = {
+ "dead",
+ "mutinous",
+ "green",
+ "mundane",
+ "crack",
+ "elite"
+};
const char loadname[] = { '-', 'G', 'C', 'R', 'D', 'E' };
@@ -553,8 +560,8 @@ int nobells; /* -b, don't ring bell before Signal */
gid_t gid;
gid_t egid;
-struct scenario *cc; /* the current scenario */
-struct ship *ls; /* &cc->ship[cc->vessels] */
+struct scenario *cc; /* the current scenario */
+struct ship *ls; /* &cc->ship[cc->vessels] */
int winddir;
int windspeed;
diff --git a/sail/misc.c b/sail/misc.c
index d1034277..ac94e295 100644
--- a/sail/misc.c
+++ b/sail/misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: misc.c,v 1.17 2009/03/14 18:41:21 dholland Exp $ */
+/* $NetBSD: misc.c,v 1.18 2009/03/14 19:35:13 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)misc.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: misc.c,v 1.17 2009/03/14 18:41:21 dholland Exp $");
+__RCSID("$NetBSD: misc.c,v 1.18 2009/03/14 19:35:13 dholland Exp $");
#endif
#endif /* not lint */
@@ -46,9 +46,10 @@ __RCSID("$NetBSD: misc.c,v 1.17 2009/03/14 18:41:21 dholland Exp $");
#include "extern.h"
#include "pathnames.h"
-#define distance(x,y) (abs(x) >= abs(y) ? abs(x) + abs(y)/2 : abs(y) + abs(x)/2)
+#define distance(x,y) \
+ (abs(x) >= abs(y) ? abs(x) + abs(y)/2 : abs(y) + abs(x)/2)
-static int angle(int, int);
+static int angle(int, int);
/* XXX */
int
diff --git a/sail/pl_3.c b/sail/pl_3.c
index 81d012c2..36552faa 100644
--- a/sail/pl_3.c
+++ b/sail/pl_3.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl_3.c,v 1.17 2003/08/07 09:37:43 agc Exp $ */
+/* $NetBSD: pl_3.c,v 1.18 2009/03/14 19:35:13 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)pl_3.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pl_3.c,v 1.17 2003/08/07 09:37:43 agc Exp $");
+__RCSID("$NetBSD: pl_3.c,v 1.18 2009/03/14 19:35:13 dholland Exp $");
#endif
#endif /* not lint */
@@ -85,7 +85,8 @@ acceptcombat(void)
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;
diff --git a/sail/pl_5.c b/sail/pl_5.c
index eef6084f..f973b509 100644
--- a/sail/pl_5.c
+++ b/sail/pl_5.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl_5.c,v 1.20 2009/03/14 18:32:47 dholland Exp $ */
+/* $NetBSD: pl_5.c,v 1.21 2009/03/14 19:35:13 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)pl_5.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pl_5.c,v 1.20 2009/03/14 18:32:47 dholland Exp $");
+__RCSID("$NetBSD: pl_5.c,v 1.21 2009/03/14 19:35:13 dholland Exp $");
#endif
#endif /* not lint */
@@ -49,7 +49,7 @@ __RCSID("$NetBSD: pl_5.c,v 1.20 2009/03/14 18:32:47 dholland Exp $");
#define turnfirst(x) (*x == 'r' || *x == 'l')
-static void parties(struct ship *, int *, int, int);
+static void parties(struct ship *, int *, int, int);
void
acceptmove(void)
@@ -192,7 +192,8 @@ acceptboard(void)
sp, 1);
parties(sp, crew, 0, c);
} else if ((fouled2(ms, sp) || grappled2(ms, sp)) && crew[2]) {
- c = sgetch("Crew sections to board the $$ (3 max) ?", sp, 1);
+ c = sgetch("Crew sections to board the $$ (3 max) ?",
+ sp, 1);
parties(sp, crew, 0, c);
}
}
@@ -209,14 +210,14 @@ acceptboard(void)
static void
parties(struct ship *to, int *crew, int isdefense, int buf)
{
- int k, j, men;
+ int k, j, men;
struct BP *ptr;
int temp[3];
for (k = 0; k < 3; k++)
temp[k] = crew[k];
if (isdigit(buf)) {
- ptr = isdefense ? to->file->DBP : to->file->OBP;
+ ptr = isdefense ? to->file->DBP : to->file->OBP;
for (j = 0; j < NBP && ptr[j].turnsent; j++)
;
if (j < NBP && !ptr[j].turnsent && buf > '0') {
diff --git a/sail/pl_6.c b/sail/pl_6.c
index 9e204b84..1fc1cac6 100644
--- a/sail/pl_6.c
+++ b/sail/pl_6.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl_6.c,v 1.11 2003/08/07 09:37:44 agc Exp $ */
+/* $NetBSD: pl_6.c,v 1.12 2009/03/14 19:35:13 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)pl_6.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pl_6.c,v 1.11 2003/08/07 09:37:44 agc Exp $");
+__RCSID("$NetBSD: pl_6.c,v 1.12 2009/03/14 19:35:13 dholland Exp $");
#endif
#endif /* not lint */
@@ -42,7 +42,7 @@ __RCSID("$NetBSD: pl_6.c,v 1.11 2003/08/07 09:37:44 agc Exp $");
#include "extern.h"
#include "player.h"
-static int turned(void);
+static int turned(void);
void
repair(void)
diff --git a/sail/pl_7.c b/sail/pl_7.c
index feae77c1..2738b014 100644
--- a/sail/pl_7.c
+++ b/sail/pl_7.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl_7.c,v 1.29 2009/03/02 07:17:24 dholland Exp $ */
+/* $NetBSD: pl_7.c,v 1.30 2009/03/14 19:35:13 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)pl_7.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pl_7.c,v 1.29 2009/03/02 07:17:24 dholland Exp $");
+__RCSID("$NetBSD: pl_7.c,v 1.30 2009/03/14 19:35:13 dholland Exp $");
#endif
#endif /* not lint */
@@ -50,9 +50,9 @@ __RCSID("$NetBSD: pl_7.c,v 1.29 2009/03/02 07:17:24 dholland Exp $");
#include "player.h"
#include "display.h"
-static void Scroll(void);
-static void endprompt(int);
-static void adjustview(void);
+static void Scroll(void);
+static void endprompt(int);
+static void adjustview(void);
/*
* Display interface
diff --git a/sail/pl_main.c b/sail/pl_main.c
index 946907b1..e1aba4b9 100644
--- a/sail/pl_main.c
+++ b/sail/pl_main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl_main.c,v 1.21 2009/03/14 18:41:21 dholland Exp $ */
+/* $NetBSD: pl_main.c,v 1.22 2009/03/14 19:35:13 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)pl_main.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pl_main.c,v 1.21 2009/03/14 18:41:21 dholland Exp $");
+__RCSID("$NetBSD: pl_main.c,v 1.22 2009/03/14 19:35:13 dholland Exp $");
#endif
#endif /* not lint */
@@ -49,13 +49,12 @@ __RCSID("$NetBSD: pl_main.c,v 1.21 2009/03/14 18:41:21 dholland Exp $");
#include "player.h"
#include "restart.h"
-static void initialize(void);
+static void initialize(void);
/*ARGSUSED*/
int
pl_main(void)
{
-
initialize();
Msg("Aye aye, Sir");
play();
diff --git a/sail/restart.h b/sail/restart.h
index a5fd5056..699ed612 100644
--- a/sail/restart.h
+++ b/sail/restart.h
@@ -1,11 +1,11 @@
-/* $NetBSD: restart.h,v 1.3 2008/04/28 20:22:54 martin Exp $ */
+/* $NetBSD: restart.h,v 1.4 2009/03/14 19:35:13 dholland Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
- * by
+ * by
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/sail/sync.c b/sail/sync.c
index a754ffb3..e5277ca6 100644
--- a/sail/sync.c
+++ b/sail/sync.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sync.c,v 1.27 2009/03/14 18:41:21 dholland Exp $ */
+/* $NetBSD: sync.c,v 1.28 2009/03/14 19:35:13 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)sync.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: sync.c,v 1.27 2009/03/14 18:41:21 dholland Exp $");
+__RCSID("$NetBSD: sync.c,v 1.28 2009/03/14 19:35:13 dholland Exp $");
#endif
#endif /* not lint */
@@ -54,7 +54,8 @@ __RCSID("$NetBSD: sync.c,v 1.27 2009/03/14 18:41:21 dholland Exp $");
#define BUFSIZE 4096
-static int sync_update(int, struct ship *, const char *, long, long, long, long);
+static int sync_update(int, struct ship *, const char *,
+ long, long, long, long);
static const char SF[] = _PATH_SYNC;
static const char LF[] = _PATH_LOCK;
@@ -278,7 +279,8 @@ Sync(void)
astr = p;
a = b = c = d = 0;
} else {
- if (fscanf(sync_fp, "%ld%ld%ld%ld", &a, &b, &c, &d) != 4)
+ if (fscanf(sync_fp, "%ld%ld%ld%ld", &a, &b, &c, &d)
+ != 4)
goto bad;
astr = NULL;
}
@@ -309,7 +311,8 @@ out:
}
static int
-sync_update(int type, struct ship *ship, const char *astr, long a, long b, long c, long d)
+sync_update(int type, struct ship *ship, const char *astr,
+ long a, long b, long c, long d)
{
switch (type) {
case W_DBP: {