mirror of
https://git.zap.org.au/git/trader.git
synced 2025-01-03 14:57:41 -05: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
|
||||
translations of the English names. In fact, if possible, the
|
||||
names should start with successive letters of your alphabet (in
|
||||
English, "A" to "H"). No company name should be more than 24
|
||||
characters (column positions, to be precise) long. */
|
||||
English, for example, "A" to "H"). No company name should be more
|
||||
than 24 characters (column positions, to be precise) long. */
|
||||
N_("Altair Starways"),
|
||||
N_("Betelgeuse, Ltd"),
|
||||
N_("Capella Freight Co"),
|
||||
@ -93,10 +93,10 @@ const char *default_printable_map_val =
|
||||
// Default printable output representations for each move
|
||||
const char *default_printable_game_move =
|
||||
/* TRANSLATORS: This string is used to display the game moves
|
||||
(choices). There must be exactly 20 characters before the ASCII
|
||||
vertical line. The first character corresponds to the first
|
||||
character in the "input|GameMoves" string, and so on. Do not
|
||||
change or translate anything after the vertical line. */
|
||||
(choices). There must be exactly 20 characters (NUMBER_MOVES)
|
||||
before the ASCII vertical line. The first character corresponds
|
||||
to the first character in the "input|GameMoves" string, and so on.
|
||||
Do not change or translate anything after the vertical line. */
|
||||
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
|
||||
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 turn_number; // Current turn (1 to max_turn)
|
||||
int number_players; // Number of players
|
||||
|
@ -128,15 +128,6 @@ typedef enum map_val {
|
||||
#define MAP_TO_COMPANY(m) ((m) - MAP_A)
|
||||
#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
|
||||
typedef struct move_rec {
|
||||
@ -144,9 +135,6 @@ typedef struct move_rec {
|
||||
int y;
|
||||
} 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
|
||||
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 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 turn_number; // Current turn (1 to max_turn)
|
||||
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
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* 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 *
|
||||
************************************************************************/
|
||||
|
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
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* 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 *
|
||||
************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user