diff options
author | Bardur Arantsson <bardur@scientician.net> | 2019-02-15 19:20:25 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2019-02-15 19:20:25 +0100 |
commit | 67f0542f9b0f44872fe847b0a4e621a861cbb519 (patch) | |
tree | 577b9f433896f8da31e8b7c40dbcb0de16f6ebaf | |
parent | bad6bb243d875fd5fa4861a8d57bb7cf0595b175 (diff) |
Remove arg_* globals
-rw-r--r-- | src/dungeon.cc | 16 | ||||
-rw-r--r-- | src/dungeon.hpp | 2 | ||||
-rw-r--r-- | src/loadsave.cc | 18 | ||||
-rw-r--r-- | src/loadsave.hpp | 4 | ||||
-rw-r--r-- | src/main.cc | 11 | ||||
-rw-r--r-- | src/variable.cc | 7 | ||||
-rw-r--r-- | src/variable.hpp | 3 |
7 files changed, 24 insertions, 37 deletions
diff --git a/src/dungeon.cc b/src/dungeon.cc index 7269ff93..35d38a64 100644 --- a/src/dungeon.cc +++ b/src/dungeon.cc @@ -4631,7 +4631,7 @@ static void load_all_pref_files() /* * Actually play a game */ -void play_game() +void play_game(program_args const &args) { auto const &d_info = game->edit_data.d_info; @@ -4673,7 +4673,7 @@ void play_game() no_begin_screen = false; /* Attempt to load */ - if (!load_player()) + if (!load_player(args)) { /* Oops */ quit("broken savefile"); @@ -4741,7 +4741,10 @@ void play_game() calc_powers_silent = TRUE; /* Hack -- Enter wizard mode */ - if (arg_wizard && enter_wizard_mode()) wizard = TRUE; + if (args.wizard && enter_wizard_mode()) + { + wizard = TRUE; + } /* Flavor the objects */ flavor_init(); @@ -4765,8 +4768,11 @@ void play_game() load_all_pref_files(); /* Set or clear "rogue_like_commands" if requested */ - if (arg_force_original) options->rogue_like_commands = false; - if (arg_force_roguelike) options->rogue_like_commands = true; + if (auto it = args.force_key_set) + { + assert((*it == 'r') || (*it == 'o')); + options->rogue_like_commands = (*it == 'r'); + } /* Initialize vault info */ if (init_v_info()) quit("Cannot initialize vaults"); diff --git a/src/dungeon.hpp b/src/dungeon.hpp index c6731e68..263c1f10 100644 --- a/src/dungeon.hpp +++ b/src/dungeon.hpp @@ -2,4 +2,4 @@ #include "program_args.hpp" -void play_game(); +void play_game(program_args const &); diff --git a/src/loadsave.cc b/src/loadsave.cc index bd3870c2..8fd388b7 100644 --- a/src/loadsave.cc +++ b/src/loadsave.cc @@ -8,6 +8,7 @@ #include "ego_item_type.hpp" #include "files.hpp" #include "game.hpp" +#include "hooks.hpp" #include "init1.hpp" #include "init2.hpp" #include "levels.hpp" @@ -25,7 +26,6 @@ #include "player_race.hpp" #include "player_race_mod.hpp" #include "player_type.hpp" -#include "hooks.hpp" #include "skill_type.hpp" #include "store_type.hpp" #include "tables.hpp" @@ -2543,7 +2543,7 @@ static errr rd_savefile() * Note that we always try to load the "current" savefile, even if * there is no such file, so we must check for "empty" savefile names. */ -bool_ load_player() +bool load_player(program_args const &args) { errr err = 0; @@ -2561,7 +2561,7 @@ bool_ load_player() /* Allow empty savefile name */ if (savefile.empty()) { - return (TRUE); + return true; } @@ -2575,7 +2575,7 @@ bool_ load_player() msg_print(NULL); /* Allow this */ - return (TRUE); + return true; } /* Okay */ @@ -2641,20 +2641,20 @@ bool_ load_player() death = FALSE; /* Cheat death (unless the character retired) */ - if (arg_wizard && !total_winner) + if (args.wizard && !total_winner) { /* A character was loaded */ character_loaded = true; /* Done */ - return (TRUE); + return true; } /* Forget turns */ turn = old_turn = 0; /* Done */ - return (TRUE); + return true; } /* A character was loaded */ @@ -2668,7 +2668,7 @@ bool_ load_player() } /* Success */ - return (TRUE); + return true; } @@ -2678,7 +2678,7 @@ bool_ load_player() msg_print(NULL); /* Oops */ - return (FALSE); + return false; } diff --git a/src/loadsave.hpp b/src/loadsave.hpp index 32f4912d..3ca719b5 100644 --- a/src/loadsave.hpp +++ b/src/loadsave.hpp @@ -1,8 +1,8 @@ #pragma once -#include "h-basic.h" +#include "program_args.hpp" #include <string> bool load_dungeon(std::string const &ext); -bool_ load_player(); +bool load_player(program_args const &); diff --git a/src/main.cc b/src/main.cc index 866e6aee..162ad6cb 100644 --- a/src/main.cc +++ b/src/main.cc @@ -244,15 +244,6 @@ usage: argv[1] = NULL; } - /* Process command line arguments */ - arg_wizard = program_args.wizard; - - if (auto it = program_args.force_key_set) - { - arg_force_roguelike = (*it == 'r'); - arg_force_original = (*it == 'o'); - } - /* If player name specified... */ if (!program_args.player_name.empty()) { @@ -289,7 +280,7 @@ usage: pause_line(23); /* Play the game */ - play_game(); + play_game(program_args); /* Quit */ quit(NULL); diff --git a/src/variable.cc b/src/variable.cc index 97c2cc64..8b5e9bfe 100644 --- a/src/variable.cc +++ b/src/variable.cc @@ -23,13 +23,6 @@ char *macro_trigger_name[MAX_MACRO_TRIG]; char *macro_trigger_keycode[2][MAX_MACRO_TRIG]; /* - * Run-time aruments - */ -bool_ arg_wizard; /* Command arg -- Request wizard mode */ -bool_ arg_force_original; /* Command arg -- Request original keyset */ -bool_ arg_force_roguelike; /* Command arg -- Request roguelike keyset */ - -/* * Various things */ diff --git a/src/variable.hpp b/src/variable.hpp index 40cc68cf..6316a521 100644 --- a/src/variable.hpp +++ b/src/variable.hpp @@ -186,7 +186,4 @@ extern s32b DUNGEON_ASTRAL_WILD_X; extern s32b DUNGEON_ASTRAL_WILD_Y; extern deity_type deity_info[MAX_GODS]; const char *get_version_string(); -extern bool_ arg_wizard; -extern bool_ arg_force_original; -extern bool_ arg_force_roguelike; extern struct options *options; |