From d7be70527bfff340ccf3fef43add3188d54d7eae Mon Sep 17 00:00:00 2001 From: jwise Date: Thu, 4 Jan 2001 01:53:24 +0000 Subject: [PATCH] First half of static-ization of local funcs. --- sail/assorted.c | 6 ++++-- sail/dr_1.c | 13 ++++++++++--- sail/dr_2.c | 28 +++++++++++++++++++--------- sail/dr_3.c | 22 ++++++++++++++++------ sail/dr_4.c | 7 +++++-- sail/dr_5.c | 7 +++++-- sail/dr_main.c | 6 ++++-- sail/extern.h | 13 +------------ sail/game.c | 7 +++++-- 9 files changed, 69 insertions(+), 40 deletions(-) diff --git a/sail/assorted.c b/sail/assorted.c index ae418741..d2e16a65 100644 --- a/sail/assorted.c +++ b/sail/assorted.c @@ -1,4 +1,4 @@ -/* $NetBSD: assorted.c,v 1.10 2001/01/01 21:57:37 jwise Exp $ */ +/* $NetBSD: assorted.c,v 1.11 2001/01/04 01:53:24 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.10 2001/01/01 21:57:37 jwise Exp $"); +__RCSID("$NetBSD: assorted.c,v 1.11 2001/01/04 01:53:24 jwise Exp $"); #endif #endif /* not lint */ @@ -47,6 +47,8 @@ __RCSID("$NetBSD: assorted.c,v 1.10 2001/01/01 21:57:37 jwise Exp $"); #include #include +void table(int, int, int, struct ship *, struct ship *, int); +void Cleansnag(struct ship *, struct ship *, int, int); static void strike (struct ship *, struct ship *); void diff --git a/sail/dr_1.c b/sail/dr_1.c index bc6a6cca..d63feef2 100644 --- a/sail/dr_1.c +++ b/sail/dr_1.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_1.c,v 1.12 2001/01/01 21:57:37 jwise Exp $ */ +/* $NetBSD: dr_1.c,v 1.13 2001/01/04 01:53:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,13 +38,20 @@ #if 0 static char sccsid[] = "@(#)dr_1.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: dr_1.c,v 1.12 2001/01/01 21:57:37 jwise Exp $"); +__RCSID("$NetBSD: dr_1.c,v 1.13 2001/01/04 01:53:24 jwise Exp $"); #endif #endif /* not lint */ #include "driver.h" #include +void unfoul(void); +void boardcomp(void); +static int fightitout(struct ship *, struct ship *, int); +void resolve(void); +void compcombat(void); +int next(void); + void unfoul(void) { @@ -133,7 +140,7 @@ boardcomp(void) } } -int +static int fightitout(struct ship *from, struct ship *to, int key) { struct ship *fromcap, *tocap; diff --git a/sail/dr_2.c b/sail/dr_2.c index 236faac7..065902ed 100644 --- a/sail/dr_2.c +++ b/sail/dr_2.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_2.c,v 1.13 2001/01/01 21:57:37 jwise Exp $ */ +/* $NetBSD: dr_2.c,v 1.14 2001/01/04 01:53:24 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.13 2001/01/01 21:57:37 jwise Exp $"); +__RCSID("$NetBSD: dr_2.c,v 1.14 2001/01/04 01:53:24 jwise Exp $"); #endif #endif /* not lint */ @@ -47,6 +47,18 @@ __RCSID("$NetBSD: dr_2.c,v 1.13 2001/01/01 21:57:37 jwise Exp $"); #define couldwin(f,t) (f->specs->crew2 > t->specs->crew2 * 1.5) +void thinkofgrapples(void); +void checkup(void); +void prizecheck(void); +static int str_end(const char *); +void closeon(struct ship *, struct ship *, char *, int, int, int); +static int score(char *, struct ship *, struct ship *, int); +static void move_ship(const char *, struct ship *, unsigned char *, short *, short *, char *); +static void try(char *, char *, int, int, int, int, int, struct ship *, struct ship *, int *, int); +static void rmend(char *); + +const int dtab[] = {0,1,1,2,3,4,4,5}; /* diagonal distances in x==y */ + void thinkofgrapples(void) { @@ -127,7 +139,7 @@ prizecheck(void) } } -int +static int str_end(const char *str) { const char *p; @@ -148,9 +160,7 @@ closeon(struct ship *from, struct ship *to, char *command, int ta, int ma, int a try(command, temp, ma, ta, af, ma, from->file->dir, from, to, &high, 0); } -const int dtab[] = {0,1,1,2,3,4,4,5}; /* diagonal distances in x==y */ - -int +static int score(char *movement, struct ship *ship, struct ship *to, int onlytemp) { char drift; @@ -181,7 +191,7 @@ score(char *movement, struct ship *ship, struct ship *to, int onlytemp) return total; } -void +static void move_ship(const char *p, struct ship *ship, unsigned char *dir, short *row, short *col, char *drift) { int dist; @@ -221,7 +231,7 @@ move_ship(const char *p, struct ship *ship, unsigned char *dir, short *row, shor *drift = 0; } -void +static void 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; @@ -263,7 +273,7 @@ try(char *command, char *temp, int ma, int ta, int af, int vma, int dir, struct } } -void +static void rmend(char *str) { char *p; diff --git a/sail/dr_3.c b/sail/dr_3.c index b10fae42..3c8be352 100644 --- a/sail/dr_3.c +++ b/sail/dr_3.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_3.c,v 1.9 2001/01/01 21:57:37 jwise Exp $ */ +/* $NetBSD: dr_3.c,v 1.10 2001/01/04 01:53:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,13 +38,23 @@ #if 0 static char sccsid[] = "@(#)dr_3.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: dr_3.c,v 1.9 2001/01/01 21:57:37 jwise Exp $"); +__RCSID("$NetBSD: dr_3.c,v 1.10 2001/01/04 01:53:24 jwise Exp $"); #endif #endif /* not lint */ #include "driver.h" #include +void moveall(void); +static int stillmoving(int); +static int is_isolated(struct ship *); +static int push(struct ship *, struct ship *); +static void step(int, struct ship *, char *); +void sendbp(struct ship *, struct ship *, int, int); +int is_toughmelee(struct ship *, struct ship *, int, int); +void reload(void); +void checksails(void); + /* move all comp ships */ void moveall(void) @@ -183,7 +193,7 @@ moveall(void) } } -int +static int stillmoving(int k) { struct ship *sp; @@ -194,7 +204,7 @@ stillmoving(int k) return 0; } -int +static int is_isolated(struct ship *ship) { struct ship *sp; @@ -206,7 +216,7 @@ is_isolated(struct ship *ship) return 1; } -int +static int push(struct ship *from, struct ship *to) { int bs, sb; @@ -220,7 +230,7 @@ push(struct ship *from, struct ship *to) return from < to; } -void +static void step(int com, struct ship *sp, char *moved) { int dist; diff --git a/sail/dr_4.c b/sail/dr_4.c index 2617ddcc..afd9373c 100644 --- a/sail/dr_4.c +++ b/sail/dr_4.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_4.c,v 1.9 2001/01/01 21:57:37 jwise Exp $ */ +/* $NetBSD: dr_4.c,v 1.10 2001/01/04 01:53:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,13 +38,16 @@ #if 0 static char sccsid[] = "@(#)dr_4.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: dr_4.c,v 1.9 2001/01/01 21:57:37 jwise Exp $"); +__RCSID("$NetBSD: dr_4.c,v 1.10 2001/01/04 01:53:24 jwise Exp $"); #endif #endif /* not lint */ #include "extern.h" #include +void ungrap(struct ship *, struct ship *); +void grap(struct ship *, struct ship *); + void ungrap(struct ship *from, struct ship *to) { diff --git a/sail/dr_5.c b/sail/dr_5.c index a48e549e..857f00dc 100644 --- a/sail/dr_5.c +++ b/sail/dr_5.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_5.c,v 1.7 2001/01/01 21:57:38 jwise Exp $ */ +/* $NetBSD: dr_5.c,v 1.8 2001/01/04 01:53:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,12 +38,15 @@ #if 0 static char sccsid[] = "@(#)dr_5.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: dr_5.c,v 1.7 2001/01/01 21:57:38 jwise Exp $"); +__RCSID("$NetBSD: dr_5.c,v 1.8 2001/01/04 01:53:24 jwise Exp $"); #endif #endif /* not lint */ #include "extern.h" +void subtract(struct ship *, int, int *, struct ship *, int); +int mensent(struct ship *, struct ship *, int *, struct ship **, int *, int); + void subtract(struct ship *from, int totalfrom, int *crewfrom, struct ship *fromcap, int pcfrom) { diff --git a/sail/dr_main.c b/sail/dr_main.c index 4e7778c9..0b7db8b4 100644 --- a/sail/dr_main.c +++ b/sail/dr_main.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_main.c,v 1.7 2001/01/01 21:57:38 jwise Exp $ */ +/* $NetBSD: dr_main.c,v 1.8 2001/01/04 01:53:24 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.7 2001/01/01 21:57:38 jwise Exp $"); +__RCSID("$NetBSD: dr_main.c,v 1.8 2001/01/04 01:53:24 jwise Exp $"); #endif #endif /* not lint */ @@ -46,6 +46,8 @@ __RCSID("$NetBSD: dr_main.c,v 1.7 2001/01/01 21:57:38 jwise Exp $"); #include #include +int dr_main(void); + int dr_main(void) { diff --git a/sail/extern.h b/sail/extern.h index 65f06bf9..1b9be7db 100644 --- a/sail/extern.h +++ b/sail/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.18 2001/01/01 21:57:38 jwise Exp $ */ +/* $NetBSD: extern.h,v 1.19 2001/01/04 01:53:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -307,7 +307,6 @@ void Cleansnag (struct ship *, struct ship *, int, int); /* dr_1.c */ void unfoul (void); void boardcomp (void); -int fightitout (struct ship *, struct ship *, int); void resolve (void); void compcombat (void); int next (void); @@ -316,20 +315,10 @@ int next (void); 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 move_ship (const char *, struct ship *, unsigned char *, short *, short *, char *); -void try (char *, char *, int, int, int, int, int, struct ship *, - struct ship *, int *, int); -void rmend (char *); /* dr_3.c */ void moveall (void); -int stillmoving (int); -int is_isolated (struct ship *); -int push (struct ship *, struct ship *); -void step (int, struct ship *, char *); void sendbp (struct ship *, struct ship *, int, int); int is_toughmelee (struct ship *, struct ship *, int, int); void reload (void); diff --git a/sail/game.c b/sail/game.c index ae871273..5819a6e8 100644 --- a/sail/game.c +++ b/sail/game.c @@ -1,4 +1,4 @@ -/* $NetBSD: game.c,v 1.7 2001/01/01 21:57:38 jwise Exp $ */ +/* $NetBSD: game.c,v 1.8 2001/01/04 01:53:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,12 +38,15 @@ #if 0 static char sccsid[] = "@(#)game.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: game.c,v 1.7 2001/01/01 21:57:38 jwise Exp $"); +__RCSID("$NetBSD: game.c,v 1.8 2001/01/04 01:53:24 jwise Exp $"); #endif #endif /* not lint */ #include "extern.h" +int maxturns(struct ship *, char *); +int maxmove(struct ship *, int, int); + int maxturns(struct ship *ship, char *af) { -- 2.47.1