From c6e948ac19bb127df730e719b63d4d76ad915237 Mon Sep 17 00:00:00 2001 From: dholland Date: Sat, 29 Mar 2014 20:52:13 +0000 Subject: [PATCH] catch up to huntd changes. XXX: this needs to stop promiscuously sharing .h files. --- games/hunt/hunt/hunt.c | 44 ++++++++++++++++++++-------------------- games/hunt/hunt/otto.c | 14 ++++++------- games/hunt/hunt/playit.c | 17 ++++++++-------- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/games/hunt/hunt/hunt.c b/games/hunt/hunt/hunt.c index 133741b702f5..23cb70038f51 100644 --- a/games/hunt/hunt/hunt.c +++ b/games/hunt/hunt/hunt.c @@ -1,4 +1,4 @@ -/* $NetBSD: hunt.c,v 1.41 2011/09/01 07:18:50 plunky Exp $ */ +/* $NetBSD: hunt.c,v 1.42 2014/03/29 20:52:13 dholland Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hunt.c,v 1.41 2011/09/01 07:18:50 plunky Exp $"); +__RCSID("$NetBSD: hunt.c,v 1.42 2014/03/29 20:52:13 dholland Exp $"); #endif /* not lint */ #include @@ -55,9 +55,9 @@ __RCSID("$NetBSD: hunt.c,v 1.41 2011/09/01 07:18:50 plunky Exp $"); #define put_ch addch #define put_str addstr -FLAG Last_player = FALSE; +bool Last_player = false; #ifdef MONITOR -FLAG Am_monitor = FALSE; +bool Am_monitor = false; #endif char Buf[BUFSIZ]; @@ -66,9 +66,9 @@ char Buf[BUFSIZ]; #ifdef INTERNET static char *Sock_host; static char *use_port; -static FLAG Query_driver = FALSE; +static bool Query_driver = false; char *Send_message = NULL; -static FLAG Show_scores = FALSE; +static bool Show_scores = false; #endif static SOCKET Daemon; @@ -79,7 +79,7 @@ static SOCKET Daemon; #endif char map_key[256]; /* what to map keys to */ -FLAG no_beep; +bool no_beep; static char name[NAMELEN]; static char team = ' '; @@ -97,7 +97,7 @@ static void fincurs(void); static void rmnl(char *); static void sigterm(int) __dead; static void sigusr1(int) __dead; -static void find_driver(FLAG); +static void find_driver(bool); static void start_driver(void); static int broadcast_vec(int, struct sockaddr **); #ifdef INTERNET @@ -135,22 +135,22 @@ main(int ac, char **av) warnx("The -o flag is reserved for future use."); goto usage; #else - Otto_mode = TRUE; + Otto_mode = true; break; #endif case 'm': #ifdef MONITOR - Am_monitor = TRUE; + Am_monitor = true; #else warnx("The monitor was not compiled in."); #endif break; #ifdef INTERNET case 'S': - Show_scores = TRUE; + Show_scores = true; break; case 'q': /* query whether hunt is running */ - Query_driver = TRUE; + Query_driver = true; break; case 'w': Send_message = optarg; @@ -245,7 +245,7 @@ main(int ac, char **av) errx(0, "couldn't initialize screen"); (void) noecho(); (void) cbreak(); - in_visual = TRUE; + in_visual = true; if (LINES < SCREEN_HEIGHT || COLS < SCREEN_WIDTH) leavex(1, "Need a larger window"); clear_the_screen(); @@ -256,7 +256,7 @@ main(int ac, char **av) for (;;) { #ifdef INTERNET - find_driver(TRUE); + find_driver(true); if (Daemon.sin_port == 0) leavex(1, "Game not found, try again"); @@ -376,7 +376,7 @@ list_drivers(void) int test_socket; socklen_t namelen; char local_name[MAXHOSTNAMELEN + 1]; - static int initial = TRUE; + static bool initial = true; static struct in_addr local_address; struct hostent *hp; static int brdc; @@ -505,7 +505,7 @@ get_response: listv[listc].sin_port = htons(0); (void) close(test_socket); - initial = FALSE; + initial = false; return listv; } @@ -517,7 +517,7 @@ test_one_host: } static void -find_driver(FLAG do_startup) +find_driver(bool do_startup) { SOCKET *hosts; @@ -563,7 +563,7 @@ find_driver(FLAG do_startup) start_driver(); sleep(2); - find_driver(FALSE); + find_driver(false); } static void @@ -706,7 +706,7 @@ void intr(int dummy __unused) { int ch; - int explained; + bool explained; int y, x; (void) signal(SIGINT, SIG_IGN); @@ -715,7 +715,7 @@ intr(int dummy __unused) put_str("Really quit? "); clear_eol(); refresh(); - explained = FALSE; + explained = false; for (;;) { ch = getchar(); if (isupper(ch)) @@ -736,7 +736,7 @@ intr(int dummy __unused) if (!explained) { put_str("(Yes or No) "); refresh(); - explained = TRUE; + explained = true; } beep(); refresh(); @@ -804,7 +804,7 @@ env_init(long enter_status) envp = s + 1; } else if (strncmp(envp, "nobeep,", s - envp + 1) == 0) { - no_beep = TRUE; + no_beep = true; envp = s + 1; } else if (strncmp(envp, "name=", s - envp + 1) == 0) { diff --git a/games/hunt/hunt/otto.c b/games/hunt/hunt/otto.c index 8c163b47800c..09032346bdd9 100644 --- a/games/hunt/hunt/otto.c +++ b/games/hunt/hunt/otto.c @@ -1,4 +1,4 @@ -/* $NetBSD: otto.c,v 1.15 2009/07/04 07:10:23 dholland Exp $ */ +/* $NetBSD: otto.c,v 1.16 2014/03/29 20:52:13 dholland Exp $ */ #ifdef OTTO /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -45,7 +45,7 @@ #include #ifndef lint -__RCSID("$NetBSD: otto.c,v 1.15 2009/07/04 07:10:23 dholland Exp $"); +__RCSID("$NetBSD: otto.c,v 1.16 2014/03/29 20:52:13 dholland Exp $"); #endif /* not lint */ #include @@ -140,7 +140,7 @@ STATIC struct itimerval pause_time = { { 0, 0 }, { 0, 55000 }}; STATIC void attack(int, struct item *); STATIC void duck(int); STATIC void face_and_move_direction(int, int); -STATIC int go_for_ammo(char); +STATIC bool go_for_ammo(char); STATIC void ottolook(int, struct item *); STATIC void look_around(void); STATIC void nothing(int); @@ -523,7 +523,7 @@ duck(int rel_dir) * go for the closest mine if possible */ -STATIC int +STATIC bool go_for_ammo(char mine) { int i, rel_dir, dist; @@ -537,7 +537,7 @@ go_for_ammo(char mine) } } if (rel_dir == -1) - return FALSE; + return false; if (!(flbr[rel_dir].flags & ON_SIDE) || flbr[rel_dir].distance > 1) { @@ -545,8 +545,8 @@ go_for_ammo(char mine) dist = 4; face_and_move_direction(rel_dir, dist); } else - return FALSE; /* until it's done right */ - return TRUE; + return false; /* until it's done right */ + return true; } STATIC void diff --git a/games/hunt/hunt/playit.c b/games/hunt/hunt/playit.c index bdf899944893..80c4632463c5 100644 --- a/games/hunt/hunt/playit.c +++ b/games/hunt/hunt/playit.c @@ -1,4 +1,4 @@ -/* $NetBSD: playit.c,v 1.16 2009/08/27 00:36:32 dholland Exp $ */ +/* $NetBSD: playit.c,v 1.17 2014/03/29 20:52:13 dholland Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: playit.c,v 1.16 2009/08/27 00:36:32 dholland Exp $"); +__RCSID("$NetBSD: playit.c,v 1.17 2014/03/29 20:52:13 dholland Exp $"); #endif /* not lint */ #include @@ -146,7 +146,7 @@ playit(void) case ENDWIN: refresh(); if ((ch = GETCHR()) == LAST_PLAYER) - Last_player = TRUE; + Last_player = true; ch = EOF; goto out; case BELL: @@ -281,7 +281,8 @@ send_stuff(void) int quit(int old_status) { - int explain, ch; + bool explain; + int ch; if (Last_player) return Q_QUIT; @@ -292,7 +293,7 @@ quit(int old_status) move(HEIGHT, 0); put_str("Re-enter game [ynwo]? "); clear_eol(); - explain = FALSE; + explain = false; for (;;) { refresh(); if (isupper(ch = getchar())) @@ -369,7 +370,7 @@ get_message: beep(); if (!explain) { put_str("(Yes, No, Write message, or Options) "); - explain = TRUE; + explain = true; } } @@ -381,7 +382,7 @@ get_message: #endif clear_eol(); refresh(); - explain = FALSE; + explain = false; for (;;) { if (isupper(ch = getchar())) ch = tolower(ch); @@ -402,7 +403,7 @@ get_message: #else put_str("[SCQ] "); #endif - explain = TRUE; + explain = true; } refresh(); }