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)
*/
void sector_change (void) {
- change_ok = TRUE;
+ change_ok = true;
}
/*
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;
}
/*
-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 */
{
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;
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;
|| 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. */
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);
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 */
/*
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);
}
/*
-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.
*/
#include "empire.h"
#include "extern.h"
-static int need_delay;
+static bool need_delay;
static FILE *my_stream;
void
(void) nocrmode ();
(void) refresh ();
(void) getstr (buf);
- need_delay = FALSE;
+ need_delay = false;
info (0, 0, 0);
(void) crmode ();
}
/*
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;
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);
}
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
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) {