summaryrefslogtreecommitdiffstats
path: root/sail
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2009-03-14 20:04:43 +0000
committerdholland <dholland@NetBSD.org>2009-03-14 20:04:43 +0000
commit378015332508b48169d5f735be9a4bb4b6c82c03 (patch)
treef8401755021f17a0b5e07d16fd7ab7b379e351da /sail
parentc9ea3d28669550d93bd8b6ba25a908f58b38683a (diff)
downloadbsdgames-darwin-378015332508b48169d5f735be9a4bb4b6c82c03.tar.gz
bsdgames-darwin-378015332508b48169d5f735be9a4bb4b6c82c03.tar.zst
bsdgames-darwin-378015332508b48169d5f735be9a4bb4b6c82c03.zip
Sprinkle some "bool". And don't use '\0' to mean 'false'.
Diffstat (limited to 'sail')
-rw-r--r--sail/dr_2.c10
-rw-r--r--sail/dr_3.c6
-rw-r--r--sail/extern.h7
-rw-r--r--sail/game.c9
-rw-r--r--sail/pl_5.c10
5 files changed, 22 insertions, 20 deletions
diff --git a/sail/dr_2.c b/sail/dr_2.c
index 56719fbd..460f24ff 100644
--- a/sail/dr_2.c
+++ b/sail/dr_2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dr_2.c,v 1.23 2009/03/14 19:35:13 dholland Exp $ */
+/* $NetBSD: dr_2.c,v 1.24 2009/03/14 20:04:43 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.23 2009/03/14 19:35:13 dholland Exp $");
+__RCSID("$NetBSD: dr_2.c,v 1.24 2009/03/14 20:04:43 dholland Exp $");
#endif
#endif /* not lint */
@@ -53,7 +53,7 @@ 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 ma, int ta, bool af, int vma, int dir, int *high,
int rakeme);
static void rmend(char *);
@@ -158,7 +158,7 @@ str_end(const char *str)
void
closeon(struct ship *from, struct ship *to, char *command, size_t commandmax,
- int ta, int ma, int af)
+ int ta, int ma, bool af)
{
int high;
char temp[10];
@@ -246,7 +246,7 @@ 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)
+ int ma, int ta, bool af, int vma, int dir, int *high, int rakeme)
{
int new, n;
char st[4];
diff --git a/sail/dr_3.c b/sail/dr_3.c
index 2a66eafe..8d880c34 100644
--- a/sail/dr_3.c
+++ b/sail/dr_3.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dr_3.c,v 1.17 2009/03/14 19:35:13 dholland Exp $ */
+/* $NetBSD: dr_3.c,v 1.18 2009/03/14 20:04:43 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.17 2009/03/14 19:35:13 dholland Exp $");
+__RCSID("$NetBSD: dr_3.c,v 1.18 2009/03/14 20:04:43 dholland Exp $");
#endif
#endif /* not lint */
@@ -64,7 +64,7 @@ moveall(void)
foreachship(sp) {
struct ship *closest;
int ma, ta;
- char af;
+ bool af;
if (sp->file->captain[0] || sp->file->dir == 0)
continue;
diff --git a/sail/extern.h b/sail/extern.h
index d6bcbd48..485d7db6 100644
--- a/sail/extern.h
+++ b/sail/extern.h
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.30 2009/03/14 19:35:13 dholland Exp $ */
+/* $NetBSD: extern.h,v 1.31 2009/03/14 20:04:43 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -32,6 +32,7 @@
*/
#include <sys/types.h>
+#include <stdbool.h>
#include "machdep.h"
@@ -306,7 +307,7 @@ int next(void);
void thinkofgrapples(void);
void checkup(void);
void prizecheck(void);
-void closeon(struct ship *, struct ship *, char *, size_t, int, int, int);
+void closeon(struct ship *, struct ship *, char *, size_t, int, int, bool);
/* dr_3.c */
void moveall(void);
@@ -327,7 +328,7 @@ int mensent(struct ship *, struct ship *, int[3], struct ship **, int *, int);
int dr_main(void);
/* game.c */
-int maxturns(struct ship *, char *);
+int maxturns(struct ship *, bool *);
int maxmove(struct ship *, int, int);
/* lo_main.c */
diff --git a/sail/game.c b/sail/game.c
index adab8266..20d6d83c 100644
--- a/sail/game.c
+++ b/sail/game.c
@@ -1,4 +1,4 @@
-/* $NetBSD: game.c,v 1.12 2009/03/14 19:35:13 dholland Exp $ */
+/* $NetBSD: game.c,v 1.13 2009/03/14 20:04:43 dholland Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,21 +34,22 @@
#if 0
static char sccsid[] = "@(#)game.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: game.c,v 1.12 2009/03/14 19:35:13 dholland Exp $");
+__RCSID("$NetBSD: game.c,v 1.13 2009/03/14 20:04:43 dholland Exp $");
#endif
#endif /* not lint */
#include <sys/types.h>
+#include <stdbool.h>
#include "extern.h"
int
-maxturns(struct ship *ship, char *af)
+maxturns(struct ship *ship, bool *af)
{
int turns;
turns = ship->specs->ta;
*af = (ship->file->drift > 1 && turns);
- if (*af != '\0') {
+ if (*af != false) {
turns--;
if (ship->file->FS == 1)
turns = 0;
diff --git a/sail/pl_5.c b/sail/pl_5.c
index f973b509..06b9fa51 100644
--- a/sail/pl_5.c
+++ b/sail/pl_5.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl_5.c,v 1.21 2009/03/14 19:35:13 dholland Exp $ */
+/* $NetBSD: pl_5.c,v 1.22 2009/03/14 20:04:43 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.21 2009/03/14 19:35:13 dholland Exp $");
+__RCSID("$NetBSD: pl_5.c,v 1.22 2009/03/14 20:04:43 dholland Exp $");
#endif
#endif /* not lint */
@@ -56,8 +56,8 @@ acceptmove(void)
{
int ta;
int ma;
- char af;
- int moved = 0;
+ bool af;
+ bool moved = false;
int vma, dir;
char promptstr[60];
char buf[60], last = '\0';
@@ -116,7 +116,7 @@ acceptmove(void)
*p-- = '\0';
}
last = '0';
- moved = 1;
+ moved = true;
ma -= *p - '0';
vma -= *p - '0';
if ((ta < 0 && moved) || (vma < 0 && moved))