]> thyrsus.com Git - vms-empire.git/commitdiff
Fix some remnant pseudo-booleans.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 23 Aug 2013 20:51:58 +0000 (16:51 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 23 Aug 2013 20:51:58 +0000 (16:51 -0400)
display.c
extern.h
game.c
term.c
usermove.c
util.c

index 5ae63bc075e0d0813f6ca4c7c2e4f5d7815fee01..f28fa5c49521d3d0dd11972faa78d70ee1bdae69 100644 (file)
--- a/display.c
+++ b/display.c
@@ -26,11 +26,11 @@ static int ref_row; /* map loc displayed in upper-left corner */
 static int ref_col;
 static int save_sector; /* the currently displayed sector */
 static int save_cursor; /* currently displayed cursor position */
-static int change_ok = TRUE; /* true if new sector may be displayed */
+static bool change_ok = true; /* true if new sector may be displayed */
 
 static void show_loc(view_map_t vmap[],loc_t loc);
 static void disp_square(view_map_t *vp);
-int on_screen(loc_t loc);
+static bool on_screen(loc_t loc);
 
 #ifdef A_COLOR
 void init_colors(void)
@@ -130,7 +130,7 @@ screen even if the location to be displayed is already on the screen.
 */
 
 void sector_change (void) {
-       change_ok = TRUE;
+       change_ok = true;
 }
 
 /*
@@ -231,7 +231,7 @@ print_sector(int whose, view_map_t vmap[], int sector)
        int r, c;
 
        save_sector = sector; /* remember last sector displayed */
-       change_ok = FALSE; /* we are displaying a new sector */
+       change_ok = false; /* we are displaying a new sector */
 
        display_rows = lines - NUMTOPS - 1; /* num lines to display */
        display_cols = cols - NUMSIDES;
@@ -361,12 +361,12 @@ void display_screen(view_map_t vmap[])
 }
 
 /*
-Move the cursor in a specified direction.  We return TRUE if the
-cursor remains in the currently displayed screen, otherwise FALSE.
+Move the cursor in a specified direction.  We return true if the
+cursor remains in the currently displayed screen, otherwise false.
 We display the cursor on the screen, if possible.
 */
 
-int
+bool
 move_cursor(loc_t *cursor, int offset)
 /* cursor is current cursor position, offset is offset to add to cursor */
 {
@@ -374,8 +374,8 @@ move_cursor(loc_t *cursor, int offset)
        int r, c;
  
        t = *cursor + offset; /* proposed location */
-       if (!map[t].on_board) return (FALSE); /* trying to move off map */
-       if (!on_screen (t)) return (FALSE); /* loc is off screen */
+       if (!map[t].on_board) return (false); /* trying to move off map */
+       if (!on_screen (t)) return (false); /* loc is off screen */
        
        *cursor = t; /* update cursor position */
        save_cursor = *cursor;
@@ -384,14 +384,14 @@ move_cursor(loc_t *cursor, int offset)
        c = loc_col (save_cursor);
        (void) move (r-ref_row+NUMTOPS, c-ref_col);
        
-       return (TRUE);
+       return (true);
 }
 
 /*
 See if a location is displayed on the screen.
 */
 
-int on_screen (loc_t loc)
+bool on_screen (loc_t loc)
 {
        int new_r, new_c;
        
@@ -402,9 +402,9 @@ int on_screen (loc_t loc)
         || new_r - ref_row > lines - NUMTOPS - 1 /* past bot of screen? */
         || new_c < ref_col /* past left edge of screen? */
         || new_c - ref_col > cols - NUMSIDES) /* past right edge of screen? */
-       return (FALSE);
+       return (false);
 
-       return (TRUE);
+       return (true);
 }
 
 /* Print a view map for debugging. */
index 6385b71f745c8764903554f08624027d0eca7374..3a704f61ec42fd69bef5b2494d3a016490984f97 100644 (file)
--- a/extern.h
+++ b/extern.h
@@ -147,7 +147,7 @@ long cur_cursor (void);
 void display_loc (int whose, view_map_t vmap[], long loc);
 void display_locx (int whose, view_map_t vmap[], long loc);
 void print_sector (int whose, view_map_t vmap[], int sector);
