don't declare own boolean type

This commit is contained in:
dholland 2014-03-29 19:41:10 +00:00
parent 2cad6262db
commit 37a43147ab
9 changed files with 120 additions and 128 deletions

View File

@ -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. * Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #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 */ #endif /* not lint */
#include <ctype.h> #include <ctype.h>
@ -78,7 +78,7 @@ answer(void)
if (newsock < 0) if (newsock < 0)
{ {
if (errno == EINTR) if (errno == EINTR)
return FALSE; return false;
#ifdef LOG #ifdef LOG
syslog(LOG_ERR, "accept: %m"); syslog(LOG_ERR, "accept: %m");
#else #else
@ -154,7 +154,7 @@ answer(void)
(void) fflush(pp->p_output); (void) fflush(pp->p_output);
} }
(void) close(newsock); (void) close(newsock);
return FALSE; return false;
} }
else else
#endif #endif
@ -168,7 +168,7 @@ answer(void)
(void) write(newsock, &socklen, (void) write(newsock, &socklen,
sizeof socklen); sizeof socklen);
(void) close(newsock); (void) close(newsock);
return FALSE; return false;
} }
else else
#endif #endif
@ -180,7 +180,7 @@ answer(void)
(void) write(newsock, &socklen, (void) write(newsock, &socklen,
sizeof socklen); sizeof socklen);
(void) close(newsock); (void) close(newsock);
return FALSE; return false;
} }
#ifdef MONITOR #ifdef MONITOR
@ -203,7 +203,7 @@ answer(void)
else else
#endif #endif
stplayer(pp, enter_status); stplayer(pp, enter_status);
return TRUE; return true;
} }
#ifdef MONITOR #ifdef MONITOR
@ -266,7 +266,7 @@ stplayer(PLAYER *newpp, int enter_status)
newpp->p_over = SPACE; newpp->p_over = SPACE;
newpp->p_x = x; newpp->p_x = x;
newpp->p_y = y; newpp->p_y = y;
newpp->p_undershot = FALSE; newpp->p_undershot = false;
#ifdef FLY #ifdef FLY
if (enter_status == Q_FLY) { if (enter_status == Q_FLY) {
@ -347,7 +347,7 @@ stplayer(PLAYER *newpp, int enter_status)
#endif #endif
drawmaze(newpp); drawmaze(newpp);
drawplayer(newpp, TRUE); drawplayer(newpp, true);
look(newpp); look(newpp);
#ifdef FLY #ifdef FLY
if (enter_status == Q_FLY) if (enter_status == Q_FLY)

View File

@ -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. * Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #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 */ #endif /* not lint */
#include "hunt.h" #include "hunt.h"
@ -312,7 +312,7 @@ showstat(PLAYER *pp)
* unless he is cloaked. * unless he is cloaked.
*/ */
void void
drawplayer(PLAYER *pp, FLAG draw) drawplayer(PLAYER *pp, bool draw)
{ {
PLAYER *newp; PLAYER *newp;
int x, y; int x, y;

View File

@ -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. * Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #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 */ #endif /* not lint */
#include <sys/ioctl.h> #include <sys/ioctl.h>
@ -52,8 +52,8 @@ static char *Last_arg; /* pointer to end of argv/environ */
#ifdef INTERNET #ifdef INTERNET
static int Test_socket; /* test socket to answer datagrams */ static int Test_socket; /* test socket to answer datagrams */
static FLAG inetd_spawned; /* invoked via inetd */ static bool inetd_spawned; /* invoked via inetd */
static FLAG standard_port = TRUE; /* true if listening on standard port */ static bool standard_port = true; /* true if listening on standard port */
static u_short sock_port; /* port # of tcp listen socket */ static u_short sock_port; /* port # of tcp listen socket */
static u_short stat_port; /* port # of statistics tcp socket */ static u_short stat_port; /* port # of statistics tcp socket */
#define DAEMON_SIZE (sizeof Daemon) #define DAEMON_SIZE (sizeof Daemon)
@ -62,12 +62,12 @@ static u_short stat_port; /* port # of statistics tcp socket */
#endif #endif
static void clear_scores(void); static void clear_scores(void);
static int havechar(PLAYER *, int); static bool havechar(PLAYER *, int);
static void init(void); static void init(void);
int main(int, char *[], char *[]); int main(int, char *[], char *[]);
static void makeboots(void); static void makeboots(void);
static void send_stats(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; socklen_t namelen;
SOCKET test; SOCKET test;
#endif #endif
static FLAG first = TRUE; static bool first = true;
static FLAG server = FALSE; static bool server = false;
int c, i; int c, i;
const int linger = 90 * 1000; const int linger = 90 * 1000;
@ -99,11 +99,11 @@ main(int ac, char **av, char **ep)
while ((c = getopt(ac, av, "sp:")) != -1) { while ((c = getopt(ac, av, "sp:")) != -1) {
switch (c) { switch (c) {
case 's': case 's':
server = TRUE; server = true;
break; break;
#ifdef INTERNET #ifdef INTERNET
case 'p': case 'p':
standard_port = FALSE; standard_port = false;
Test_port = atoi(optarg); Test_port = atoi(optarg);
break; break;
#endif #endif
@ -180,13 +180,13 @@ again:
moveshots(); moveshots();
for (pp = Player, i = 0; pp < End_player; ) for (pp = Player, i = 0; pp < End_player; )
if (pp->p_death[0] != '\0') if (pp->p_death[0] != '\0')
zap(pp, TRUE, i + 3); zap(pp, true, i + 3);
else else
pp++, i++; pp++, i++;
#ifdef MONITOR #ifdef MONITOR
for (pp = Monitor, i = 0; pp < End_monitor; ) for (pp = Monitor, i = 0; pp < End_monitor; )
if (pp->p_death[0] != '\0') if (pp->p_death[0] != '\0')
zap(pp, FALSE, i + MAXPL + 3); zap(pp, false, i + MAXPL + 3);
else else
pp++, i++; pp++, i++;
#endif #endif
@ -197,7 +197,7 @@ again:
if (first && standard_port) if (first && standard_port)
faketalk(); faketalk();
#endif #endif
first = FALSE; first = false;
} }
if (fdset[1].revents & POLLIN) if (fdset[1].revents & POLLIN)
send_stats(); send_stats();
@ -227,13 +227,13 @@ again:
#ifdef BOOTS #ifdef BOOTS
makeboots(); makeboots();
#endif #endif
first = TRUE; first = true;
goto again; goto again;
} }
#ifdef MONITOR #ifdef MONITOR
for (pp = Monitor, i = 0; pp < End_monitor; i++) for (pp = Monitor, i = 0; pp < End_monitor; i++)
zap(pp, FALSE, i + MAXPL + 3); zap(pp, false, i + MAXPL + 3);
#endif #endif
cleanup(0); cleanup(0);
/* NOTREACHED */ /* NOTREACHED */
@ -374,10 +374,10 @@ init(void)
len = sizeof (SOCKET); len = sizeof (SOCKET);
if (getsockname(0, (struct sockaddr *) &test_port, &len) >= 0 if (getsockname(0, (struct sockaddr *) &test_port, &len) >= 0
&& test_port.sin_family == AF_INET) { && test_port.sin_family == AF_INET) {
inetd_spawned = TRUE; inetd_spawned = true;
Test_socket = 0; Test_socket = 0;
if (test_port.sin_port != htons((u_short) Test_port)) { if (test_port.sin_port != htons((u_short) Test_port)) {
standard_port = FALSE; standard_port = false;
Test_port = ntohs(test_port.sin_port); Test_port = ntohs(test_port.sin_port);
} }
} else { } else {
@ -410,14 +410,14 @@ init(void)
#endif #endif
for (i = 0; i < NASCII; i++) for (i = 0; i < NASCII; i++)
See_over[i] = TRUE; See_over[i] = true;
See_over[DOOR] = FALSE; See_over[DOOR] = false;
See_over[WALL1] = FALSE; See_over[WALL1] = false;
See_over[WALL2] = FALSE; See_over[WALL2] = false;
See_over[WALL3] = FALSE; See_over[WALL3] = false;
#ifdef REFLECT #ifdef REFLECT
See_over[WALL4] = FALSE; See_over[WALL4] = false;
See_over[WALL5] = FALSE; See_over[WALL5] = false;
#endif #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. * Kill off a player and take him out of the game.
*/ */
static void static void
zap(PLAYER *pp, FLAG was_player, int i) zap(PLAYER *pp, bool was_player, int i)
{ {
int n, len; int n, len;
BULLET *bp; BULLET *bp;
@ -594,7 +594,7 @@ zap(PLAYER *pp, FLAG was_player, int i)
if (was_player) { if (was_player) {
if (pp->p_undershot) if (pp->p_undershot)
fixshots(pp->p_y, pp->p_x, pp->p_over); fixshots(pp->p_y, pp->p_x, pp->p_over);
drawplayer(pp, FALSE); drawplayer(pp, false);
Nplayer--; Nplayer--;
} }
@ -650,7 +650,7 @@ zap(PLAYER *pp, FLAG was_player, int i)
} }
if (x > 0) { if (x > 0) {
(void) add_shot(len, pp->p_y, pp->p_x, pp->p_face, x, (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.", (void) snprintf(Buf, sizeof(Buf), "%s detonated.",
pp->p_ident->i_name); pp->p_ident->i_name);
for (np = Player; np < End_player; np++) for (np = Player; np < End_player; np++)
@ -666,7 +666,7 @@ zap(PLAYER *pp, FLAG was_player, int i)
break; break;
if (np >= &Boot[NBOOTS]) if (np >= &Boot[NBOOTS])
err(1, "Too many boots"); err(1, "Too many boots");
np->p_undershot = FALSE; np->p_undershot = false;
np->p_x = pp->p_x; np->p_x = pp->p_x;
np->p_y = pp->p_y; np->p_y = pp->p_y;
np->p_flying = rand_num(20); 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; y = rand_num(HEIGHT / 2) + HEIGHT / 4;
} while (Maze[y][x] != SPACE); } while (Maze[y][x] != SPACE);
(void) add_shot(LAVA, y, x, LEFTS, volcano, (void) add_shot(LAVA, y, x, LEFTS, volcano,
NULL, TRUE, SPACE); NULL, true, SPACE);
for (np = Player; np < End_player; np++) for (np = Player; np < End_player; np++)
message(np, "Volcano eruption."); message(np, "Volcano eruption.");
volcano = 0; volcano = 0;
@ -714,7 +714,7 @@ zap(PLAYER *pp, FLAG was_player, int i)
add_shot(DSHOT, y, x, rand_dir(), add_shot(DSHOT, y, x, rand_dir(),
shot_req[MINDSHOT + shot_req[MINDSHOT +
rand_num(MAXBOMB - MINDSHOT)], rand_num(MAXBOMB - MINDSHOT)],
NULL, FALSE, SPACE); NULL, false, SPACE);
} }
#endif #endif
@ -808,17 +808,17 @@ rand_num(int range)
/* /*
* havechar: * havechar:
* Check to see if we have any characters in the input queue; if * 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 * we do, read them, stash them away, and return true; else return
* FALSE. * false.
*/ */
static int static bool
havechar(PLAYER *pp, int i) havechar(PLAYER *pp, int i)
{ {
if (pp->p_ncount < pp->p_nchar) if (pp->p_ncount < pp->p_nchar)
return TRUE; return true;
if (!(fdset[i].revents & POLLIN)) if (!(fdset[i].revents & POLLIN))
return FALSE; return false;
check_again: check_again:
errno = 0; errno = 0;
if ((pp->p_nchar = read(pp->p_fd, pp->p_cbuf, sizeof pp->p_cbuf)) <= 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_cbuf[0] = 'q';
} }
pp->p_ncount = 0; pp->p_ncount = 0;
return TRUE; return true;
} }
/* /*

View File

@ -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. * Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #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 */ #endif /* not lint */
#include <stdlib.h> #include <stdlib.h>
@ -194,7 +194,7 @@ move_player(PLAYER *pp, int dir)
{ {
PLAYER *newp; PLAYER *newp;
int x, y; int x, y;
FLAG moved; bool moved;
BULLET *bp; BULLET *bp;
y = pp->p_y; y = pp->p_y;
@ -215,13 +215,13 @@ move_player(PLAYER *pp, int dir)
break; break;
} }
moved = FALSE; moved = false;
switch (Maze[y][x]) { switch (Maze[y][x]) {
case SPACE: case SPACE:
#ifdef RANDOM #ifdef RANDOM
case DOOR: case DOOR:
#endif #endif
moved = TRUE; moved = true;
break; break;
case WALL1: case WALL1:
case WALL2: case WALL2:
@ -240,7 +240,7 @@ move_player(PLAYER *pp, int dir)
else else
pickup(pp, y, x, 50, Maze[y][x]); pickup(pp, y, x, 50, Maze[y][x]);
Maze[y][x] = SPACE; Maze[y][x] = SPACE;
moved = TRUE; moved = true;
break; break;
case SHOT: case SHOT:
case GRENADE: case GRENADE:
@ -254,9 +254,9 @@ move_player(PLAYER *pp, int dir)
#endif #endif
bp = is_bullet(y, x); bp = is_bullet(y, x);
if (bp != NULL) if (bp != NULL)
bp->b_expl = TRUE; bp->b_expl = true;
Maze[y][x] = SPACE; Maze[y][x] = SPACE;
moved = TRUE; moved = true;
break; break;
case LEFTS: case LEFTS:
case RIGHT: case RIGHT:
@ -297,7 +297,7 @@ move_player(PLAYER *pp, int dir)
else else
message(pp, "You can hobble around on one boot."); message(pp, "You can hobble around on one boot.");
Maze[y][x] = SPACE; Maze[y][x] = SPACE;
moved = TRUE; moved = true;
break; break;
#endif #endif
} }
@ -309,13 +309,13 @@ move_player(PLAYER *pp, int dir)
} }
if (pp->p_undershot) { if (pp->p_undershot) {
fixshots(pp->p_y, pp->p_x, pp->p_over); 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_over = Maze[y][x];
pp->p_y = y; pp->p_y = y;
pp->p_x = x; 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) { if (pp->p_face != dir) {
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); outstr(pp, Buf, 3);
add_shot(shot_type[req_index], pp->p_y, pp->p_x, pp->p_face, add_shot(shot_type[req_index], pp->p_y, pp->p_x, pp->p_face,
shot_req[req_index], pp, FALSE, pp->p_face); shot_req[req_index], pp, false, pp->p_face);
pp->p_undershot = TRUE; pp->p_undershot = true;
/* /*
* Show the object to everyone * Show the object to everyone
@ -410,8 +410,8 @@ fire_slime(PLAYER *pp, int req_index)
outstr(pp, Buf, 3); outstr(pp, Buf, 3);
add_shot(SLIME, pp->p_y, pp->p_x, pp->p_face, add_shot(SLIME, pp->p_y, pp->p_x, pp->p_face,
slime_req[req_index] * SLIME_FACTOR, pp, FALSE, pp->p_face); slime_req[req_index] * SLIME_FACTOR, pp, false, pp->p_face);
pp->p_undershot = TRUE; pp->p_undershot = true;
/* /*
* Show the object to everyone * Show the object to everyone
@ -566,7 +566,7 @@ pickup(PLAYER *pp, int y, int x, int prob, int obj)
abort(); abort();
} }
if (rand_num(100) < prob) 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 { else {
pp->p_ammo += req; pp->p_ammo += req;
(void) snprintf(Buf, sizeof(Buf), "%3d", pp->p_ammo); (void) snprintf(Buf, sizeof(Buf), "%3d", pp->p_ammo);

View File

@ -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. * Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -32,13 +32,13 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #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 */ #endif /* not lint */
#include "hunt.h" #include "hunt.h"
#if 0 /*def MONITOR*/ /* apparently unused (XXX?) */ #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 #endif
char Buf[BUFSIZ]; /* general scribbling buffer */ char Buf[BUFSIZ]; /* general scribbling buffer */

View File

@ -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. * Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #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 */ #endif /* not lint */
#include "bsd.h" #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 <unistd.h>
#include "talk_ctl.h" #include "talk_ctl.h"
#define TRUE 1
#define FALSE 0
/* defines for fake talk message to announce start of game */ /* defines for fake talk message to announce start of game */
#ifdef TALK_43 #ifdef TALK_43
#define MASQUERADE "\"Hunt Game\"" #define MASQUERADE "\"Hunt Game\""

View File

@ -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. * Copyright (c) 1983-2003, Regents of the University of California.
@ -33,6 +33,7 @@
#include "bsd.h" #include "bsd.h"
#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -186,11 +187,6 @@
#define EAST 010 #define EAST 010
#define WEST 020 #define WEST 020
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
#undef CTRL #undef CTRL
#define CTRL(x) ((x) & 037) #define CTRL(x) ((x) & 037)
@ -268,7 +264,6 @@ extern int slime_req[];
#define stat_char(pp) (((pp)->p_cloak < 0) ? _scan_char(pp) : '+') #define stat_char(pp) (((pp)->p_cloak < 0) ? _scan_char(pp) : '+')
#endif #endif
typedef int FLAG;
typedef struct bullet_def BULLET; typedef struct bullet_def BULLET;
typedef struct expl_def EXPL; typedef struct expl_def EXPL;
typedef struct player_def PLAYER; typedef struct player_def PLAYER;
@ -340,7 +335,7 @@ struct bullet_def {
char b_over; char b_over;
PLAYER *b_owner; PLAYER *b_owner;
IDENT *b_score; IDENT *b_score;
FLAG b_expl; bool b_expl;
BULLET *b_next; BULLET *b_next;
}; };
@ -359,7 +354,7 @@ struct regen_def {
* external variables * external variables
*/ */
extern FLAG Last_player; extern bool Last_player;
extern char Buf[BUFSIZ], Maze[HEIGHT][WIDTH2], Orig_maze[HEIGHT][WIDTH2]; extern char Buf[BUFSIZ], Maze[HEIGHT][WIDTH2], Orig_maze[HEIGHT][WIDTH2];
@ -393,7 +388,7 @@ extern PLAYER Boot[NBOOTS];
#endif #endif
#ifdef MONITOR #ifdef MONITOR
extern FLAG Am_monitor; extern bool Am_monitor;
extern PLAYER Monitor[MAXMON], *End_monitor; extern PLAYER Monitor[MAXMON], *End_monitor;
#endif #endif
@ -402,7 +397,7 @@ extern char *Send_message;
#endif #endif
extern char map_key[256]; extern char map_key[256];
extern FLAG no_beep; extern bool no_beep;
/* /*
* function types * function types
@ -425,7 +420,7 @@ BULLET *create_shot(int, int, int, char, int, int, PLAYER *,
void do_connect(char *, char, long); void do_connect(char *, char, long);
void do_message(void); void do_message(void);
void drawmaze(PLAYER *); void drawmaze(PLAYER *);
void drawplayer(PLAYER *, FLAG); void drawplayer(PLAYER *, bool);
void execute(PLAYER *); void execute(PLAYER *);
void faketalk(void); void faketalk(void);
void fixshots(int, int, char); void fixshots(int, int, char);
@ -438,7 +433,7 @@ void message(PLAYER *, const char *);
void mon_execute(PLAYER *); void mon_execute(PLAYER *);
void moveshots(void); void moveshots(void);
void open_ctl(void); void open_ctl(void);
int opposite(int, char); bool opposite(int, char);
void otto(int, int, char); void otto(int, int, char);
void outch(PLAYER *, int); void outch(PLAYER *, int);
void outstr(PLAYER *, const char *, int); void outstr(PLAYER *, const char *, int);

View File

@ -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. * Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #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 */ #endif /* not lint */
#include "hunt.h" #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) #define ODD(n) ((n) & 01)
#if 0 #if 0
static int candig(int, int); static bool candig(int, int);
static void dig(int, int); static void dig(int, int);
#endif #endif
static void dig_maze(int, int); static void dig_maze(int, int);
@ -108,34 +108,34 @@ dig(int y, int x)
* candig: * candig:
* Is it legal to clear this spot? * Is it legal to clear this spot?
*/ */
static int static bool
candig(int y, int x) candig(int y, int x)
{ {
int i; int i;
if (ODD(x) && ODD(y)) if (ODD(x) && ODD(y))
return FALSE; /* can't touch ODD spots */ return false; /* can't touch ODD spots */
if (y < UBOUND || y >= DBOUND) if (y < UBOUND || y >= DBOUND)
return FALSE; /* Beyond vertical bounds, NO */ return false; /* Beyond vertical bounds, NO */
if (x < LBOUND || x >= RBOUND) if (x < LBOUND || x >= RBOUND)
return FALSE; /* Beyond horizontal bounds, NO */ return false; /* Beyond horizontal bounds, NO */
if (ISCLEAR(y, x)) if (ISCLEAR(y, x))
return FALSE; /* Already clear, NO */ return false; /* Already clear, NO */
i = ISCLEAR(y, x + 1); i = ISCLEAR(y, x + 1);
i += ISCLEAR(y, x - 1); i += ISCLEAR(y, x - 1);
if (i > 1) if (i > 1)
return FALSE; /* Introduces cycle, NO */ return false; /* Introduces cycle, NO */
i += ISCLEAR(y + 1, x); i += ISCLEAR(y + 1, x);
if (i > 1) if (i > 1)
return FALSE; /* Introduces cycle, NO */ return false; /* Introduces cycle, NO */
i += ISCLEAR(y - 1, x); i += ISCLEAR(y - 1, x);
if (i > 1) if (i > 1)
return FALSE; /* Introduces cycle, NO */ return false; /* Introduces cycle, NO */
return TRUE; /* OK */ return true; /* OK */
} }
#endif #endif

View File

@ -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. * Copyright (c) 1983-2003, Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -32,7 +32,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #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 */ #endif /* not lint */
#include <err.h> #include <err.h>
@ -47,7 +47,7 @@ static void chkshot(BULLET *, BULLET *);
static void chkslime(BULLET *, BULLET *); static void chkslime(BULLET *, BULLET *);
static void explshot(BULLET *, int, int); static void explshot(BULLET *, int, int);
static void find_under(BULLET *, BULLET *); static void find_under(BULLET *, BULLET *);
static int iswall(int, int); static bool iswall(int, int);
static void mark_boot(BULLET *); static void mark_boot(BULLET *);
static void mark_player(BULLET *); static void mark_player(BULLET *);
#ifdef DRONE #ifdef DRONE
@ -319,7 +319,7 @@ move_normal_shot(BULLET *bp)
"%3d", pp->p_ammo); "%3d", pp->p_ammo);
cgoto(pp, STAT_AMMO_ROW, STAT_VALUE_COL); cgoto(pp, STAT_AMMO_ROW, STAT_VALUE_COL);
outstr(pp, Buf, 3); outstr(pp, Buf, 3);
return FALSE; return false;
} }
pp->p_ident->i_faced += bp->b_charge; pp->p_ident->i_faced += bp->b_charge;
} }
@ -354,14 +354,14 @@ move_normal_shot(BULLET *bp)
case WALL1: case WALL1:
case WALL2: case WALL2:
case WALL3: case WALL3:
bp->b_expl = TRUE; bp->b_expl = true;
break; break;
} }
bp->b_x = x; bp->b_x = x;
bp->b_y = y; bp->b_y = y;
} }
return TRUE; return true;
} }
#ifdef DRONE #ifdef DRONE
@ -413,7 +413,7 @@ move_drone(BULLET *bp)
* All blocked up, just you wait * All blocked up, just you wait
*/ */
if (count == 0) if (count == 0)
return TRUE; return true;
/* /*
* Only one way to go. * Only one way to go.
@ -499,12 +499,12 @@ drone_move:
(void) snprintf(Buf, sizeof(buf), "%3d", pp->p_ammo); (void) snprintf(Buf, sizeof(buf), "%3d", pp->p_ammo);
cgoto(pp, STAT_AMMO_ROW, STAT_VALUE_COL); cgoto(pp, STAT_AMMO_ROW, STAT_VALUE_COL);
outstr(pp, Buf, 3); outstr(pp, Buf, 3);
return FALSE; return false;
} }
bp->b_expl = TRUE; bp->b_expl = true;
break; break;
} }
return TRUE; return true;
} }
#endif #endif
@ -570,7 +570,7 @@ move_flyer(PLAYER *pp)
if (pp->p_undershot) { if (pp->p_undershot) {
fixshots(pp->p_y, pp->p_x, pp->p_over); 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; Maze[pp->p_y][pp->p_x] = pp->p_over;
x = pp->p_x + pp->p_flyx; x = pp->p_x + pp->p_flyx;
@ -732,7 +732,7 @@ chkshot(BULLET *bp, BULLET *next)
y, x, LEFTS, y, x, LEFTS,
(Maze[y][x] == GMINE) ? (Maze[y][x] == GMINE) ?
GRENREQ : BULREQ, GRENREQ : BULREQ,
NULL, TRUE, SPACE); NULL, true, SPACE);
Maze[y][x] = SPACE; Maze[y][x] = SPACE;
break; break;
} }
@ -916,28 +916,28 @@ move_slime(BULLET *bp, int speed, BULLET *next)
if (dirmask & WEST) { if (dirmask & WEST) {
count--; count--;
nbp = create_shot(bp->b_type, bp->b_y, bp->b_x - 1, LEFTS, 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); move_slime(nbp, speed - 1, next);
} }
if (dirmask & EAST) { if (dirmask & EAST) {
count--; count--;
nbp = create_shot(bp->b_type, bp->b_y, bp->b_x + 1, RIGHT, 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, (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); move_slime(nbp, speed - 1, next);
} }
if (dirmask & NORTH) { if (dirmask & NORTH) {
count--; count--;
nbp = create_shot(bp->b_type, bp->b_y - 1, bp->b_x, ABOVE, 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, (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); move_slime(nbp, speed - 1, next);
} }
if (dirmask & SOUTH) { if (dirmask & SOUTH) {
count--; count--;
nbp = create_shot(bp->b_type, bp->b_y + 1, bp->b_x, BELOW, 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, (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); move_slime(nbp, speed - 1, next);
} }
@ -948,11 +948,11 @@ move_slime(BULLET *bp, int speed, BULLET *next)
* iswall: * iswall:
* returns whether the given location is a wall * returns whether the given location is a wall
*/ */
static int static bool
iswall(int y, int x) iswall(int y, int x)
{ {
if (y < 0 || x < 0 || y >= HEIGHT || x >= WIDTH) if (y < 0 || x < 0 || y >= HEIGHT || x >= WIDTH)
return TRUE; return true;
switch (Maze[y][x]) { switch (Maze[y][x]) {
case WALL1: case WALL1:
case WALL2: case WALL2:
@ -970,9 +970,9 @@ iswall(int y, int x)
case LAVA: case LAVA:
#endif #endif
#endif #endif
return TRUE; return true;
} }
return FALSE; return false;
} }
#endif #endif
@ -984,15 +984,15 @@ static void
zapshot(BULLET *blist, BULLET *obp) zapshot(BULLET *blist, BULLET *obp)
{ {
BULLET *bp; BULLET *bp;
FLAG explode; bool explode;
explode = FALSE; explode = false;
for (bp = blist; bp != NULL; bp = bp->b_next) { for (bp = blist; bp != NULL; bp = bp->b_next) {
if (bp->b_x != obp->b_x || bp->b_y != obp->b_y) if (bp->b_x != obp->b_x || bp->b_y != obp->b_y)
continue; continue;
if (bp->b_face == obp->b_face) if (bp->b_face == obp->b_face)
continue; continue;
explode = TRUE; explode = true;
break; break;
} }
if (!explode) if (!explode)
@ -1011,7 +1011,7 @@ explshot(BULLET *blist, int y, int x)
for (bp = blist; bp != NULL; bp = bp->b_next) for (bp = blist; bp != NULL; bp = bp->b_next)
if (bp->b_x == x && bp->b_y == y) { if (bp->b_x == x && bp->b_y == y) {
bp->b_expl = TRUE; bp->b_expl = true;
if (bp->b_owner != NULL) if (bp->b_owner != NULL)
message(bp->b_owner, "Shot intercepted"); message(bp->b_owner, "Shot intercepted");
} }
@ -1035,10 +1035,10 @@ play_at(int y, int x)
/* /*
* opposite: * 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 * of the player in the maze
*/ */
int bool
opposite(int face, char dir) opposite(int face, char dir)
{ {
switch (face) { switch (face) {
@ -1051,7 +1051,7 @@ opposite(int face, char dir)
case BELOW: case BELOW:
return (dir == ABOVE); return (dir == ABOVE);
default: default:
return FALSE; return false;
} }
} }
@ -1114,7 +1114,7 @@ mark_player(BULLET *bp)
for (pp = Player; pp < End_player; pp++) for (pp = Player; pp < End_player; pp++)
if (pp->p_y == bp->b_y && pp->p_x == bp->b_x) { if (pp->p_y == bp->b_y && pp->p_x == bp->b_x) {
pp->p_undershot = TRUE; pp->p_undershot = true;
break; break;
} }
} }
@ -1131,7 +1131,7 @@ mark_boot(BULLET *bp)
for (pp = Boot; pp < &Boot[NBOOTS]; pp++) for (pp = Boot; pp < &Boot[NBOOTS]; pp++)
if (pp->p_y == bp->b_y && pp->p_x == bp->b_x) { if (pp->p_y == bp->b_y && pp->p_x == bp->b_x) {
pp->p_undershot = TRUE; pp->p_undershot = true;
break; break;
} }
} }