mirror of
https://git.zap.org.au/git/trader.git
synced 2024-11-03 17:27:29 -05:00
Add the --no-encrypt command-line option
This commit is contained in:
parent
cdb98dbedb
commit
ee37b4d210
@ -329,7 +329,8 @@ bool save_game (int num)
|
|||||||
err_exit_nomem();
|
err_exit_nomem();
|
||||||
}
|
}
|
||||||
|
|
||||||
crypt_key = game_file_crypt_key[randi(GAME_FILE_CRYPT_KEY_SIZE)];
|
crypt_key = option_no_encrypt ? 0 :
|
||||||
|
game_file_crypt_key[randi(GAME_FILE_CRYPT_KEY_SIZE)];
|
||||||
|
|
||||||
// Create the data directory, if needed
|
// Create the data directory, if needed
|
||||||
data_dir = data_directory();
|
data_dir = data_directory();
|
||||||
|
@ -86,6 +86,7 @@ bool quit_selected = false; // Is a player trying to quit the game?
|
|||||||
bool abort_game = false; // Abort game without declaring winner?
|
bool abort_game = false; // Abort game without declaring winner?
|
||||||
|
|
||||||
bool option_no_color = false; // True if --no-color was specified
|
bool option_no_color = false; // True if --no-color was specified
|
||||||
|
bool option_no_encrypt = false; // True if --no-encrypt was specified
|
||||||
int option_max_turn = 0; // Max. turns if --max-turn was specified
|
int option_max_turn = 0; // Max. turns if --max-turn was specified
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,6 +198,7 @@ extern bool quit_selected; // Is a player trying to quit the game?
|
|||||||
extern bool abort_game; // Abort game without declaring winner?
|
extern bool abort_game; // Abort game without declaring winner?
|
||||||
|
|
||||||
extern bool option_no_color; // True if --no-color was specified
|
extern bool option_no_color; // True if --no-color was specified
|
||||||
|
extern bool option_no_encrypt; // True if --no-encrypt was specified
|
||||||
extern int option_max_turn; // Max. turns if --max-turn was specified
|
extern int option_max_turn; // Max. turns if --max-turn was specified
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
enum options_char {
|
enum options_char {
|
||||||
OPTION_NO_COLOR = 1,
|
OPTION_NO_COLOR = 1,
|
||||||
|
OPTION_NO_ENCRYPT,
|
||||||
OPTION_MAX_TURN
|
OPTION_MAX_TURN
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -55,6 +56,7 @@ static struct option const options_long[] = {
|
|||||||
{ "version", no_argument, NULL, 'V' },
|
{ "version", no_argument, NULL, 'V' },
|
||||||
{ "no-color", no_argument, NULL, OPTION_NO_COLOR },
|
{ "no-color", no_argument, NULL, OPTION_NO_COLOR },
|
||||||
{ "no-colour", no_argument, NULL, OPTION_NO_COLOR },
|
{ "no-colour", no_argument, NULL, OPTION_NO_COLOR },
|
||||||
|
{ "no-encrypt", no_argument, NULL, OPTION_NO_ENCRYPT },
|
||||||
{ "max-turn", required_argument, NULL, OPTION_MAX_TURN },
|
{ "max-turn", required_argument, NULL, OPTION_MAX_TURN },
|
||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
@ -215,6 +217,11 @@ void process_cmdline (int argc, char *argv[])
|
|||||||
option_no_color = true;
|
option_no_color = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OPTION_NO_ENCRYPT:
|
||||||
|
// --no-encrypt: don't encrypt game files
|
||||||
|
option_no_encrypt = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case OPTION_MAX_TURN:
|
case OPTION_MAX_TURN:
|
||||||
// --max-turn: specify the maximum turn number
|
// --max-turn: specify the maximum turn number
|
||||||
option_max_turn = strtol(optarg, &p, 10);
|
option_max_turn = strtol(optarg, &p, 10);
|
||||||
|
Loading…
Reference in New Issue
Block a user