#include <create_engine.hpp>
Classes | |
struct | extras_metadata |
struct | type_list |
Public Types | |
enum | MP_EXTRA { ERA , MOD } |
typedef std::shared_ptr< extras_metadata > | extras_metadata_ptr |
typedef std::shared_ptr< level > | level_ptr |
typedef std::shared_ptr< scenario > | scenario_ptr |
typedef std::shared_ptr< user_map > | user_map_ptr |
typedef std::shared_ptr< random_map > | random_map_ptr |
typedef std::shared_ptr< campaign > | campaign_ptr |
Public Member Functions | |
create_engine (saved_game &state) | |
void | init_generated_level_data () |
void | prepare_for_new_level () |
void | prepare_for_era_and_mods () |
void | prepare_for_scenario () |
void | prepare_for_campaign (const std::string &difficulty="") |
void | prepare_for_saved_game () |
void | prepare_for_other () |
std::string | select_campaign_difficulty (int set_value=-1) |
select_campaign_difficulty More... | |
std::string | get_selected_campaign_difficulty () const |
void | apply_level_filter (const std::string &name) |
void | apply_level_filter (int players) |
void | reset_level_filters () |
const std::string & | level_name_filter () const |
int | player_num_filter () const |
std::vector< level_ptr > | get_levels_by_type_unfiltered (level_type::type type) const |
std::vector< level_ptr > | get_levels_by_type (level_type::type type) const |
std::vector< std::size_t > | get_filtered_level_indices (level_type::type type) const |
level & | current_level () const |
const extras_metadata & | current_era () const |
void | set_current_level_type (const level_type::type type) |
level_type::type | current_level_type () const |
bool | is_campaign () const |
Wrapper to simplify the is-type-campaign-or-sp-campaign check. More... | |
void | set_current_level (const std::size_t index) |
void | set_current_era_index (const std::size_t index, bool force=false) |
std::size_t | current_era_index () const |
const config & | curent_era_cfg () const |
const std::vector< extras_metadata_ptr > & | get_const_extras_by_type (const MP_EXTRA extra_type) const |
std::vector< extras_metadata_ptr > & | get_extras_by_type (const MP_EXTRA extra_type) |
bool | toggle_mod (const std::string &id, bool force=false) |
bool | generator_assigned () const |
bool | generator_has_settings () const |
void | generator_user_config () |
std::pair< level_type::type, int > | find_level_by_id (const std::string &id) const |
int | find_extra_by_id (const MP_EXTRA extra_type, const std::string &id) const |
const depcheck::manager & | dependency_manager () const |
void | init_active_mods () |
std::vector< std::string > & | active_mods () |
std::vector< extras_metadata_ptr > | active_mods_data () |
const mp_game_settings & | get_parameters () |
saved_game & | get_state () |
bool | current_level_has_side_data () |
Returns true if the current level has one or more [side] tags. More... | |
Private Member Functions | |
create_engine (const create_engine &)=delete | |
create_engine & | operator= (const create_engine &)=delete |
void | init_all_levels () |
void | init_extras (const MP_EXTRA extra_type) |
void | apply_level_filters () |
std::size_t | map_level_index (std::size_t index) const |
Private Attributes | |
level_type::type | current_level_type_ |
std::size_t | current_level_index_ |
std::size_t | current_era_index_ |
std::string | level_name_filter_ |
int | player_count_filter_ |
std::map< level_type::type, type_list > | type_map_ |
std::vector< std::string > | user_map_names_ |
std::vector< std::string > | user_scenario_names_ |
std::vector< extras_metadata_ptr > | eras_ |
std::vector< extras_metadata_ptr > | mods_ |
saved_game & | state_ |
std::unique_ptr< depcheck::manager > | dependency_manager_ |
std::unique_ptr< map_generator > | generator_ |
std::string | selected_campaign_difficulty_ |
const game_config_view & | game_config_ |
Reference to the main game config. More... | |
Definition at line 266 of file create_engine.hpp.
typedef std::shared_ptr<campaign> ng::create_engine::campaign_ptr |
Definition at line 287 of file create_engine.hpp.
typedef std::shared_ptr<extras_metadata> ng::create_engine::extras_metadata_ptr |
Definition at line 281 of file create_engine.hpp.
typedef std::shared_ptr<level> ng::create_engine::level_ptr |
Definition at line 283 of file create_engine.hpp.
typedef std::shared_ptr<random_map> ng::create_engine::random_map_ptr |
Definition at line 286 of file create_engine.hpp.
typedef std::shared_ptr<scenario> ng::create_engine::scenario_ptr |
Definition at line 284 of file create_engine.hpp.
typedef std::shared_ptr<user_map> ng::create_engine::user_map_ptr |
Definition at line 285 of file create_engine.hpp.
Enumerator | |
---|---|
ERA | |
MOD |
Definition at line 271 of file create_engine.hpp.
|
explicit |
Definition at line 230 of file create_engine.cpp.
References game_classification::active_mods, saved_game::classification(), saved_game::clear(), DBG_MP, dependency_manager_, ERA, filesystem::FILE_NAME_ONLY, game_config_view::find_child(), game_config_, game_config_manager::get(), prefs::get(), filesystem::get_files_in_dir(), filesystem::get_legacy_editor_dir(), init_all_levels(), init_extras(), game_classification::is_multiplayer(), game_config_manager::load_game_config_for_create(), MOD, saved_game::mp_settings(), reset_level_filters(), mp_game_settings::saved_game, state_, game_classification::type, type_map_, user_map_names_, and user_scenario_names_.
|
privatedelete |
std::vector< std::string > & ng::create_engine::active_mods | ( | ) |
Definition at line 610 of file create_engine.cpp.
References game_classification::active_mods, saved_game::classification(), and state_.
Referenced by gui2::dialogs::mp_create_game::post_show(), gui2::dialogs::campaign_selection::pre_show(), gui2::dialogs::mp_create_game::pre_show(), and gui2::dialogs::campaign_selection::proceed().
std::vector< create_engine::extras_metadata_ptr > ng::create_engine::active_mods_data | ( | ) |
Definition at line 615 of file create_engine.cpp.
References get_const_extras_by_type().
Referenced by gui2::dialogs::sp_options_configure::execute(), and gui2::dialogs::mp_options_helper::update_mod_options().
void ng::create_engine::apply_level_filter | ( | const std::string & | name | ) |
Definition at line 486 of file create_engine.cpp.
References apply_level_filters(), and level_name_filter_.
Referenced by gui2::dialogs::mp_create_game::on_filter_change().
void ng::create_engine::apply_level_filter | ( | int | players | ) |
Definition at line 492 of file create_engine.cpp.
References apply_level_filters(), and player_count_filter_.
|
private |
Definition at line 797 of file create_engine.cpp.
References level_name_filter_, player_count_filter_, and type_map_.
Referenced by apply_level_filter().
const config & ng::create_engine::curent_era_cfg | ( | ) | const |
Definition at line 627 of file create_engine.cpp.
References ng::level::allow_era_choice(), current_era_index_, current_level(), and eras_.
Referenced by gui2::dialogs::mp_options_helper::update_era_options().
const create_engine::extras_metadata & ng::create_engine::current_era | ( | ) | const |
Definition at line 512 of file create_engine.cpp.
References current_era_index_, ERA, and get_const_extras_by_type().
Referenced by gui2::dialogs::mp_create_game::on_era_select(), and gui2::dialogs::mp_create_game::post_show().
|
inline |
Definition at line 360 of file create_engine.hpp.
References current_era_index_.
Referenced by gui2::dialogs::mp_create_game::sync_with_depcheck().
level & ng::create_engine::current_level | ( | ) | const |
Definition at line 507 of file create_engine.cpp.
References current_level_index_, current_level_type_, and type_map_.
Referenced by sp::configure_campaign(), curent_era_cfg(), current_level_has_side_data(), gui2::dialogs::mp_create_game::dialog_exit_hook(), gui2::dialogs::sp_options_configure::execute(), get_parameters(), init_generated_level_data(), gui2::dialogs::mp_create_game::on_game_select(), gui2::dialogs::mp_create_game::post_show(), gui2::dialogs::mp_create_game::pre_show(), prepare_for_campaign(), prepare_for_other(), prepare_for_scenario(), select_campaign_difficulty(), set_current_level(), gui2::dialogs::mp_create_game::sync_with_depcheck(), gui2::dialogs::mp_create_game::update_details(), gui2::dialogs::mp_options_helper::update_game_options(), and gui2::dialogs::mp_create_game::update_games_list().
bool ng::create_engine::current_level_has_side_data | ( | ) |
Returns true if the current level has one or more [side] tags.
Definition at line 349 of file create_engine.cpp.
References current_level(), ng::level::data(), config::has_child(), and is_campaign().
Referenced by gui2::dialogs::mp_create_game::dialog_exit_hook().
|
inline |
Definition at line 345 of file create_engine.hpp.
References current_level_type_.
Referenced by gui2::dialogs::mp_create_game::convert_to_game_filtered_index(), gui2::dialogs::mp_create_game::on_filter_change(), gui2::dialogs::mp_create_game::post_show(), gui2::dialogs::mp_create_game::pre_show(), gui2::dialogs::mp_create_game::sync_with_depcheck(), and gui2::dialogs::mp_create_game::update_details().
|
inline |
Definition at line 379 of file create_engine.hpp.
References dependency_manager_.
Referenced by gui2::dialogs::mp_create_game::on_mod_toggle(), and gui2::dialogs::mp_create_game::sync_with_depcheck().
int ng::create_engine::find_extra_by_id | ( | const MP_EXTRA | extra_type, |
const std::string & | id | ||
) | const |
Definition at line 592 of file create_engine.cpp.
References get_const_extras_by_type(), and i.
Referenced by gui2::dialogs::mp_create_game::pre_show().
std::pair< level_type::type, int > ng::create_engine::find_level_by_id | ( | const std::string & | id | ) | const |
Definition at line 575 of file create_engine.cpp.
Referenced by gui2::dialogs::mp_create_game::display_games_of_type(), gui2::dialogs::mp_create_game::pre_show(), and gui2::dialogs::mp_create_game::sync_with_depcheck().
bool ng::create_engine::generator_assigned | ( | ) | const |
Definition at line 560 of file create_engine.cpp.
References generator_.
Referenced by gui2::dialogs::mp_create_game::update_details().
bool ng::create_engine::generator_has_settings | ( | ) | const |
Definition at line 565 of file create_engine.cpp.
References generator_.
Referenced by gui2::dialogs::mp_create_game::update_details().
void ng::create_engine::generator_user_config | ( | ) |
Definition at line 570 of file create_engine.cpp.
References generator_.
Referenced by gui2::dialogs::mp_create_game::show_generator_settings().
const std::vector< create_engine::extras_metadata_ptr > & ng::create_engine::get_const_extras_by_type | ( | const MP_EXTRA | extra_type | ) | const |
Definition at line 832 of file create_engine.cpp.
References ERA, eras_, and mods_.
Referenced by active_mods_data(), current_era(), find_extra_by_id(), gui2::dialogs::campaign_selection::pre_show(), and gui2::dialogs::mp_create_game::pre_show().
std::vector< create_engine::extras_metadata_ptr > & ng::create_engine::get_extras_by_type | ( | const MP_EXTRA | extra_type | ) |
Definition at line 838 of file create_engine.cpp.
References ERA, eras_, and mods_.
Referenced by gui2::dialogs::mp_create_game::get_active_mods(), init_extras(), gui2::dialogs::mp_create_game::pre_show(), and gui2::dialogs::mp_create_game::set_active_mods().
std::vector< std::size_t > ng::create_engine::get_filtered_level_indices | ( | level_type::type | type | ) | const |
Definition at line 826 of file create_engine.cpp.
References type_map_.
Referenced by gui2::dialogs::mp_create_game::convert_to_game_filtered_index(), and gui2::dialogs::mp_create_game::on_filter_change().
std::vector< create_engine::level_ptr > ng::create_engine::get_levels_by_type | ( | level_type::type | type | ) | const |
Definition at line 814 of file create_engine.cpp.
References type_map_.
std::vector< create_engine::level_ptr > ng::create_engine::get_levels_by_type_unfiltered | ( | level_type::type | type | ) | const |
Definition at line 804 of file create_engine.cpp.
References type_map_.
Referenced by gui2::dialogs::mp_create_game::display_games_of_type(), gui2::dialogs::campaign_selection::pre_show(), sp::select_campaign(), and gui2::dialogs::campaign_selection::sort_campaigns().
const mp_game_settings & ng::create_engine::get_parameters | ( | ) |
Definition at line 633 of file create_engine.cpp.
References ng::level::allow_era_choice(), saved_game::classification(), current_era_index_, current_level(), DBG_MP, game_classification::era_id, eras_, mp_game_settings::mp_era_name, saved_game::mp_settings(), and state_.
Referenced by sp::configure_campaign(), gui2::dialogs::mp_create_game::post_show(), and prepare_for_era_and_mods().
|
inline |
Definition at line 313 of file create_engine.hpp.
References selected_campaign_difficulty_.
saved_game & ng::create_engine::get_state | ( | ) |
Definition at line 843 of file create_engine.cpp.
References state_.
Referenced by sp::configure_campaign(), gui2::dialogs::mp_create_game::load_game_callback(), gui2::dialogs::mp_create_game::post_show(), and gui2::dialogs::mp_create_game::update_details().
void ng::create_engine::init_active_mods | ( | ) |
Definition at line 605 of file create_engine.cpp.
References game_classification::active_mods, saved_game::classification(), dependency_manager_, and state_.
Referenced by gui2::dialogs::mp_create_game::sync_with_depcheck().
|
private |
Definition at line 644 of file create_engine.cpp.
References _(), b, game_config_view::child_range(), saved_game::classification(), data, dependency_manager_, e, ERR_CF, game_config_, filesystem::get_legacy_editor_dir(), i, game_classification::is_multiplayer(), game_config_view::optional_child(), preprocess_file(), read(), filesystem::read_map(), ng::depcheck::SCENARIO, state_, type_map_, user_map_names_, and user_scenario_names_.
Referenced by create_engine().
|
private |
Definition at line 764 of file create_engine.cpp.
References game_config_view::child_range(), saved_game::classification(), ERA, ERR_CF, game_config_, string_enums::enum_base< Definition >::get_enum(), get_extras_by_type(), game_classification::is_multiplayer(), and state_.
Referenced by create_engine().
void ng::create_engine::init_generated_level_data | ( | ) |
Definition at line 294 of file create_engine.cpp.
References current_level(), ng::level::data(), data, DBG_MP, e, ng::random_map::generate_whole_scenario(), generator_, saved_game::post_scenario_generation(), ng::level::set_data(), and WRN_MP.
Referenced by gui2::dialogs::mp_create_game::regenerate_random_map(), and gui2::dialogs::mp_create_game::update_details().
|
inline |
Wrapper to simplify the is-type-campaign-or-sp-campaign check.
Definition at line 351 of file create_engine.hpp.
References current_level_type_.
Referenced by current_level_has_side_data(), gui2::dialogs::mp_create_game::dialog_exit_hook(), and gui2::dialogs::mp_options_helper::update_game_options().
|
inline |
Definition at line 322 of file create_engine.hpp.
References level_name_filter_.
|
private |
|
privatedelete |
|
inline |
Definition at line 327 of file create_engine.hpp.
References player_count_filter_.
void ng::create_engine::prepare_for_campaign | ( | const std::string & | difficulty = "" | ) |
Definition at line 392 of file create_engine.cpp.
References game_classification::abbrev, game_classification::campaign, game_classification::campaign_define, game_classification::campaign_name, game_classification::campaign_xtra_defines, saved_game::classification(), current_level(), ng::level::data(), DBG_MP, game_classification::difficulty, game_classification::end_credits, game_classification::end_text, game_classification::end_text_duration, selected_campaign_difficulty_, saved_game::set_carryover_sides_start(), utils::split(), and state_.
Referenced by gui2::dialogs::mp_create_game::post_show(), and sp::select_campaign().
void ng::create_engine::prepare_for_era_and_mods | ( | ) |
Definition at line 372 of file create_engine.cpp.
References game_classification::active_mods, saved_game::classification(), game_classification::era_define, game_classification::era_id, game_config_view::find_mandatory_child(), game_config_, get_parameters(), game_classification::mod_defines, and state_.
Referenced by gui2::dialogs::mp_create_game::post_show(), and sp::select_campaign().
void ng::create_engine::prepare_for_new_level | ( | ) |
Definition at line 365 of file create_engine.cpp.
References DBG_MP, saved_game::expand_random_scenario(), saved_game::expand_scenario(), and state_.
Referenced by sp::configure_campaign(), and gui2::dialogs::mp_create_game::post_show().
void ng::create_engine::prepare_for_other | ( | ) |
Definition at line 478 of file create_engine.cpp.
References saved_game::check_require_scenario(), current_level(), ng::level::data(), data, DBG_MP, config::hash(), mp_game_settings::hash, saved_game::mp_settings(), saved_game::set_scenario(), and state_.
Referenced by gui2::dialogs::mp_create_game::post_show().
void ng::create_engine::prepare_for_saved_game | ( | ) |
Definition at line 467 of file create_engine.cpp.
References saved_game::classification(), DBG_MP, saved_game::expand_scenario(), game_config_manager::get(), saved_game::get_scenario_id(), saved_game::is_mid_game_save(), game_config_manager::load_game_config_for_game(), saved_game::mp_settings(), mp_game_settings::saved_game, and state_.
Referenced by gui2::dialogs::mp_create_game::post_show().
void ng::create_engine::prepare_for_scenario | ( | ) |
Definition at line 381 of file create_engine.cpp.
References saved_game::classification(), current_level(), ng::level::data(), DBG_MP, game_classification::scenario_define, saved_game::set_carryover_sides_start(), and state_.
Referenced by gui2::dialogs::mp_create_game::post_show().
void ng::create_engine::reset_level_filters | ( | ) |
Definition at line 498 of file create_engine.cpp.
References level_name_filter_, and type_map_.
Referenced by create_engine().
std::string ng::create_engine::select_campaign_difficulty | ( | int | set_value = -1 | ) |
select_campaign_difficulty
Launches difficulty selection gui and returns selected difficulty name.
The gui can be bypassed by supplying a number from 1 to the number of difficulties available, corresponding to a choice of difficulty. This is useful for specifying difficulty via command line.
set_value | Preselected difficulty number. The default -1 launches the gui. |
Definition at line 421 of file create_engine.cpp.
References current_level(), d, data, PLAIN_LOG, selected_campaign_difficulty_, gui2::dialogs::campaign_difficulty::selected_difficulty(), and gui2::dialogs::modal_dialog::show().
Referenced by gui2::dialogs::mp_create_game::dialog_exit_hook().
void ng::create_engine::set_current_era_index | ( | const std::size_t | index, |
bool | force = false |
||
) |
Definition at line 541 of file create_engine.cpp.
References current_era_index_, dependency_manager_, and utf8::index().
Referenced by gui2::dialogs::mp_create_game::on_era_select(), gui2::dialogs::mp_create_game::pre_show(), and gui2::dialogs::mp_create_game::sync_with_depcheck().
void ng::create_engine::set_current_level | ( | const std::size_t | index | ) |
Definition at line 517 of file create_engine.cpp.
References saved_game::classification(), ng::random_map::create_map_generator(), current_level(), current_level_index_, current_level_type_, dependency_manager_, generator_, utf8::index(), game_classification::is_multiplayer(), state_, and type_map_.
Referenced by gui2::dialogs::mp_create_game::on_game_select(), gui2::dialogs::mp_create_game::pre_show(), sp::select_campaign(), and gui2::dialogs::mp_create_game::sync_with_depcheck().
|
inline |
Definition at line 340 of file create_engine.hpp.
References current_level_type_.
Referenced by gui2::dialogs::mp_create_game::display_games_of_type(), gui2::dialogs::mp_create_game::pre_show(), sp::select_campaign(), and gui2::dialogs::mp_create_game::sync_with_depcheck().
bool ng::create_engine::toggle_mod | ( | const std::string & | id, |
bool | force = false |
||
) |
Definition at line 548 of file create_engine.cpp.
References game_classification::active_mods, saved_game::classification(), dependency_manager_, gui2::is_active(), state_, and game_classification::type.
Referenced by gui2::dialogs::campaign_selection::mod_toggled(), and gui2::dialogs::mp_create_game::on_mod_toggle().
|
private |
Definition at line 409 of file create_engine.hpp.
Referenced by curent_era_cfg(), current_era(), current_era_index(), get_parameters(), and set_current_era_index().
|
private |
Definition at line 407 of file create_engine.hpp.
Referenced by current_level(), and set_current_level().
|
private |
Definition at line 406 of file create_engine.hpp.
Referenced by current_level(), current_level_type(), is_campaign(), set_current_level(), and set_current_level_type().
|
private |
Definition at line 452 of file create_engine.hpp.
Referenced by create_engine(), dependency_manager(), init_active_mods(), init_all_levels(), set_current_era_index(), set_current_level(), and toggle_mod().
|
private |
Definition at line 446 of file create_engine.hpp.
Referenced by curent_era_cfg(), get_const_extras_by_type(), get_extras_by_type(), and get_parameters().
|
private |
Reference to the main game config.
Definition at line 459 of file create_engine.hpp.
Referenced by create_engine(), init_all_levels(), init_extras(), and prepare_for_era_and_mods().
|
private |
Definition at line 454 of file create_engine.hpp.
Referenced by generator_assigned(), generator_has_settings(), generator_user_config(), init_generated_level_data(), and set_current_level().
|
private |
Definition at line 411 of file create_engine.hpp.
Referenced by apply_level_filter(), apply_level_filters(), level_name_filter(), and reset_level_filters().
|
private |
Definition at line 447 of file create_engine.hpp.
Referenced by get_const_extras_by_type(), and get_extras_by_type().
|
private |
Definition at line 412 of file create_engine.hpp.
Referenced by apply_level_filter(), apply_level_filters(), and player_num_filter().
|
private |
Definition at line 456 of file create_engine.hpp.
Referenced by get_selected_campaign_difficulty(), prepare_for_campaign(), and select_campaign_difficulty().
|
private |
Definition at line 449 of file create_engine.hpp.
Referenced by active_mods(), create_engine(), get_parameters(), get_state(), init_active_mods(), init_all_levels(), init_extras(), prepare_for_campaign(), prepare_for_era_and_mods(), prepare_for_new_level(), prepare_for_other(), prepare_for_saved_game(), prepare_for_scenario(), set_current_level(), and toggle_mod().
|
private |
Definition at line 441 of file create_engine.hpp.
Referenced by apply_level_filters(), create_engine(), current_level(), find_level_by_id(), get_filtered_level_indices(), get_levels_by_type(), get_levels_by_type_unfiltered(), init_all_levels(), reset_level_filters(), and set_current_level().
|
private |
Definition at line 443 of file create_engine.hpp.
Referenced by create_engine(), and init_all_levels().
|
private |
Definition at line 444 of file create_engine.hpp.
Referenced by create_engine(), and init_all_levels().