summaryrefslogtreecommitdiffstats
path: root/hunt
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2014-03-29 19:41:10 +0000
committerdholland <dholland@NetBSD.org>2014-03-29 19:41:10 +0000
commitb432256ee8cb43f841c457f6d542c54fc98291e0 (patch)
treebe5c4234c2eb39a573a0c172953d2d5a5210c2e7 /hunt
parentfa3a22500af8a864dcb4e24df60437f2c8503df7 (diff)
downloadbsdgames-darwin-b432256ee8cb43f841c457f6d542c54fc98291e0.tar.gz
bsdgames-darwin-b432256ee8cb43f841c457f6d542c54fc98291e0.tar.zst
bsdgames-darwin-b432256ee8cb43f841c457f6d542c54fc98291e0.zip
don't declare own boolean type
Diffstat (limited to 'hunt')
-rw-r--r--hunt/huntd/answer.c18
-rw-r--r--hunt/huntd/draw.c6
-rw-r--r--hunt/huntd/driver.c72
-rw-r--r--hunt/huntd/execute.c36
-rw-r--r--hunt/huntd/extern.c6
-rw-r--r--hunt/huntd/faketalk.c7
-rw-r--r--hunt/huntd/hunt.h21
-rw-r--r--hunt/huntd/makemaze.c24
-rw-r--r--hunt/huntd/shots.c58
9 files changed, 120 insertions, 128 deletions
diff --git a/hunt/huntd/answer.c b/hunt/huntd/answer.c
index 95bdded4..da040f19 100644
--- a/hunt/huntd/answer.c
+++ b/hunt/huntd/answer.c
@@ -1,4 +1,4 @@
-/* $NetBSD: answer.c,v 1.16 2009/08/27 00:36:32 dholland Exp $ */
+/* $NetBSD: answer.c,v 1.17 2014/03/29 19:41:10 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: answer.c,v 1.16 2009/08/27 00:36:32 dholland Exp $");
+__RCSID("$NetBSD: answer.c,v 1.17 2014/03/29 19:41:10 dholland Exp $");
#endif /* not lint */
#include <ctype.h>
@@ -78,7 +78,7 @@ answer(void)
if (newsock < 0)
{
if (errno == EINTR)
- return FALSE;
+ return false;
#ifdef LOG
syslog(LOG_ERR, "accept: %m");
#else
@@ -154,7 +154,7 @@ answer(void)
(void) fflush(pp->p_output);
}
(void) close(newsock);
- return FALSE;
+ return false;
}
else
#endif
@@ -168,7 +168,7 @@ answer(void)
(void) write(newsock, &socklen,
sizeof socklen);
(void) close(newsock);
- return FALSE;
+ return false;
}
else
#endif
@@ -180,7 +180,7 @@ answer(void)
(void) write(newsock, &socklen,
sizeof socklen);
(void) close(newsock);
- return FALSE;
+ return false;
}
#ifdef MONITOR
@@ -203,7 +203,7 @@ answer(void)
else
#endif
stplayer(pp, enter_status);
- return TRUE;
+ return true;
}
#ifdef MONITOR
@@ -266,7 +266,7 @@ stplayer(PLAYER *newpp, int enter_status)
newpp->p_over = SPACE;
newpp->p_x = x;
newpp->p_y = y;
- newpp->p_undershot = FALSE;
+ newpp->p_undershot = false;
#ifdef FLY
if (enter_status == Q_FLY) {
@@ -347,7 +347,7 @@ stplayer(PLAYER *newpp, int enter_status)
#endif
drawmaze(newpp);
- drawplayer(newpp, TRUE);
+ drawplayer(newpp, true);
look(newpp);
#ifdef FLY
if (enter_status == Q_FLY)
diff --git a/hunt/huntd/draw.c b/hunt/huntd/draw.c
index f56d4748..61756211 100644
--- a/hunt/huntd/draw.c
+++ b/hunt/huntd/draw.c
@@ -1,4 +1,4 @@
-/* $NetBSD: draw.c,v 1.8 2009/08/12 07:42:11 dholland Exp $ */
+/* $NetBSD: draw.c,v 1.9 2014/03/29 19:41:10 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: draw.c,v 1.8 2009/08/12 07:42:11 dholland Exp $");
+__RCSID("$NetBSD: draw.c,v 1.9 2014/03/29 19:41:10 dholland Exp $");
#endif /* not lint */
#include "hunt.h"
@@ -312,7 +312,7 @@ showstat(PLAYER *pp)
* unless he is cloaked.
*/
void
-drawplayer(PLAYER *pp, FLAG draw)
+drawplayer(PLAYER *pp, bool draw)
{
PLAYER *newp;
int x, y;
diff --git a/hunt/huntd/driver.c b/hunt/huntd/driver.c
index ea91fe77..e200b662 100644
--- a/hunt/huntd/driver.c
+++ b/hunt/huntd/driver.c
@@ -1,4 +1,4 @@
-/* $NetBSD: driver.c,v 1.23 2014/03/29 19:33:03 dholland Exp $ */
+/* $NetBSD: driver.c,v 1.24 2014/03/29 19:41:10 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: driver.c,v 1.23 2014/03/29 19:33:03 dholland Exp $");
+__RCSID("$NetBSD: driver.c,v 1.24 2014/03/29 19:41:10 dholland Exp $");
#endif /* not lint */
#include <sys/ioctl.h>
@@ -52,8 +52,8 @@ static char *Last_arg; /* pointer to end of argv/environ */
#ifdef INTERNET
static int Test_socket; /* test socket to answer datagrams */
-static FLAG inetd_spawned; /* invoked via inetd */
-static FLAG standard_port = TRUE; /* true if listening on standard port */
+static bool inetd_spawned; /* invoked via inetd */
+static bool standard_port = true; /* true if listening on standard port */
static u_short sock_port; /* port # of tcp listen socket */
static u_short stat_port; /* port # of statistics tcp socket */
#define DAEMON_SIZE (sizeof Daemon)
@@ -62,12 +62,12 @@ static u_short stat_port; /* port # of statistics tcp socket */
#endif
static void clear_scores(void);
-static int havechar(PLAYER *, int);
+static bool havechar(PLAYER *, int);
static void init(void);
int main(int, char *[], char *[]);
static void makeboots(void);
static void send_stats(void);
-static void zap(PLAYER *, FLAG, int);
+static void zap(PLAYER *, bool, int);
/*
@@ -84,8 +84,8 @@ main(int ac, char **av, char **ep)
socklen_t namelen;
SOCKET test;
#endif
- static FLAG first = TRUE;
- static FLAG server = FALSE;
+ static bool first = true;
+ static bool server = false;
int c, i;
const int linger = 90 * 1000;
@@ -99,11 +99,11 @@ main(int ac, char **av, char **ep)
while ((c = getopt(ac, av, "sp:")) != -1) {
switch (c) {
case 's':
- server = TRUE;
+ server = true;
break;
#ifdef INTERNET
case 'p':
- standard_port = FALSE;
+ standard_port = false;
Test_port = atoi(optarg);
break;
#endif
@@ -180,13 +180,13 @@ again:
moveshots();
for (pp = Player, i = 0; pp < End_player; )
if (pp->p_death[0] != '\0')
- zap(pp, TRUE, i + 3);
+ zap(pp, true, i + 3);
else
pp++, i++;
#ifdef MONITOR
for (pp = Monitor, i = 0; pp < End_monitor; )
if (pp->p_death[0] != '\0')
- zap(pp, FALSE, i + MAXPL + 3);
+ zap(pp, false, i + MAXPL + 3);
else
pp++, i++;
#endif
@@ -197,7 +197,7 @@ again:
if (first && standard_port)
faketalk();
#endif
- first = FALSE;
+ first = false;
}
if (fdset[1].revents & POLLIN)
send_stats();
@@ -227,13 +227,13 @@ again:
#ifdef BOOTS
makeboots();
#endif
- first = TRUE;
+ first = true;
goto again;
}
#ifdef MONITOR
for (pp = Monitor, i = 0; pp < End_monitor; i++)
- zap(pp, FALSE, i + MAXPL + 3);
+ zap(pp, false, i + MAXPL + 3);
#endif
cleanup(0);
/* NOTREACHED */
@@ -374,10 +374,10 @@ init(void)
len = sizeof (SOCKET);
if (getsockname(0, (struct sockaddr *) &test_port, &len) >= 0
&& test_port.sin_family == AF_INET) {
- inetd_spawned = TRUE;
+ inetd_spawned = true;
Test_socket = 0;
if (test_port.sin_port != htons((u_short) Test_port)) {
- standard_port = FALSE;
+ standard_port = false;
Test_port = ntohs(test_port.sin_port);
}
} else {
@@ -410,14 +410,14 @@ init(void)
#endif
for (i = 0; i < NASCII; i++)
- See_over[i] = TRUE;
- See_over[DOOR] = FALSE;
- See_over[WALL1] = FALSE;
- See_over[WALL2] = FALSE;
- See_over[WALL3] = FALSE;
+ See_over[i] = true;
+ See_over[DOOR] = false;
+ See_over[WALL1] = false;
+ See_over[WALL2] = false;
+ See_over[WALL3] = false;
#ifdef REFLECT
- See_over[WALL4] = FALSE;
- See_over[WALL5] = FALSE;
+ See_over[WALL4] = false;
+ See_over[WALL5] = false;
#endif
}
@@ -584,7 +584,7 @@ checkdam(PLAYER *ouch, PLAYER *gotcha, IDENT *credit, int amt,
* Kill off a player and take him out of the game.
*/
static void
-zap(PLAYER *pp, FLAG was_player, int i)
+zap(PLAYER *pp, bool was_player, int i)
{
int n, len;
BULLET *bp;
@@ -594,7 +594,7 @@ zap(PLAYER *pp, FLAG was_player, int i)
if (was_player) {
if (pp->p_undershot)
fixshots(pp->p_y, pp->p_x, pp->p_over);
- drawplayer(pp, FALSE);
+ drawplayer(pp, false);
Nplayer--;
}
@@ -650,7 +650,7 @@ zap(PLAYER *pp, FLAG was_player, int i)
}
if (x > 0) {
(void) add_shot(len, pp->p_y, pp->p_x, pp->p_face, x,
- NULL, TRUE, SPACE);
+ NULL, true, SPACE);
(void) snprintf(Buf, sizeof(Buf), "%s detonated.",
pp->p_ident->i_name);
for (np = Player; np < End_player; np++)
@@ -666,7 +666,7 @@ zap(PLAYER *pp, FLAG was_player, int i)
break;
if (np >= &Boot[NBOOTS])
err(1, "Too many boots");
- np->p_undershot = FALSE;
+ np->p_undershot = false;
np->p_x = pp->p_x;
np->p_y = pp->p_y;
np->p_flying = rand_num(20);
@@ -698,7 +698,7 @@ zap(PLAYER *pp, FLAG was_player, int i)
y = rand_num(HEIGHT / 2) + HEIGHT / 4;
} while (Maze[y][x] != SPACE);
(void) add_shot(LAVA, y, x, LEFTS, volcano,
- NULL, TRUE, SPACE);
+ NULL, true, SPACE);
for (np = Player; np < End_player; np++)
message(np, "Volcano eruption.");
volcano = 0;
@@ -714,7 +714,7 @@ zap(PLAYER *pp, FLAG was_player, int i)
add_shot(DSHOT, y, x, rand_dir(),
shot_req[MINDSHOT +
rand_num(MAXBOMB - MINDSHOT)],
- NULL, FALSE, SPACE);
+ NULL, false, SPACE);
}
#endif
@@ -808,17 +808,17 @@ rand_num(int range)
/*
* havechar:
* Check to see if we have any characters in the input queue; if
- * we do, read them, stash them away, and return TRUE; else return
- * FALSE.
+ * we do, read them, stash them away, and return true; else return
+ * false.
*/
-static int
+static bool
havechar(PLAYER *pp, int i)
{
if (pp->p_ncount < pp->p_nchar)
- return TRUE;
+ return true;
if (!(fdset[i].revents & POLLIN))
- return FALSE;
+ return false;
check_again:
errno = 0;
if ((pp->p_nchar = read(pp->p_fd, pp->p_cbuf, sizeof pp->p_cbuf)) <= 0)
@@ -828,7 +828,7 @@ check_again:
pp->p_cbuf[0] = 'q';
}
pp->p_ncount = 0;
- return TRUE;
+ return true;
}
/*
diff --git a/hunt/huntd/execute.c b/hunt/huntd/execute.c
index e3e5ba2b..61a7d3e4 100644
--- a/hunt/huntd/execute.c
+++ b/hunt/huntd/execute.c
@@ -1,4 +1,4 @@
-/* $NetBSD: execute.c,v 1.10 2011/08/31 16:24:56 plunky Exp $ */
+/* $NetBSD: execute.c,v 1.11 2014/03/29 19:41:10 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: execute.c,v 1.10 2011/08/31 16:24:56 plunky Exp $");
+__RCSID("$NetBSD: execute.c,v 1.11 2014/03/29 19:41:10 dholland Exp $");
#endif /* not lint */
#include <stdlib.h>
@@ -194,7 +194,7 @@ move_player(PLAYER *pp, int dir)
{
PLAYER *newp;
int x, y;
- FLAG moved;
+ bool moved;
BULLET *bp;
y = pp->p_y;
@@ -215,13 +215,13 @@ move_player(PLAYER *pp, int dir)
break;
}
- moved = FALSE;
+ moved = false;
switch (Maze[y][x]) {
case SPACE:
#ifdef RANDOM
case DOOR:
#endif
- moved = TRUE;
+ moved = true;
break;
case WALL1:
case WALL2:
@@ -240,7 +240,7 @@ move_player(PLAYER *pp, int dir)
else
pickup(pp, y, x, 50, Maze[y][x]);
Maze[y][x] = SPACE;
- moved = TRUE;
+ moved = true;
break;
case SHOT:
case GRENADE:
@@ -254,9 +254,9 @@ move_player(PLAYER *pp, int dir)
#endif
bp = is_bullet(y, x);
if (bp != NULL)
- bp->b_expl = TRUE;
+ bp->b_expl = true;
Maze[y][x] = SPACE;
- moved = TRUE;
+ moved = true;
break;
case LEFTS:
case RIGHT:
@@ -297,7 +297,7 @@ move_player(PLAYER *pp, int dir)
else
message(pp, "You can hobble around on one boot.");
Maze[y][x] = SPACE;
- moved = TRUE;
+ moved = true;
break;
#endif
}
@@ -309,13 +309,13 @@ move_player(PLAYER *pp, int dir)
}
if (pp->p_undershot) {
fixshots(pp->p_y, pp->p_x, pp->p_over);
- pp->p_undershot = FALSE;
+ pp->p_undershot = false;
}
- drawplayer(pp, FALSE);
+ drawplayer(pp, false);
pp->p_over = Maze[y][x];
pp->p_y = y;
pp->p_x = x;
- drawplayer(pp, TRUE);
+ drawplayer(pp, true);
}
}
@@ -328,7 +328,7 @@ turn_player(PLAYER *pp, int dir)
{
if (pp->p_face != dir) {
pp->p_face = dir;
- drawplayer(pp, TRUE);
+ drawplayer(pp, true);
}
}
@@ -363,8 +363,8 @@ fire(PLAYER *pp, int req_index)
outstr(pp, Buf, 3);
add_shot(shot_type[req_index], pp->p_y, pp->p_x, pp->p_face,
- shot_req[req_index], pp, FALSE, pp->p_face);
- pp->p_undershot = TRUE;
+ shot_req[req_index], pp, false, pp->p_face);
+ pp->p_undershot = true;
/*
* Show the object to everyone
@@ -410,8 +410,8 @@ fire_slime(PLAYER *pp, int req_index)
outstr(pp, Buf, 3);
add_shot(SLIME, pp->p_y, pp->p_x, pp->p_face,
- slime_req[req_index] * SLIME_FACTOR, pp, FALSE, pp->p_face);
- pp->p_undershot = TRUE;
+ slime_req[req_index] * SLIME_FACTOR, pp, false, pp->p_face);
+ pp->p_undershot = true;
/*
* Show the object to everyone
@@ -566,7 +566,7 @@ pickup(PLAYER *pp, int y, int x, int prob, int obj)
abort();
}
if (rand_num(100) < prob)
- add_shot(obj, y, x, LEFTS, req, NULL, TRUE, pp->p_face);
+ add_shot(obj, y, x, LEFTS, req, NULL, true, pp->p_face);
else {
pp->p_ammo += req;
(void) snprintf(Buf, sizeof(Buf), "%3d", pp->p_ammo);
diff --git a/hunt/huntd/extern.c b/hunt/huntd/extern.c
index bee6851c..9faeea30 100644
--- a/hunt/huntd/extern.c
+++ b/hunt/huntd/extern.c
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.c,v 1.6 2009/08/12 07:42:11 dholland Exp $ */
+/* $NetBSD: extern.c,v 1.7 2014/03/29 19:41:10 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved.
@@ -32,13 +32,13 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: extern.c,v 1.6 2009/08/12 07:42:11 dholland Exp $");
+__RCSID("$NetBSD: extern.c,v 1.7 2014/03/29 19:41:10 dholland Exp $");
#endif /* not lint */
#include "hunt.h"
#if 0 /*def MONITOR*/ /* apparently unused (XXX?) */
-FLAG Am_monitor = FALSE; /* current process is a monitor */
+bool Am_monitor = false; /* current process is a monitor */
#endif
char Buf[BUFSIZ]; /* general scribbling buffer */
diff --git a/hunt/huntd/faketalk.c b/hunt/huntd/faketalk.c
index a4926df8..973a4edf 100644
--- a/hunt/huntd/faketalk.c
+++ b/hunt/huntd/faketalk.c
@@ -1,4 +1,4 @@
-/* $NetBSD: faketalk.c,v 1.19 2014/03/29 19:03:21 dholland Exp $ */
+/* $NetBSD: faketalk.c,v 1.20 2014/03/29 19:41:10 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: faketalk.c,v 1.19 2014/03/29 19:03:21 dholland Exp $");
+__RCSID("$NetBSD: faketalk.c,v 1.20 2014/03/29 19:41:10 dholland Exp $");
#endif /* not lint */
#include "bsd.h"
@@ -50,9 +50,6 @@ __RCSID("$NetBSD: faketalk.c,v 1.19 2014/03/29 19:03:21 dholland Exp $");
#include <unistd.h>
#include "talk_ctl.h"
-#define TRUE 1
-#define FALSE 0
-
/* defines for fake talk message to announce start of game */
#ifdef TALK_43
#define MASQUERADE "\"Hunt Game\""
diff --git a/hunt/huntd/hunt.h b/hunt/huntd/hunt.h
index 116a418c..122e7468 100644
--- a/hunt/huntd/hunt.h
+++ b/hunt/huntd/hunt.h
@@ -1,4 +1,4 @@
-/* $NetBSD: hunt.h,v 1.19 2009/08/12 07:42:11 dholland Exp $ */
+/* $NetBSD: hunt.h,v 1.20 2014/03/29 19:41:10 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
@@ -33,6 +33,7 @@
#include "bsd.h"
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
@@ -186,11 +187,6 @@
#define EAST 010
#define WEST 020
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-
#undef CTRL
#define CTRL(x) ((x) & 037)
@@ -268,7 +264,6 @@ extern int slime_req[];
#define stat_char(pp) (((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
#endif
-typedef int FLAG;
typedef struct bullet_def BULLET;
typedef struct expl_def EXPL;
typedef struct player_def PLAYER;
@@ -340,7 +335,7 @@ struct bullet_def {
char b_over;
PLAYER *b_owner;
IDENT *b_score;
- FLAG b_expl;
+ bool b_expl;
BULLET *b_next;
};
@@ -359,7 +354,7 @@ struct regen_def {
* external variables
*/
-extern FLAG Last_player;
+extern bool Last_player;
extern char Buf[BUFSIZ], Maze[HEIGHT][WIDTH2], Orig_maze[HEIGHT][WIDTH2];
@@ -393,7 +388,7 @@ extern PLAYER Boot[NBOOTS];
#endif
#ifdef MONITOR
-extern FLAG Am_monitor;
+extern bool Am_monitor;
extern PLAYER Monitor[MAXMON], *End_monitor;
#endif
@@ -402,7 +397,7 @@ extern char *Send_message;
#endif
extern char map_key[256];
-extern FLAG no_beep;
+extern bool no_beep;
/*
* function types
@@ -425,7 +420,7 @@ BULLET *create_shot(int, int, int, char, int, int, PLAYER *,
void do_connect(char *, char, long);
void do_message(void);
void drawmaze(PLAYER *);
-void drawplayer(PLAYER *, FLAG);
+void drawplayer(PLAYER *, bool);
void execute(PLAYER *);
void faketalk(void);
void fixshots(int, int, char);
@@ -438,7 +433,7 @@ void message(PLAYER *, const char *);
void mon_execute(PLAYER *);
void moveshots(void);
void open_ctl(void);
-int opposite(int, char);
+bool opposite(int, char);
void otto(int, int, char);
void outch(PLAYER *, int);
void outstr(PLAYER *, const char *, int);
diff --git a/hunt/huntd/makemaze.c b/hunt/huntd/makemaze.c
index eca437e4..485363e3 100644
--- a/hunt/huntd/makemaze.c
+++ b/hunt/huntd/makemaze.c
@@ -1,4 +1,4 @@
-/* $NetBSD: makemaze.c,v 1.8 2011/05/23 22:58:44 joerg Exp $ */
+/* $NetBSD: makemaze.c,v 1.9 2014/03/29 19:41:11 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: makemaze.c,v 1.8 2011/05/23 22:58:44 joerg Exp $");
+__RCSID("$NetBSD: makemaze.c,v 1.9 2014/03/29 19:41:11 dholland Exp $");
#endif /* not lint */
#include "hunt.h"
@@ -41,7 +41,7 @@ __RCSID("$NetBSD: makemaze.c,v 1.8 2011/05/23 22:58:44 joerg Exp $");
#define ODD(n) ((n) & 01)
#if 0
-static int candig(int, int);
+static bool candig(int, int);
static void dig(int, int);
#endif
static void dig_maze(int, int);
@@ -108,34 +108,34 @@ dig(int y, int x)
* candig:
* Is it legal to clear this spot?
*/
-static int
+static bool
candig(int y, int x)
{
int i;
if (ODD(x) && ODD(y))
- return FALSE; /* can't touch ODD spots */
+ return false; /* can't touch ODD spots */
if (y < UBOUND || y >= DBOUND)
- return FALSE; /* Beyond vertical bounds, NO */
+ return false; /* Beyond vertical bounds, NO */
if (x < LBOUND || x >= RBOUND)
- return FALSE; /* Beyond horizontal bounds, NO */
+ return false; /* Beyond horizontal bounds, NO */
if (ISCLEAR(y, x))
- return FALSE; /* Already clear, NO */
+ return false; /* Already clear, NO */
i = ISCLEAR(y, x + 1);
i += ISCLEAR(y, x - 1);
if (i > 1)
- return FALSE; /* Introduces cycle, NO */
+ return false; /* Introduces cycle, NO */
i += ISCLEAR(y + 1, x);
if (i > 1)
- return FALSE; /* Introduces cycle, NO */
+ return false; /* Introduces cycle, NO */
i += ISCLEAR(y - 1, x);
if (i > 1)
- return FALSE; /* Introduces cycle, NO */
+ return false; /* Introduces cycle, NO */
- return TRUE; /* OK */
+ return true; /* OK */
}
#endif
diff --git a/hunt/huntd/shots.c b/hunt/huntd/shots.c
index 7a5192fc..ada15f00 100644
--- a/hunt/huntd/shots.c
+++ b/hunt/huntd/shots.c
@@ -1,4 +1,4 @@
-/* $NetBSD: shots.c,v 1.12 2011/08/31 16:24:56 plunky Exp $ */
+/* $NetBSD: shots.c,v 1.13 2014/03/29 19:41:11 dholland Exp $ */
/*
* Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: shots.c,v 1.12 2011/08/31 16:24:56 plunky Exp $");
+__RCSID("$NetBSD: shots.c,v 1.13 2014/03/29 19:41:11 dholland Exp $");
#endif /* not lint */
#include <err.h>
@@ -47,7 +47,7 @@ static void chkshot(BULLET *, BULLET *);
static void chkslime(BULLET *, BULLET *);
static void explshot(BULLET *, int, int);
static void find_under(BULLET *, BULLET *);
-static int iswall(int, int);
+static bool iswall(int, int);
static void mark_boot(BULLET *);
static void mark_player(BULLET *);
#ifdef DRONE
@@ -319,7 +319,7 @@ move_normal_shot(BULLET *bp)
"%3d", pp->p_ammo);
cgoto(pp, STAT_AMMO_ROW, STAT_VALUE_COL);
outstr(pp, Buf, 3);
- return FALSE;
+ return false;
}
pp->p_ident->i_faced += bp->b_charge;
}
@@ -354,14 +354,14 @@ move_normal_shot(BULLET *bp)
case WALL1:
case WALL2:
case WALL3:
- bp->b_expl = TRUE;
+ bp->b_expl = true;
break;
}
bp->b_x = x;
bp->b_y = y;
}
- return TRUE;
+ return true;
}
#ifdef DRONE
@@ -413,7 +413,7 @@ move_drone(BULLET *bp)
* All blocked up, just you wait
*/
if (count == 0)
- return TRUE;
+ return true;
/*
* Only one way to go.
@@ -499,12 +499,12 @@ drone_move:
(void) snprintf(Buf, sizeof(buf), "%3d", pp->p_ammo);
cgoto(pp, STAT_AMMO_ROW, STAT_VALUE_COL);
outstr(pp, Buf, 3);
- return FALSE;
+ return false;
}
- bp->b_expl = TRUE;
+ bp->b_expl = true;
break;
}
- return TRUE;
+ return true;
}
#endif
@@ -570,7 +570,7 @@ move_flyer(PLAYER *pp)
if (pp->p_undershot) {
fixshots(pp->p_y, pp->p_x, pp->p_over);
- pp->p_undershot = FALSE;
+ pp->p_undershot = false;
}
Maze[pp->p_y][pp->p_x] = pp->p_over;
x = pp->p_x + pp->p_flyx;
@@ -732,7 +732,7 @@ chkshot(BULLET *bp, BULLET *next)
y, x, LEFTS,
(Maze[y][x] == GMINE) ?
GRENREQ : BULREQ,
- NULL, TRUE, SPACE);
+ NULL, true, SPACE);
Maze[y][x] = SPACE;
break;
}
@@ -916,28 +916,28 @@ move_slime(BULLET *bp, int speed, BULLET *next)
if (dirmask & WEST) {
count--;
nbp = create_shot(bp->b_type, bp->b_y, bp->b_x - 1, LEFTS,
- i, bp->b_size, bp->b_owner, bp->b_score, TRUE, SPACE);
+ i, bp->b_size, bp->b_owner, bp->b_score, true, SPACE);
move_slime(nbp, speed - 1, next);
}
if (dirmask & EAST) {
count--;
nbp = create_shot(bp->b_type, bp->b_y, bp->b_x + 1, RIGHT,
(count < j) ? i + 1 : i, bp->b_size, bp->b_owner,
- bp->b_score, TRUE, SPACE);
+ bp->b_score, true, SPACE);
move_slime(nbp, speed - 1, next);
}
if (dirmask & NORTH) {
count--;
nbp = create_shot(bp->b_type, bp->b_y - 1, bp->b_x, ABOVE,
(count < j) ? i + 1 : i, bp->b_size, bp->b_owner,
- bp->b_score, TRUE, SPACE);
+ bp->b_score, true, SPACE);
move_slime(nbp, speed - 1, next);
}
if (dirmask & SOUTH) {
count--;
nbp = create_shot(bp->b_type, bp->b_y + 1, bp->b_x, BELOW,
(count < j) ? i + 1 : i, bp->b_size, bp->b_owner,
- bp->b_score, TRUE, SPACE);
+ bp->b_score, true, SPACE);
move_slime(nbp, speed - 1, next);
}
@@ -948,11 +948,11 @@ move_slime(BULLET *bp, int speed, BULLET *next)
* iswall:
* returns whether the given location is a wall
*/
-static int
+static bool
iswall(int y, int x)
{
if (y < 0 || x < 0 || y >= HEIGHT || x >= WIDTH)
- return TRUE;
+ return true;
switch (Maze[y][x]) {
case WALL1:
case WALL2:
@@ -970,9 +970,9 @@ iswall(int y, int x)
case LAVA:
#endif
#endif
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
#endif
@@ -984,15 +984,15 @@ static void
zapshot(BULLET *blist, BULLET *obp)
{
BULLET *bp;
- FLAG explode;
+ bool explode;
- explode = FALSE;
+ explode = false;
for (bp = blist; bp != NULL; bp = bp->b_next) {
if (bp->b_x != obp->b_x || bp->b_y != obp->b_y)
continue;
if (bp->b_face == obp->b_face)
continue;
- explode = TRUE;
+ explode = true;
break;
}
if (!explode)
@@ -1011,7 +1011,7 @@ explshot(BULLET *blist, int y, int x)
for (bp = blist; bp != NULL; bp = bp->b_next)
if (bp->b_x == x && bp->b_y == y) {
- bp->b_expl = TRUE;
+ bp->b_expl = true;
if (bp->b_owner != NULL)
message(bp->b_owner, "Shot intercepted");
}
@@ -1035,10 +1035,10 @@ play_at(int y, int x)
/*
* opposite:
- * Return TRUE if the bullet direction faces the opposite direction
+ * Return true if the bullet direction faces the opposite direction
* of the player in the maze
*/
-int
+bool
opposite(int face, char dir)
{
switch (face) {
@@ -1051,7 +1051,7 @@ opposite(int face, char dir)
case BELOW:
return (dir == ABOVE);
default:
- return FALSE;
+ return false;
}
}
@@ -1114,7 +1114,7 @@ mark_player(BULLET *bp)
for (pp = Player; pp < End_player; pp++)
if (pp->p_y == bp->b_y && pp->p_x == bp->b_x) {
- pp->p_undershot = TRUE;
+ pp->p_undershot = true;
break;
}
}
@@ -1131,7 +1131,7 @@ mark_boot(BULLET *bp)
for (pp = Boot; pp < &Boot[NBOOTS]; pp++)
if (pp->p_y == bp->b_y && pp->p_x == bp->b_x) {
- pp->p_undershot = TRUE;
+ pp->p_undershot = true;
break;
}
}