#include <game_config_manager.hpp>
Public Types | |
enum | FORCE_RELOAD_CONFIG { FORCE_RELOAD, NO_FORCE_RELOAD, NO_INCLUDE_RELOAD } |
Public Member Functions | |
game_config_manager (const commandline_options &cmdline_opts) | |
~game_config_manager () | |
const game_config_view & | game_config () const |
const preproc_map & | old_defines_map () const |
const std::shared_ptr< terrain_type_data > & | terrain_types () const |
bool | init_game_config (FORCE_RELOAD_CONFIG force_reload) |
void | reload_changed_game_config () |
void | load_game_config_for_editor () |
void | load_game_config_for_game (const game_classification &classification, const std::string &scenario_id) |
void | load_game_config_for_create (bool is_mp, bool is_test=false) |
Static Public Member Functions | |
static game_config_manager * | get () |
Private Member Functions | |
void | set_enabled_addon (std::set< std::string > addon_ids) |
void | set_enabled_addon_all () |
game_config_manager (const game_config_manager &) | |
void | operator= (const game_config_manager &) |
void | load_game_config (bool reload_everything) |
void | load_game_config_with_loadscreen (FORCE_RELOAD_CONFIG force_reload, game_classification const *classification=nullptr, std::optional< std::set< std::string >> active_addons={}) |
void | load_addons_cfg () |
void | set_multiplayer_hashes () |
void | set_unit_data () |
Private Attributes | |
const commandline_options & | cmdline_opts_ |
config | game_config_ |
game_config_view | game_config_view_ |
std::map< std::string, config > | addon_cfgs_ |
std::optional< std::set< std::string > > | active_addons_ |
preproc_map | old_defines_map_ |
filesystem::binary_paths_manager | paths_manager_ |
game_config::config_cache & | cache_ |
std::shared_ptr< terrain_type_data > | tdata_ |
Friends | |
class | game_config_view |
Definition at line 26 of file game_config_manager.hpp.
Definition at line 32 of file game_config_manager.hpp.
game_config_manager::game_config_manager | ( | const commandline_options & | cmdline_opts | ) |
Definition at line 51 of file game_config_manager.cpp.
References commandline_options::any_validation_option(), cache_, cmdline_opts_, commandline_options::nocache, game_config::config_cache::set_force_valid_cache(), game_config::config_cache::set_use_cache(), and commandline_options::validcache.
Referenced by terrain_types().
game_config_manager::~game_config_manager | ( | ) |
Definition at line 75 of file game_config_manager.cpp.
|
private |
|
inline |
Definition at line 42 of file game_config_manager.hpp.
References game_config_view_.
Referenced by do_gameloop(), saved_game::expand_scenario(), mp::game_info::game_info(), game_lua_kernel::impl_game_config_set(), init_game_config(), mp::initial_level_config(), load_game_config(), saved_game::set_defaults(), set_multiplayer_hashes(), set_unit_data(), and mp::start_local_game_commandline().
|
static |
Definition at line 81 of file game_config_manager.cpp.
References singleton.
Referenced by game_classification::active_addons(), replay_controller::add_replay_theme(), gui2::dialogs::title_screen::button_callback_cores(), movetype::terrain_info::data::calc_value(), ng::create_engine::create_engine(), saved_game::expand_scenario(), gui2::dialogs::mp_join_game::fetch_game_config(), mp::game_info::game_info(), gamemap::gamemap(), gui2::dialogs::title_screen::hotkey_callback_select_tests(), game_lua_kernel::impl_game_config_get(), game_lua_kernel::impl_game_config_set(), mp::initial_level_config(), intf_get_era(), intf_get_resource(), game_launcher::launch_game(), game_launcher::load_game(), saved_game::load_non_scenario(), help::load_terrain_types_data(), game_launcher::play_multiplayer(), game_launcher::play_multiplayer_commandline(), game_launcher::play_render_image_mode(), game_launcher::play_screenshot_mode(), game_launcher::play_test(), gui2::dialogs::mp_create_game::post_show(), gui2::dialogs::title_screen::pre_show(), ng::create_engine::prepare_for_saved_game(), gui2::dialogs::faction_select::profile_button_callback(), saved_game::set_defaults(), preferences::show_theme_dialog(), game_launcher::single_unit_test(), game_launcher::start_editor(), and mp::start_local_game_commandline().
bool game_config_manager::init_game_config | ( | FORCE_RELOAD_CONFIG | force_reload | ) |
Definition at line 86 of file game_config_manager.cpp.
References cmdline_opts_, hotkey::deactivate_all_scopes(), commandline_options::editor, game_config::editor, game_config(), lg::general(), ai::configuration::init(), preferences::init_advanced_manager(), init_textdomains(), game_config::load_config(), load_game_config_with_loadscreen(), hotkey::load_hotkeys(), preferences::load_hotkeys(), commandline_options::mptest, commandline_options::multiplayer, game_config::reset_color_info(), hotkey::SCOPE_MAIN_MENU, about::set_about(), hotkey::set_scope_active(), and commandline_options::test.
Referenced by do_gameloop(), reload_changed_game_config(), and terrain_types().
|
private |
Definition at line 378 of file game_config_manager.cpp.
References _(), _n(), config::add_child(), addon_cfgs_, config::all_children_range(), config::append_children_by_move(), cache_, events::call_in_main_thread(), config::child_or_empty(), config::child_range(), cmdline_opts_, preferences::core_id(), deprecated_message(), gui2::dialogs::wml_error::display(), e, config::empty(), filesystem::ENTIRE_FILE_PATH, lg::err(), ERR_CONFIG, error(), filesystem::file_exists(), filesystem::FILE_NAME_ONLY, FOR_REMOVAL, game_config_, get_addon_pbl_info(), filesystem::get_addons_dir(), game_config::config_cache::get_config(), filesystem::get_files_in_dir(), filesystem::get_wml_location(), have_addon_pbl_info(), utils::join(), log_config, log_scope2, game::error::message, invalid_pbl_exception::message, n, REMOVED, schema_validation::schema_validator::set_create_exceptions(), utils::split(), version_info::str(), commandline_options::validate_addon, and WRN_CONFIG.
Referenced by load_game_config(), and terrain_types().
|
private |
Definition at line 185 of file game_config_manager.cpp.
References _(), active_addons_, config::add_child(), game_config::add_color_info(), config::append(), cache_, events::call_in_main_thread(), config::child_range(), cmdline_opts_, preferences::core_id(), create_cache, filesystem::data_tree_checksum(), gui2::dialogs::wml_error::display(), e, filesystem::ENTIRE_FILE_PATH, ERR_CONFIG, game_lua_kernel::extract_preload_scripts(), filesystem::file_exists(), config::find_child(), game_config(), game_config_, filesystem::get_addons_dir(), game_config::config_cache::get_config(), filesystem::get_files_in_dir(), game_config::config_cache::get_preproc_map(), filesystem::get_wml_location(), init_strings(), load_addons_cfg(), game_config::config_cache_transaction::lock(), game::error::message, game_config::no_addons, commandline_options::noaddons, old_defines_map_, game_config::path, paths_manager_, gui2::dialogs::loading_screen::progress(), preferences::set_core_id(), schema_validation::schema_validator::set_create_exceptions(), set_enabled_addon(), set_enabled_addon_all(), theme::set_known_themes(), set_multiplayer_hashes(), filesystem::binary_paths_manager::set_paths(), terrain_builder::set_terrain_rules_cfg(), set_unit_data(), tdata_, commandline_options::validate_core, and verify_cache.
Referenced by load_game_config_with_loadscreen(), and terrain_types().
void game_config_manager::load_game_config_for_create | ( | bool | is_mp, |
bool | is_test = false |
||
) |
During an mp game the default difficulty define is also defined so better already load it now if we already must reload config cache.
Definition at line 708 of file game_config_manager.cpp.
References cache_, game_config::config_cache::clear_defines(), cmdline_opts_, DEFAULT_DIFFICULTY, game_config::config_cache::get_preproc_map(), load_game_config_with_loadscreen(), commandline_options::mptest, NO_FORCE_RELOAD, NO_INCLUDE_RELOAD, and old_defines_map_.
Referenced by ng::create_engine::create_engine(), gui2::dialogs::title_screen::hotkey_callback_select_tests(), game_launcher::play_multiplayer(), game_launcher::play_multiplayer_commandline(), and terrain_types().
void game_config_manager::load_game_config_for_editor | ( | ) |
Definition at line 651 of file game_config_manager.cpp.
References game_config::editor, load_game_config_with_loadscreen(), and NO_FORCE_RELOAD.
Referenced by game_launcher::play_screenshot_mode(), game_launcher::start_editor(), and terrain_types().
void game_config_manager::load_game_config_for_game | ( | const game_classification & | classification, |
const std::string & | scenario_id | ||
) |
Definition at line 657 of file game_config_manager.cpp.
References game_classification::active_addons(), cache_, events::call_in_main_thread(), game_classification::campaign_define, game_classification::campaign_xtra_defines, game_config::config_cache::clear_defines(), cmdline_opts_, game_classification::difficulty, preferences::era(), game_classification::era_define, image::flush_cache(), game_classification::is_multiplayer(), load_game_config_with_loadscreen(), game_classification::mod_defines, commandline_options::mptest, NO_FORCE_RELOAD, old_defines_map_, and game_classification::scenario_define.
Referenced by saved_game::expand_scenario(), gui2::dialogs::mp_join_game::fetch_game_config(), game_launcher::launch_game(), game_launcher::load_game(), game_launcher::play_render_image_mode(), game_launcher::play_test(), ng::create_engine::prepare_for_saved_game(), game_launcher::single_unit_test(), mp::start_local_game_commandline(), and terrain_types().
|
private |
Definition at line 131 of file game_config_manager.cpp.
References active_addons_, cache_, game_config::debug, gui2::dialogs::loading_screen::display(), config::empty(), FORCE_LOG_TO, game_config_, game_config::config_cache::get_preproc_map(), lg::info(), load_game_config(), log_config, LOG_CONFIG, game_config::mp_debug, NO_FORCE_RELOAD, NO_INCLUDE_RELOAD, and old_defines_map_.
Referenced by init_game_config(), load_game_config_for_create(), load_game_config_for_editor(), load_game_config_for_game(), and terrain_types().
|
inline |
Definition at line 43 of file game_config_manager.hpp.
References old_defines_map_.
|
private |
Referenced by terrain_types().
void game_config_manager::reload_changed_game_config | ( | ) |
Definition at line 636 of file game_config_manager.cpp.
References cache_, filesystem::clear_binary_paths_cache(), sound::flush_cache(), image::flush_cache(), FORCE_RELOAD, init_game_config(), old_defines_map_, game_config::config_cache::recheck_filetree_checksum(), and refresh_addon_version_info_cache().
Referenced by do_gameloop(), game_launcher::start_editor(), and terrain_types().
|
private |
Definition at line 732 of file game_config_manager.cpp.
References addon_cfgs_, game_config_view::data(), game_config_, and game_config_view_.
Referenced by load_game_config(), and terrain_types().
|
private |
Definition at line 746 of file game_config_manager.cpp.
References addon_cfgs_, game_config_view::data(), game_config_, and game_config_view_.
Referenced by load_game_config(), and terrain_types().
|
private |
Definition at line 622 of file game_config_manager.cpp.
References config::add_child(), game_config(), game_config_, and config::hash().
Referenced by load_game_config(), and terrain_types().
|
private |
Definition at line 630 of file game_config_manager.cpp.
References game_config(), load_unit_types, gui2::dialogs::loading_screen::progress(), unit_type_data::set_config(), and unit_types.
Referenced by load_game_config(), and terrain_types().
|
inline |
Definition at line 44 of file game_config_manager.hpp.
References resources::classification, game_config_manager(), init_game_config(), load_addons_cfg(), load_game_config(), load_game_config_for_create(), load_game_config_for_editor(), load_game_config_for_game(), load_game_config_with_loadscreen(), operator=(), reload_changed_game_config(), set_enabled_addon(), set_enabled_addon_all(), set_multiplayer_hashes(), set_unit_data(), and tdata_.
Referenced by movetype::terrain_info::data::calc_value(), and help::load_terrain_types_data().
|
friend |
Definition at line 28 of file game_config_manager.hpp.
|
private |
Definition at line 78 of file game_config_manager.hpp.
Referenced by load_game_config(), and load_game_config_with_loadscreen().
|
private |
Definition at line 77 of file game_config_manager.hpp.
Referenced by load_addons_cfg(), set_enabled_addon(), and set_enabled_addon_all().
|
private |
Definition at line 84 of file game_config_manager.hpp.
Referenced by game_config_manager(), load_addons_cfg(), load_game_config(), load_game_config_for_create(), load_game_config_for_game(), load_game_config_with_loadscreen(), and reload_changed_game_config().
|
private |
Definition at line 72 of file game_config_manager.hpp.
Referenced by game_config_manager(), init_game_config(), load_addons_cfg(), load_game_config(), load_game_config_for_create(), and load_game_config_for_game().
|
private |
Definition at line 74 of file game_config_manager.hpp.
Referenced by load_addons_cfg(), load_game_config(), load_game_config_with_loadscreen(), set_enabled_addon(), set_enabled_addon_all(), and set_multiplayer_hashes().
|
private |
Definition at line 75 of file game_config_manager.hpp.
Referenced by game_config(), set_enabled_addon(), and set_enabled_addon_all().
|
private |
Definition at line 80 of file game_config_manager.hpp.
Referenced by load_game_config(), load_game_config_for_create(), load_game_config_for_game(), load_game_config_with_loadscreen(), old_defines_map(), and reload_changed_game_config().
|
private |
Definition at line 82 of file game_config_manager.hpp.
Referenced by load_game_config().
|
private |
Definition at line 86 of file game_config_manager.hpp.
Referenced by load_game_config(), and terrain_types().