mirror of
https://git.zap.org.au/git/trader.git
synced 2024-12-04 14:46:45 -05:00
Use the C99 <stdbool.h> header file
This commit is contained in:
parent
3a4c95f927
commit
9453cfc402
@ -59,7 +59,7 @@ move_rec_t game_move[NUMBER_MOVES]; // Current moves
|
|||||||
|
|
||||||
double interest_rate; // Current interest rate
|
double interest_rate; // Current interest rate
|
||||||
double credit_limit; // Credit limit of current player
|
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 max_turn; // Max. number of turns in game
|
||||||
int turn_number;
|
int turn_number;
|
||||||
@ -67,5 +67,5 @@ int current_player;
|
|||||||
int number_players;
|
int number_players;
|
||||||
int first_player; // Who WAS the first player to go?
|
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
|
char *game_filename; // Game file filename
|
||||||
|
@ -32,6 +32,9 @@
|
|||||||
#define included_GLOBALS_H 1
|
#define included_GLOBALS_H 1
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Constants and type declarations *
|
* Constants and type declarations *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
@ -78,7 +81,7 @@ typedef struct company_info {
|
|||||||
double share_return; // Return per share
|
double share_return; // Return per share
|
||||||
long stock_issued; // Total stock sold to players
|
long stock_issued; // Total stock sold to players
|
||||||
long max_stock; // Max. stock that company has
|
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;
|
} company_info_t;
|
||||||
|
|
||||||
|
|
||||||
@ -88,7 +91,7 @@ typedef struct player_info {
|
|||||||
double cash; // Cash available
|
double cash; // Cash available
|
||||||
double debt; // Amount of debt
|
double debt; // Amount of debt
|
||||||
long stock_owned[MAX_COMPANIES]; // How much stock is owned
|
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;
|
} 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 interest_rate; // Current interest rate
|
||||||
extern double credit_limit; // Credit limit of current player
|
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 max_turn; // Max. number of turns in game
|
||||||
extern int turn_number;
|
extern int turn_number;
|
||||||
@ -132,7 +135,7 @@ extern int current_player;
|
|||||||
extern int number_players;
|
extern int number_players;
|
||||||
extern int first_player; // Who WAS the first player to go?
|
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
|
extern char *game_filename; // Game file filename
|
||||||
|
|
||||||
#endif /* included_GLOBALS_H */
|
#endif /* included_GLOBALS_H */
|
||||||
|
10
src/system.h
10
src/system.h
@ -49,6 +49,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
@ -78,15 +79,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Boolean values
|
|
||||||
#ifndef FALSE
|
|
||||||
# define FALSE (0)
|
|
||||||
#endif
|
|
||||||
#ifndef TRUE
|
|
||||||
# define TRUE (1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Compiler __attributes__ for less-capable compilers
|
// Compiler __attributes__ for less-capable compilers
|
||||||
#ifndef HAVE___ATTRIBUTE__
|
#ifndef HAVE___ATTRIBUTE__
|
||||||
# define __attribute__(x)
|
# define __attribute__(x)
|
||||||
|
@ -63,7 +63,7 @@ int main (int argc, char *argv[])
|
|||||||
initscr();
|
initscr();
|
||||||
noecho();
|
noecho();
|
||||||
timeout(-1);
|
timeout(-1);
|
||||||
keypad(stdscr, TRUE);
|
keypad(stdscr, true);
|
||||||
raw();
|
raw();
|
||||||
|
|
||||||
printw(_("Program name: %s\n"), program_name());
|
printw(_("Program name: %s\n"), program_name());
|
||||||
@ -127,8 +127,8 @@ static void process_cmdline (int argc, char *argv[])
|
|||||||
int c;
|
int c;
|
||||||
|
|
||||||
// Process arguments starting with "-" or "--"
|
// Process arguments starting with "-" or "--"
|
||||||
opterr = TRUE;
|
opterr = true;
|
||||||
while (TRUE) {
|
while (true) {
|
||||||
c = getopt_long(argc, argv, options_short, options_long, NULL);
|
c = getopt_long(argc, argv, options_short, options_long, NULL);
|
||||||
if (c == EOF)
|
if (c == EOF)
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user