From 378015332508b48169d5f735be9a4bb4b6c82c03 Mon Sep 17 00:00:00 2001 From: dholland Date: Sat, 14 Mar 2009 20:04:43 +0000 Subject: Sprinkle some "bool". And don't use '\0' to mean 'false'. --- sail/dr_2.c | 10 +++++----- sail/dr_3.c | 6 +++--- sail/extern.h | 7 ++++--- sail/game.c | 9 +++++---- sail/pl_5.c | 10 +++++----- 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 +#include #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 +#include #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)) -- cgit v1.2.3-56-ge451