mirror of
https://git.zap.org.au/git/trader.git
synced 2024-10-13 18:03:39 -04:00
Move some global variables to intf.c and intf.h
Move the keycode_company, printable_map_val, chtype_map_val, keycode_game_move, printable_game_move and chtype_game_move global variables to intf.c and intf.h.
This commit is contained in:
parent
4733e98e7f
commit
10815a2803
@ -41,8 +41,8 @@ const char *company_name[MAX_COMPANIES] = {
|
|||||||
/* TRANSLATORS: The eight company names do NOT have to be literal
|
/* TRANSLATORS: The eight company names do NOT have to be literal
|
||||||
translations of the English names. In fact, if possible, the
|
translations of the English names. In fact, if possible, the
|
||||||
names should start with successive letters of your alphabet (in
|
names should start with successive letters of your alphabet (in
|
||||||
English, "A" to "H"). No company name should be more than 24
|
English, for example, "A" to "H"). No company name should be more
|
||||||
characters (column positions, to be precise) long. */
|
than 24 characters (column positions, to be precise) long. */
|
||||||
N_("Altair Starways"),
|
N_("Altair Starways"),
|
||||||
N_("Betelgeuse, Ltd"),
|
N_("Betelgeuse, Ltd"),
|
||||||
N_("Capella Freight Co"),
|
N_("Capella Freight Co"),
|
||||||
@ -93,10 +93,10 @@ const char *default_printable_map_val =
|
|||||||
// Default printable output representations for each move
|
// Default printable output representations for each move
|
||||||
const char *default_printable_game_move =
|
const char *default_printable_game_move =
|
||||||
/* TRANSLATORS: This string is used to display the game moves
|
/* TRANSLATORS: This string is used to display the game moves
|
||||||
(choices). There must be exactly 20 characters before the ASCII
|
(choices). There must be exactly 20 characters (NUMBER_MOVES)
|
||||||
vertical line. The first character corresponds to the first
|
before the ASCII vertical line. The first character corresponds
|
||||||
character in the "input|GameMoves" string, and so on. Do not
|
to the first character in the "input|GameMoves" string, and so on.
|
||||||
change or translate anything after the vertical line. */
|
Do not change or translate anything after the vertical line. */
|
||||||
N_("abcdefghijklmnopqrst|output|GameMoves");
|
N_("abcdefghijklmnopqrst|output|GameMoves");
|
||||||
|
|
||||||
|
|
||||||
@ -128,13 +128,6 @@ player_info_t player[MAX_PLAYERS]; // Array of players
|
|||||||
map_val_t galaxy_map[MAX_X][MAX_Y]; // Map of the galaxy
|
map_val_t galaxy_map[MAX_X][MAX_Y]; // Map of the galaxy
|
||||||
move_rec_t game_move[NUMBER_MOVES]; // Current moves
|
move_rec_t game_move[NUMBER_MOVES]; // Current moves
|
||||||
|
|
||||||
wchar_t *keycode_company; // Keycodes for each company
|
|
||||||
wchar_t *keycode_game_move; // Keycodes for each game move
|
|
||||||
wchar_t *printable_map_val; // Printable output for each map value
|
|
||||||
wchar_t *printable_game_move; // Printable output for each game move
|
|
||||||
chtype *chtype_map_val[MAX_COMPANIES + 3]; // as chtype strings
|
|
||||||
chtype *chtype_game_move[NUMBER_MOVES]; // as chtype strings
|
|
||||||
|
|
||||||
int max_turn; // Max. number of turns in game
|
int max_turn; // Max. number of turns in game
|
||||||
int turn_number; // Current turn (1 to max_turn)
|
int turn_number; // Current turn (1 to max_turn)
|
||||||
int number_players; // Number of players
|
int number_players; // Number of players
|
||||||
|
@ -128,15 +128,6 @@ typedef enum map_val {
|
|||||||
#define MAP_TO_COMPANY(m) ((m) - MAP_A)
|
#define MAP_TO_COMPANY(m) ((m) - MAP_A)
|
||||||
#define IS_MAP_COMPANY(m) ((m) >= MAP_A && (m) <= MAP_LAST)
|
#define IS_MAP_COMPANY(m) ((m) >= MAP_A && (m) <= MAP_LAST)
|
||||||
|
|
||||||
#define MAP_TO_INDEX(m) \
|
|
||||||
(((m) == MAP_EMPTY) ? 0 : \
|
|
||||||
(((m) == MAP_OUTPOST) ? 1 : \
|
|
||||||
(((m) == MAP_STAR) ? 2 : \
|
|
||||||
((m) - MAP_A + 3))))
|
|
||||||
|
|
||||||
#define PRINTABLE_MAP_VAL(m) printable_map_val[MAP_TO_INDEX(m)]
|
|
||||||
#define CHTYPE_MAP_VAL(m) chtype_map_val[MAP_TO_INDEX(m)]
|
|
||||||
|
|
||||||
|
|
||||||
// Information about a move
|
// Information about a move
|
||||||
typedef struct move_rec {
|
typedef struct move_rec {
|
||||||
@ -144,9 +135,6 @@ typedef struct move_rec {
|
|||||||
int y;
|
int y;
|
||||||
} move_rec_t;
|
} move_rec_t;
|
||||||
|
|
||||||
#define PRINTABLE_GAME_MOVE(m) (printable_game_move[m])
|
|
||||||
#define CHTYPE_GAME_MOVE(m) (chtype_game_move[m])
|
|
||||||
|
|
||||||
|
|
||||||
// Player moves / selection values
|
// Player moves / selection values
|
||||||
typedef enum selection {
|
typedef enum selection {
|
||||||
@ -195,13 +183,6 @@ extern player_info_t player[MAX_PLAYERS]; // Array of players
|
|||||||
extern map_val_t galaxy_map[MAX_X][MAX_Y]; // Map of the galaxy
|
extern map_val_t galaxy_map[MAX_X][MAX_Y]; // Map of the galaxy
|
||||||
extern move_rec_t game_move[NUMBER_MOVES]; // Current moves
|
extern move_rec_t game_move[NUMBER_MOVES]; // Current moves
|
||||||
|
|
||||||
extern wchar_t *keycode_company; // Keycodes for each company
|
|
||||||
extern wchar_t *keycode_game_move; // Keycodes for each game move
|
|
||||||
extern wchar_t *printable_map_val; // Printable output for each map value
|
|
||||||
extern wchar_t *printable_game_move; // Printable output for each game move
|
|
||||||
extern chtype *chtype_map_val[MAX_COMPANIES + 3]; // as chtype strings
|
|
||||||
extern chtype *chtype_game_move[NUMBER_MOVES]; // as chtype strings
|
|
||||||
|
|
||||||
extern int max_turn; // Max. number of turns in game
|
extern int max_turn; // Max. number of turns in game
|
||||||
extern int turn_number; // Current turn (1 to max_turn)
|
extern int turn_number; // Current turn (1 to max_turn)
|
||||||
extern int number_players; // Number of players
|
extern int number_players; // Number of players
|
||||||
|
13
src/intf.c
13
src/intf.c
@ -179,6 +179,19 @@ chtype attr_error_highlight; // Error window highlighted string
|
|||||||
chtype attr_error_waitforkey; // "Press any key", error window
|
chtype attr_error_waitforkey; // "Press any key", error window
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Game printing global variable definitions *
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
wchar_t *keycode_company; // Keycodes for each company
|
||||||
|
wchar_t *printable_map_val; // Printable output for each map value
|
||||||
|
chtype *chtype_map_val[MAX_COMPANIES + 3]; // as chtype strings
|
||||||
|
|
||||||
|
wchar_t *keycode_game_move; // Keycodes for each game move
|
||||||
|
wchar_t *printable_game_move; // Printable output for each game move
|
||||||
|
chtype *chtype_game_move[NUMBER_MOVES]; // as chtype strings
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Module-specific variables *
|
* Module-specific variables *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
30
src/intf.h
30
src/intf.h
@ -169,6 +169,36 @@ extern chtype attr_error_highlight; // Error window highlighted string
|
|||||||
extern chtype attr_error_waitforkey; // "Press any key", error window
|
extern chtype attr_error_waitforkey; // "Press any key", error window
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Game printing macros and global variable declarations *
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
// Macros and variables for printing the galaxy map
|
||||||
|
|
||||||
|
#define MAP_TO_INDEX(m) \
|
||||||
|
(((m) == MAP_EMPTY) ? 0 : \
|
||||||
|
(((m) == MAP_OUTPOST) ? 1 : \
|
||||||
|
(((m) == MAP_STAR) ? 2 : \
|
||||||
|
((m) - MAP_A + 3))))
|
||||||
|
|
||||||
|
#define PRINTABLE_MAP_VAL(m) printable_map_val[MAP_TO_INDEX(m)]
|
||||||
|
#define CHTYPE_MAP_VAL(m) chtype_map_val[MAP_TO_INDEX(m)]
|
||||||
|
|
||||||
|
extern wchar_t *keycode_company; // Keycodes for each company
|
||||||
|
extern wchar_t *printable_map_val; // Printable output for each map value
|
||||||
|
extern chtype *chtype_map_val[MAX_COMPANIES + 3]; // as chtype strings
|
||||||
|
|
||||||
|
|
||||||
|
// Macros and variables for printing the current game moves
|
||||||
|
|
||||||
|
#define PRINTABLE_GAME_MOVE(m) (printable_game_move[m])
|
||||||
|
#define CHTYPE_GAME_MOVE(m) (chtype_game_move[m])
|
||||||
|
|
||||||
|
extern wchar_t *keycode_game_move; // Keycodes for each game move
|
||||||
|
extern wchar_t *printable_game_move; // Printable output for each game move
|
||||||
|
extern chtype *chtype_game_move[NUMBER_MOVES]; // as chtype strings
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Basic text input/output function prototypes *
|
* Basic text input/output function prototypes *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user