1
0
mirror of https://git.zap.org.au/git/trader.git synced 2024-07-07 15:54:14 -04:00

Use the C99 <stdbool.h> header file

This commit is contained in:
John Zaitseff 2011-06-30 21:11:36 +10:00
parent 3a4c95f927
commit 9453cfc402
4 changed files with 13 additions and 18 deletions

View File

@ -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

View File

@ -32,6 +32,9 @@
#define included_GLOBALS_H 1
#include <stdbool.h>
/************************************************************************
* 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 */

View File

@ -49,6 +49,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <locale.h>
@ -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)

View File

@ -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;