Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/hunt/huntd don't declare own boolean type



details:   https://anonhg.NetBSD.org/src/rev/752c78bbd13d
branches:  trunk
changeset: 328231:752c78bbd13d
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat Mar 29 19:41:10 2014 +0000

description:
don't declare own boolean type

diffstat:

 games/hunt/huntd/answer.c   |  18 +++++-----
 games/hunt/huntd/draw.c     |   6 +-
 games/hunt/huntd/driver.c   |  72 ++++++++++++++++++++++----------------------
 games/hunt/huntd/execute.c  |  36 +++++++++++-----------
 games/hunt/huntd/extern.c   |   6 +-
 games/hunt/huntd/faketalk.c |   7 +---
 games/hunt/huntd/hunt.h     |  21 +++++--------
 games/hunt/huntd/makemaze.c |  24 +++++++-------
 games/hunt/huntd/shots.c    |  58 ++++++++++++++++++------------------
 9 files changed, 120 insertions(+), 128 deletions(-)

diffs (truncated from 907 to 300 lines):

diff -r db641f69ee08 -r 752c78bbd13d games/hunt/huntd/answer.c
--- a/games/hunt/huntd/answer.c Sat Mar 29 19:34:23 2014 +0000
+++ b/games/hunt/huntd/answer.c Sat Mar 29 19:41:10 2014 +0000
@@ -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 @@
        if (newsock < 0)
        {
                if (errno == EINTR)
-                       return FALSE;
+                       return false;
 #ifdef LOG
                syslog(LOG_ERR, "accept: %m");
 #else
@@ -154,7 +154,7 @@
                        (void) fflush(pp->p_output);
                }
                (void) close(newsock);
-               return FALSE;
+               return false;
        }
        else
 #endif
@@ -168,7 +168,7 @@
                        (void) write(newsock, &socklen,
                                sizeof socklen);
                        (void) close(newsock);
-                       return FALSE;
+                       return false;
                }
        else
 #endif
@@ -180,7 +180,7 @@
                        (void) write(newsock, &socklen,
                                sizeof socklen);
                        (void) close(newsock);
-                       return FALSE;
+                       return false;
                }
 
 #ifdef MONITOR
@@ -203,7 +203,7 @@
        else
 #endif
                stplayer(pp, enter_status);
-       return TRUE;
+       return true;
 }
 
 #ifdef MONITOR
@@ -266,7 +266,7 @@
        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 @@
 #endif
 
        drawmaze(newpp);
-       drawplayer(newpp, TRUE);
+       drawplayer(newpp, true);
        look(newpp);
 #ifdef FLY
        if (enter_status == Q_FLY)
diff -r db641f69ee08 -r 752c78bbd13d games/hunt/huntd/draw.c
--- a/games/hunt/huntd/draw.c   Sat Mar 29 19:34:23 2014 +0000
+++ b/games/hunt/huntd/draw.c   Sat Mar 29 19:41:10 2014 +0000
@@ -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 @@
  *     unless he is cloaked.
  */
 void
-drawplayer(PLAYER *pp, FLAG draw)
+drawplayer(PLAYER *pp, bool draw)
 {
        PLAYER *newp;
        int x, y;
diff -r db641f69ee08 -r 752c78bbd13d games/hunt/huntd/driver.c
--- a/games/hunt/huntd/driver.c Sat Mar 29 19:34:23 2014 +0000
+++ b/games/hunt/huntd/driver.c Sat Mar 29 19:41:10 2014 +0000
@@ -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 @@
 
 #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 @@
 #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 @@
        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 @@
        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 @@
                        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 @@
                                if (first && standard_port)
                                        faketalk();
 #endif
-                               first = FALSE;
+                               first = false;
                        }
                if (fdset[1].revents & POLLIN)
                        send_stats();
@@ -227,13 +227,13 @@
 #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 @@
        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 @@
 #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 @@
  *     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 @@
        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 @@
                }
                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 @@
                                                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 @@
                                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 @@
                        add_shot(DSHOT, y, x, rand_dir(),



Home | Main Index | Thread Index | Old Index