Game Config Manager: removed jump_to_editor ctor argument

This was taken from the value in game_launcher, which was set to true if commandline_options::editor was set.
This uses that value instead of passing in the flag manually, which is consistent with the other defines.

This also removes game_launcher::jump_to_editor since it's no longer needed.
This commit is contained in:
Charles Dang 2021-01-09 11:38:33 +11:00
parent 148574a3a9
commit ef5296faf5
4 changed files with 7 additions and 12 deletions

View file

@ -48,9 +48,8 @@ static lg::log_domain log_config("config");
static game_config_manager* singleton;
game_config_manager::game_config_manager(const commandline_options& cmdline_opts, const bool jump_to_editor)
game_config_manager::game_config_manager(const commandline_options& cmdline_opts)
: cmdline_opts_(cmdline_opts)
, jump_to_editor_(jump_to_editor)
, game_config_()
, game_config_view_()
, addon_cfgs_()
@ -87,13 +86,12 @@ game_config_manager* game_config_manager::get()
bool game_config_manager::init_game_config(FORCE_RELOAD_CONFIG force_reload)
{
// Add preproc defines according to the command line arguments.
game_config::scoped_preproc_define multiplayer("MULTIPLAYER",
cmdline_opts_.multiplayer);
game_config::scoped_preproc_define test("TEST", bool(cmdline_opts_.test));
game_config::scoped_preproc_define multiplayer("MULTIPLAYER", cmdline_opts_.multiplayer);
game_config::scoped_preproc_define test("TEST", utils::has_optional_value(cmdline_opts_.test));
game_config::scoped_preproc_define mptest("MP_TEST", cmdline_opts_.mptest);
game_config::scoped_preproc_define editor("EDITOR", jump_to_editor_);
game_config::scoped_preproc_define editor("EDITOR", utils::has_optional_value(cmdline_opts_.editor));
game_config::scoped_preproc_define title_screen("TITLE_SCREEN",
!cmdline_opts_.multiplayer && !cmdline_opts_.test && !jump_to_editor_);
!cmdline_opts_.multiplayer && !cmdline_opts_.test && !cmdline_opts_.editor);
game_config::reset_color_info();

View file

@ -27,7 +27,7 @@ class game_config_manager
{
friend class game_config_view;
public:
game_config_manager(const commandline_options& cmdline_opts, const bool jump_to_editor);
game_config_manager(const commandline_options& cmdline_opts);
~game_config_manager();
enum FORCE_RELOAD_CONFIG
{
@ -70,7 +70,6 @@ private:
void set_unit_data();
const commandline_options& cmdline_opts_;
const bool jump_to_editor_;
config game_config_;
game_config_view game_config_view_;

View file

@ -97,8 +97,6 @@ public:
bool goto_multiplayer();
bool goto_editor();
bool jump_to_editor() const { return jump_to_editor_; }
void select_mp_server(const std::string& server) { multiplayer_server_ = server; }
bool play_multiplayer(mp_mode mode);
bool play_multiplayer_commandline();

View file

@ -765,7 +765,7 @@ static int do_gameloop(const std::vector<std::string>& args)
gui2::init();
const gui2::event::manager gui_event_manager;
game_config_manager config_manager(cmdline_opts, game->jump_to_editor());
game_config_manager config_manager(cmdline_opts);
gui2::dialogs::loading_screen::display([&res, &config_manager]() {
gui2::dialogs::loading_screen::progress(loading_stage::load_config);