-int move_cursor (long *cursor, int offset);
+bool move_cursor (long *cursor, int offset);
 void print_zoom (view_map_t *vmap);
 void print_pzoom (char *s, path_map_t *pmap, view_map_t *vmap);
 void print_xzoom (view_map_t *vmap);
@@ -179,7 +179,7 @@ char get_chx (void);
 int getint (char *message);
 char get_c (void);
 char get_cq (void);
-int getyn (char *message);
+bool getyn (char *message);
 int get_range (char *message, int low, int high);
 
 void rndini (void); /* math routines */
diff --git a/game.c b/game.c
index 58c4a4b4f3fb7c535489a835ee8ae9077fff9408..66e2e1c601b6efe7429d79ab494856676d142eda 100644 (file)
--- a/game.c
+++ b/game.c
@@ -527,7 +527,7 @@ void save_game(void) {
 
 /*
 Recover a saved game from emp_save.dat.
-We return TRUE if we succeed, otherwise false.
+We return true if we succeed, otherwise false.
 */
 
 #define rbuf(buf) if (!xread (f, (char *)buf, sizeof(buf))) return (false);
@@ -649,7 +649,7 @@ void inconsistent(void) {
 }
 
 /*
-Write a buffer to a file.  If we cannot write everything, return FALSE.
+Write a buffer to a file.  If we cannot write everything, return false.
 Also, tell the user why the write did not work if it didn't.
 */
 
diff --git a/term.c b/term.c
index bdf314233b8070862d1af3c60754302fd316eb83..0e95db9c28a60e2317b6261d1971bc22adcf66f3 100644 (file)
--- a/term.c
+++ b/term.c
@@ -36,7 +36,7 @@ to read the lines.  The new information is then displayed, and the
 #include "empire.h"
 #include "extern.h"
 
-static int need_delay;
+static bool need_delay;
 static FILE *my_stream;
 
 void
@@ -261,7 +261,7 @@ get_strq(char *buf, int sizep)
        (void) nocrmode ();
        (void) refresh ();
        (void) getstr (buf);
-       need_delay = FALSE;
+       need_delay = false;
        info (0, 0, 0);
        (void) crmode ();
 }
@@ -345,10 +345,10 @@ get_cq(void)
 
 /*
 Input a yes or no response from the user.  We loop until we get
-a valid response.  We return TRUE iff the user replies 'y'.
+a valid response.  We return true iff the user replies 'y'.
 */
 
-int
+bool
 getyn(char *message)
 {
        char c;
@@ -357,8 +357,8 @@ getyn(char *message)
                prompt (message,0,0,0,0,0,0,0,0);
                c = get_chx ();
 
-               if (c == 'Y') return (TRUE);
-               if (c == 'N') return (FALSE);
+               if (c == 'Y') return (true);
+               if (c == 'N') return (false);
 
                error ("Please answer Y or N.",0,0,0,0,0,0,0,0);
        }
index f0067c35b98c389933304fba26225b456b513b32..0ca86f2e6c7d1c8661ce4b6033a9046bb33ee525 100644 (file)
@@ -1026,7 +1026,7 @@ when they are next to an enemy object or an unowned city.  Armies
 on troop transports are not awakened if they are surrounded by sea.
 We return true if the object is now awake.  Objects are never
 completely awoken here if their function is a destination.  But we
-will return TRUE if we want the user to have control.
+will return true if we want the user to have control.
 */
 
 bool
diff --git a/util.c b/util.c
index f4877905b40d0ecd8e19d54a0602fb1c76536468..255e8e599597fb169ea95f785f02a3e7707b3ed0 100644 (file)
--- a/util.c
+++ b/util.c
@@ -72,10 +72,10 @@ objects on the map have non-zero hits.
 cargo list.
 */
 
-static int in_free[LIST_SIZE]; /* TRUE if object in free list */
-static int in_obj[LIST_SIZE]; /* TRUE if object in obj list */
-static int in_loc[LIST_SIZE]; /* TRUE if object in a loc list */
-static int in_cargo[LIST_SIZE]; /* TRUE if object in a cargo list */
+static bool in_free[LIST_SIZE]; /* true if object in free list */
+static bool in_obj[LIST_SIZE]; /* true if object in obj list */
+static bool in_loc[LIST_SIZE]; /* true if object in a loc list */
+static bool in_cargo[LIST_SIZE]; /* true if object in a cargo list */
 
 void
 check(void) {