From 9453cfc40282927c83c654f296f4e5ba187bc0f8 Mon Sep 17 00:00:00 2001 From: John Zaitseff Date: Thu, 30 Jun 2011 21:11:36 +1000 Subject: [PATCH] Use the C99 header file --- src/globals.c | 4 ++-- src/globals.h | 11 +++++++---- src/system.h | 10 +--------- src/trader.c | 6 +++--- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/globals.c b/src/globals.c index 7e06b87..9a51335 100644 --- a/src/globals.c +++ b/src/globals.c @@ -59,7 +59,7 @@ move_rec_t game_move[NUMBER_MOVES]; // Current moves double interest_rate; // Current interest rate double credit_limit; // Credit limit of current player -int bid_used; // True if bid used for player +bool bid_used; // True if bid used for player int max_turn; // Max. number of turns in game int turn_number; @@ -67,5 +67,5 @@ int current_player; int number_players; int first_player; // Who WAS the first player to go? -int game_loaded; // True if game was loaded from disk +bool game_loaded; // True if game was loaded from disk char *game_filename; // Game file filename diff --git a/src/globals.h b/src/globals.h index 5877d7b..a887a96 100644 --- a/src/globals.h +++ b/src/globals.h @@ -32,6 +32,9 @@ #define included_GLOBALS_H 1 +#include + + /************************************************************************ * Constants and type declarations * ************************************************************************/ @@ -78,7 +81,7 @@ typedef struct company_info { double share_return; // Return per share long stock_issued; // Total stock sold to players long max_stock; // Max. stock that company has - int on_map; // True if company on map + bool on_map; // True if company on map } company_info_t; @@ -88,7 +91,7 @@ typedef struct player_info { double cash; // Cash available double debt; // Amount of debt long stock_owned[MAX_COMPANIES]; // How much stock is owned - int in_game; // True if still in the game + bool in_game; // True if still in the game } player_info_t; @@ -124,7 +127,7 @@ extern move_rec_t game_move[NUMBER_MOVES]; // Current moves extern double interest_rate; // Current interest rate extern double credit_limit; // Credit limit of current player -extern int bid_used; // True if bid used for player +extern bool bid_used; // True if bid used for player extern int max_turn; // Max. number of turns in game extern int turn_number; @@ -132,7 +135,7 @@ extern int current_player; extern int number_players; extern int first_player; // Who WAS the first player to go? -extern int game_loaded; // True if game was loaded from disk +extern bool game_loaded; // True if game was loaded from disk extern char *game_filename; // Game file filename #endif /* included_GLOBALS_H */ diff --git a/src/system.h b/src/system.h index f640405..db7a87c 100644 --- a/src/system.h +++ b/src/system.h @@ -49,6 +49,7 @@ #include #include +#include #include #include @@ -78,15 +79,6 @@ #endif -// Boolean values -#ifndef FALSE -# define FALSE (0) -#endif -#ifndef TRUE -# define TRUE (1) -#endif - - // Compiler __attributes__ for less-capable compilers #ifndef HAVE___ATTRIBUTE__ # define __attribute__(x) diff --git a/src/trader.c b/src/trader.c index 1bd5466..adfb58c 100644 --- a/src/trader.c +++ b/src/trader.c @@ -63,7 +63,7 @@ int main (int argc, char *argv[]) initscr(); noecho(); timeout(-1); - keypad(stdscr, TRUE); + keypad(stdscr, true); raw(); printw(_("Program name: %s\n"), program_name()); @@ -127,8 +127,8 @@ static void process_cmdline (int argc, char *argv[]) int c; // Process arguments starting with "-" or "--" - opterr = TRUE; - while (TRUE) { + opterr = true; + while (true) { c = getopt_long(argc, argv, options_short, options_long, NULL); if (c == EOF) break;