#include <mp_create_game.hpp>
Public Member Functions | |
mp_create_game (saved_game &state, bool local_mode) | |
DEFINE_SIMPLE_EXECUTE_WRAPPER (mp_create_game) | |
The execute function. More... | |
![]() | |
modal_dialog () | |
virtual | ~modal_dialog () |
bool | show (const unsigned auto_close_time=0) |
Shows the window. More... | |
window * | get_window () const |
Returns a pointer to the dialog's window. More... | |
int | get_retval () const |
Returns the cached window exit code. More... | |
void | set_retval (int retval) |
Convenience wrapper to set the window's exit code. More... | |
void | set_always_save_fields (const bool always_save_fields) |
void | set_restore (const bool restore) |
void | set_allow_plugin_skip (const bool allow_plugin_skip) |
void | set_show_even_without_video (const bool show_even_without_video) |
Private Types | |
enum | tab { TAB_GENERAL, TAB_OPTIONS, TAB_SETTINGS } |
typedef std::pair< level_type::type, std::string > | level_type_info |
Private Member Functions | |
virtual const std::string & | window_id () const override |
The id of the window to build. More... | |
virtual void | pre_show (window &window) override |
Actions to be taken before showing the window. More... | |
virtual void | post_show (window &window) override |
Actions to be taken after the window has been shown. More... | |
void | update_games_list () |
void | display_games_of_type (level_type::type type, const std::string &level) |
void | show_generator_settings () |
void | regenerate_random_map () |
template<typename widget > | |
void | on_filter_change (const std::string &id, bool do_select) |
void | on_game_select () |
void | on_tab_select () |
void | on_era_select () |
void | on_mod_toggle (const int index, toggle_button *sender) |
void | on_random_faction_mode_select () |
std::vector< std::string > | get_active_mods () |
void | set_active_mods (const std::vector< std::string > &val) |
void | sync_with_depcheck () |
void | show_description (const std::string &new_description) |
void | update_details () |
void | update_map_settings () |
void | reset_timer_settings () |
bool | dialog_exit_hook (window &) |
Dialog exit hook to bring up the difficulty dialog when starting a campaign. More... | |
int | convert_to_game_filtered_index (const unsigned int initial_index) |
void | load_game_callback () |
![]() | |
plugin_executor () | |
~plugin_executor () | |
Additional Inherited Members | |
![]() | |
template<typename T , typename... Args> | |
T * | register_field (Args &&... args) |
Creates a new field of given type with given arguments. More... | |
field_bool * | register_bool (const std::string &id, const bool mandatory, const std::function< bool()> callback_load_value=nullptr, const std::function< void(bool)> callback_save_value=nullptr, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false) |
Creates a new boolean field. More... | |
field_bool * | register_bool (const std::string &id, const bool mandatory, bool &linked_variable, const std::function< void(widget &)> callback_change=nullptr, const bool initial_fire=false) |
Creates a new boolean field. More... | |
field_integer * | register_integer (const std::string &id, const bool mandatory, const std::function< int()> callback_load_value=nullptr, const std::function< void(int)> callback_save_value=nullptr) |
Creates a new integer field. More... | |
field_integer * | register_integer (const std::string &id, const bool mandatory, int &linked_variable) |
Creates a new integer field. More... | |
field_text * | register_text (const std::string &id, const bool mandatory, const std::function< std::string()> callback_load_value=nullptr, const std::function< void(const std::string &)> callback_save_value=nullptr, const bool capture_focus=false) |
Creates a new text field. More... | |
field_text * | register_text (const std::string &id, const bool mandatory, std::string &linked_variable, const bool capture_focus=false) |
Creates a new text field. More... | |
field_label * | register_label (const std::string &id, const bool mandatory, const std::string &text, const bool use_markup=false) |
Registers a new styled_widget as a label. More... | |
field_label * | register_image (const std::string &id, const bool mandatory, const std::string &filename) |
Registers a new styled_widget as image. More... | |
![]() | |
std::unique_ptr< window > | window_ |
The window object build for this dialog. More... | |
Definition at line 37 of file mp_create_game.hpp.
|
private |
Definition at line 39 of file mp_create_game.hpp.
|
private |
Enumerator | |
---|---|
TAB_GENERAL | |
TAB_OPTIONS | |
TAB_SETTINGS |
Definition at line 130 of file mp_create_game.hpp.
gui2::dialogs::mp_create_game::mp_create_game | ( | saved_game & | state, |
bool | local_mode | ||
) |
Definition at line 68 of file mp_create_game.cpp.
References _().
|
private |
Definition at line 642 of file mp_create_game.cpp.
References create_engine_, ng::create_engine::current_level_type(), and ng::create_engine::get_filtered_level_indices().
Referenced by on_game_select(), and pre_show().
gui2::dialogs::mp_create_game::DEFINE_SIMPLE_EXECUTE_WRAPPER | ( | mp_create_game | ) |
The execute function.
See modal_dialog for more information.
|
private |
Dialog exit hook to bring up the difficulty dialog when starting a campaign.
This only fires when the retval is OK (ie, creating a game), meaning it does not fire when loading a saved game.
Definition at line 828 of file mp_create_game.cpp.
References _(), ng::level::can_launch_game(), create_engine_, ng::create_engine::current_level(), ng::create_engine::current_level_has_side_data(), ng::level::description(), ng::create_engine::is_campaign(), wfl::msg(), ng::create_engine::select_campaign_difficulty(), and gui2::show_transient_error_message().
Referenced by pre_show().
|
private |
Definition at line 583 of file mp_create_game.cpp.
References gui2::listbox::add_row(), gui2::listbox::clear(), create_engine_, ng::create_engine::find_level_by_id(), gui2::listbox::get_item_count(), ng::create_engine::get_levels_by_type_unfiltered(), gui2::listbox::get_rows_shown(), gui2::dialogs::modal_dialog::get_window(), on_game_select(), gui2::listbox::select_row(), selected_game_index_, and ng::create_engine::set_current_level_type().
Referenced by pre_show(), sync_with_depcheck(), and update_games_list().
|
private |
Definition at line 790 of file mp_create_game.cpp.
References create_engine_, ng::create_engine::get_extras_by_type(), gui2::listbox::get_row_grid(), i, ng::create_engine::MOD, and mod_list_.
Referenced by sync_with_depcheck().
|
private |
Definition at line 775 of file mp_create_game.cpp.
References saved_game::cancel_orders(), create_engine_, savegame::save_index_class::default_saves_dir(), ng::create_engine::get_state(), gui2::tip_of_the_day::load(), and gui2::dialogs::modal_dialog::set_retval().
Referenced by pre_show().
|
private |
Definition at line 552 of file mp_create_game.cpp.
References create_engine_, ng::create_engine::current_era(), ng::create_engine::extras_metadata::description, eras_menu_button_, gui2::menu_button::get_value(), options_manager_, ng::create_engine::set_current_era_index(), gui2::styled_widget::set_tooltip(), and sync_with_depcheck().
Referenced by pre_show().
|
private |
Definition at line 479 of file mp_create_game.cpp.
References ng::create_engine::apply_level_filter(), create_engine_, ng::create_engine::current_level_type(), ng::create_engine::get_filtered_level_indices(), gui2::listbox::get_item_count(), gui2::dialogs::modal_dialog::get_window(), i, on_game_select(), and gui2::listbox::set_row_shown().
|
private |
Definition at line 497 of file mp_create_game.cpp.
References _(), ng::level::allow_era_choice(), convert_to_game_filtered_index(), create_engine_, ng::create_engine::current_level(), eras_menu_button_, gui2::menu_button::get_value(), gui2::dialogs::modal_dialog::get_window(), options_manager_, selected_game_index_, gui2::menu_button::set_active(), ng::create_engine::set_current_level(), gui2::styled_widget::set_label(), gui2::menu_button::set_selected(), sync_with_depcheck(), update_details(), and update_map_settings().
Referenced by display_games_of_type(), on_filter_change(), pre_show(), and sync_with_depcheck().
|
private |
Definition at line 538 of file mp_create_game.cpp.
References create_engine_, ng::create_engine::dependency_manager(), ERR_MP, gui2::selectable_item::get_value_bool(), ng::depcheck::manager::is_modification_active(), options_manager_, sync_with_depcheck(), and ng::create_engine::toggle_mod().
Referenced by pre_show().
|
private |
Definition at line 563 of file mp_create_game.cpp.
References gui2::dialogs::modal_dialog::get_window(), and selected_rfm_index_.
Referenced by pre_show().
|
private |
Definition at line 532 of file mp_create_game.cpp.
References gui2::dialogs::modal_dialog::get_window(), and i.
Referenced by pre_show().
|
overrideprivatevirtual |
Actions to be taken after the window has been shown.
At this point the registered fields already stored their values (if the OK has been pressed).
window | The window which has been shown. |
Reimplemented from gui2::dialogs::modal_dialog.
Definition at line 852 of file mp_create_game.cpp.
References _(), action_bonus_, ng::create_engine::active_mods(), saved_game::classification(), config_engine_, create_engine_, ng::create_engine::current_era(), ng::create_engine::current_level(), ng::create_engine::current_level_type(), ng::level::data(), game_config::debug, config::empty(), experience_, fog_, ng::configure_engine::game_name_default(), game_config_manager::get(), string_enums::enum_base< T >::get_enum(), ng::create_engine::get_parameters(), gui2::dialogs::modal_dialog::get_retval(), ng::create_engine::get_state(), string_enums::enum_base< T >::get_string(), game_classification::get_tagname(), gui2::field< T, W, CT >::get_widget_value(), gold_, mp_game_settings::hash, config::hash(), ng::level::id(), ng::create_engine::extras_metadata::id, init_turn_limit_, saved_game::mp_settings(), observers_, gui2::OK, options_manager_, preferences::password(), gui2::dialogs::plugin_executor::plugins_context_, ng::create_engine::prepare_for_campaign(), ng::create_engine::prepare_for_era_and_mods(), ng::create_engine::prepare_for_new_level(), ng::create_engine::prepare_for_other(), ng::create_engine::prepare_for_saved_game(), ng::create_engine::prepare_for_scenario(), private_replay_, reservoir_, gui2::dialogs::simple_item_selector::selected_index(), selected_rfm_index_, preferences::set_era(), preferences::set_level(), preferences::set_level_type(), preferences::set_modifications(), preferences::set_random_faction_mode(), gui2::dialogs::modal_dialog::set_retval(), saved_game::set_scenario(), gui2::dialogs::simple_item_selector::set_single_button(), gui2::dialogs::modal_dialog::show(), shroud_, shuffle_sides_, start_time_, strict_sync_, support_, time_limit_, turn_bonus_, turns_, settings::turns_max, and use_map_settings_.
|
overrideprivatevirtual |
Actions to be taken before showing the window.
At this point the registered fields are registered and initialized with their initial values.
window | The window to be shown. |
Reimplemented from gui2::dialogs::modal_dialog.
Definition at line 122 of file mp_create_game.cpp.
References _(), action_bonus_, ng::create_engine::active_mods(), gui2::listbox::add_row(), ng::level::allow_era_choice(), gui2::CANCEL, config_engine_, gui2::event::connect_signal_mouse_left_click(), gui2::event::connect_signal_notify_modified(), convert_to_game_filtered_index(), create_engine_, ng::create_engine::current_level(), ng::create_engine::current_level_type(), ng::level::description(), dialog_exit_hook(), display_games_of_type(), ng::create_engine::ERA, preferences::era(), eras_menu_button_, experience_, ng::create_engine::find_extra_by_id(), ng::create_engine::find_level_by_id(), preferences::fog(), ng::configure_engine::game_name_default(), ng::create_engine::get_const_extras_by_type(), string_enums::enum_base< T >::get_enum(), ng::create_engine::get_extras_by_type(), gui2::listbox::get_item_count(), string_enums::enum_base< T >::get_string(), gold_, i, ng::level::icon(), ng::level::id(), gui2::field_base::id(), utf8::index(), lg::info(), init_turn_limit_, gui2::widget::invisible, preferences::level(), preferences::level_type(), level_types_, load_game_callback(), local_mode_, ng::create_engine::MOD, mod_list_, preferences::modifications(), ng::level::name(), names, observers_, gui2::OK, on_era_select(), on_game_select(), on_mod_toggle(), on_random_faction_mode_select(), on_tab_select(), options_manager_, gui2::dialogs::plugin_executor::plugins_context_, private_replay_, regenerate_random_map(), reservoir_, reset_timer_settings(), selected_game_index_, ng::create_engine::set_current_era_index(), ng::create_engine::set_current_level(), ng::create_engine::set_current_level_type(), gui2::menu_button::set_selected(), gui2::text_box_base::set_text_changed_callback(), gui2::selectable_item::set_value_bool(), gui2::menu_button::set_values(), show_generator_settings(), gui2::show_transient_message(), preferences::shroud(), preferences::shuffle_sides(), string_enums::enum_base< T >::size(), strict_sync_, support_, turn_bonus_, preferences::turns(), turns_, UPDATE_ATTRIBUTE, update_games_list(), w, and gui2::field_base::widget_set_enabled().
|
private |
Definition at line 635 of file mp_create_game.cpp.
References create_engine_, ng::create_engine::init_generated_level_data(), and update_details().
Referenced by pre_show(), and show_generator_settings().
|
private |
Definition at line 814 of file mp_create_game.cpp.
References action_bonus_, preferences::countdown_action_bonus(), preferences::countdown_init_time(), preferences::countdown_reservoir_time(), preferences::countdown_turn_bonus(), preferences::erase(), init_turn_limit_, reservoir_, gui2::field< T, W, CT >::set_widget_value(), and turn_bonus_.
Referenced by pre_show().
|
private |
Definition at line 803 of file mp_create_game.cpp.
References create_engine_, ng::create_engine::get_extras_by_type(), gui2::listbox::get_row_grid(), i, ng::create_engine::MOD, and mod_list_.
Referenced by sync_with_depcheck().
|
private |
Definition at line 568 of file mp_create_game.cpp.
References _(), gui2::dialogs::modal_dialog::get_window(), gui2::styled_widget::set_label(), and gui2::styled_widget::set_use_markup().
Referenced by update_details().
|
private |
Definition at line 628 of file mp_create_game.cpp.
References create_engine_, ng::create_engine::generator_user_config(), and regenerate_random_map().
Referenced by pre_show().
|
private |
Definition at line 425 of file mp_create_game.cpp.
References create_engine_, ng::create_engine::current_era_index(), ng::create_engine::current_level(), ng::create_engine::current_level_type(), DBG_MP, ng::create_engine::dependency_manager(), display_games_of_type(), eras_menu_button_, ng::create_engine::find_level_by_id(), get_active_mods(), ng::depcheck::manager::get_era_index(), ng::depcheck::manager::get_modifications(), ng::depcheck::manager::get_scenario(), gui2::dialogs::modal_dialog::get_window(), ng::level::id(), lg::info(), ng::create_engine::init_active_mods(), level_types_, on_game_select(), selected_game_index_, set_active_mods(), ng::create_engine::set_current_era_index(), ng::create_engine::set_current_level(), ng::create_engine::set_current_level_type(), and gui2::menu_button::set_value().
Referenced by on_era_select(), on_game_select(), and on_mod_toggle().
|
private |
Definition at line 648 of file mp_create_game.cpp.
References game_classification::campaign, saved_game::classification(), config_engine_, create_engine_, ng::create_engine::current_level(), ng::create_engine::current_level_type(), ng::level::data(), ng::level::description(), config::empty(), saved_game::expand_map_file(), ng::create_engine::generator_assigned(), ng::create_engine::generator_has_settings(), ng::create_engine::get_state(), gui2::dialogs::modal_dialog::get_window(), ng::create_engine::init_generated_level_data(), ng::scenario::map_size(), ng::campaign::max_players(), ng::campaign::min_players(), ng::level::name(), ng::scenario::num_players(), gui2::styled_widget::set_label(), ng::level::set_metadata(), ng::scenario::set_metadata(), show_description(), font::unicode_em_dash, and VGETTEXT.
Referenced by on_game_select(), and regenerate_random_map().
|
private |
Definition at line 576 of file mp_create_game.cpp.
References create_engine_, ng::create_engine::current_level(), display_games_of_type(), gui2::dialogs::modal_dialog::get_window(), ng::level::id(), utf8::index(), and level_types_.
Referenced by pre_show().
|
private |
Definition at line 732 of file mp_create_game.cpp.
References action_bonus_, config_engine_, experience_, fog_, gui2::field< T, W, CT >::get_widget_value(), gui2::dialogs::modal_dialog::get_window(), gold_, init_turn_limit_, reservoir_, gui2::field< T, W, CT >::set_widget_value(), shroud_, start_time_, support_, time_limit_, turn_bonus_, turns_, preferences::use_map_settings(), use_map_settings_, and gui2::field_base::widget_set_enabled().
Referenced by on_game_select().
|
overrideprivatevirtual |
The id of the window to build.
Implements gui2::dialogs::modal_dialog.
|
private |
Definition at line 91 of file mp_create_game.hpp.
Referenced by post_show(), pre_show(), reset_timer_settings(), and update_map_settings().
|
private |
Definition at line 55 of file mp_create_game.hpp.
Referenced by post_show(), pre_show(), update_details(), and update_map_settings().
|
private |
Definition at line 54 of file mp_create_game.hpp.
Referenced by convert_to_game_filtered_index(), dialog_exit_hook(), display_games_of_type(), get_active_mods(), load_game_callback(), on_era_select(), on_filter_change(), on_game_select(), on_mod_toggle(), post_show(), pre_show(), regenerate_random_map(), set_active_mods(), show_generator_settings(), sync_with_depcheck(), update_details(), and update_games_list().
|
private |
Definition at line 94 of file mp_create_game.hpp.
Referenced by on_era_select(), on_game_select(), pre_show(), and sync_with_depcheck().
|
private |
Definition at line 87 of file mp_create_game.hpp.
Referenced by post_show(), pre_show(), and update_map_settings().
|
private |
Definition at line 75 of file mp_create_game.hpp.
Referenced by post_show(), and update_map_settings().
|
private |
Definition at line 85 of file mp_create_game.hpp.
Referenced by post_show(), pre_show(), and update_map_settings().
|
private |
Definition at line 88 of file mp_create_game.hpp.
Referenced by post_show(), pre_show(), reset_timer_settings(), and update_map_settings().
|
private |
Definition at line 61 of file mp_create_game.hpp.
Referenced by pre_show(), sync_with_depcheck(), and update_games_list().
|
private |
Definition at line 96 of file mp_create_game.hpp.
Referenced by pre_show().
|
private |
Definition at line 93 of file mp_create_game.hpp.
Referenced by get_active_mods(), pre_show(), and set_active_mods().
|
private |
Definition at line 80 of file mp_create_game.hpp.
Referenced by post_show(), and pre_show().
|
private |
Definition at line 56 of file mp_create_game.hpp.
Referenced by on_era_select(), on_game_select(), on_mod_toggle(), post_show(), and pre_show().
|
private |
Definition at line 82 of file mp_create_game.hpp.
Referenced by post_show(), and pre_show().
|
private |
Definition at line 90 of file mp_create_game.hpp.
Referenced by post_show(), pre_show(), reset_timer_settings(), and update_map_settings().
|
private |
Definition at line 58 of file mp_create_game.hpp.
Referenced by display_games_of_type(), on_game_select(), pre_show(), and sync_with_depcheck().
|
private |
Definition at line 59 of file mp_create_game.hpp.
Referenced by on_random_faction_mode_select(), and post_show().
|
private |
Definition at line 76 of file mp_create_game.hpp.
Referenced by post_show(), and update_map_settings().
|
private |
Definition at line 79 of file mp_create_game.hpp.
Referenced by post_show().
|
private |
Definition at line 77 of file mp_create_game.hpp.
Referenced by post_show(), and update_map_settings().
|
private |
Definition at line 81 of file mp_create_game.hpp.
Referenced by post_show(), and pre_show().
|
private |
Definition at line 86 of file mp_create_game.hpp.
Referenced by post_show(), pre_show(), and update_map_settings().
|
private |
Definition at line 78 of file mp_create_game.hpp.
Referenced by post_show(), and update_map_settings().
|
private |
Definition at line 89 of file mp_create_game.hpp.
Referenced by post_show(), pre_show(), reset_timer_settings(), and update_map_settings().
|
private |
Definition at line 84 of file mp_create_game.hpp.
Referenced by post_show(), pre_show(), and update_map_settings().
|
private |
All fields are also in the normal field vector, but they need to be manually controlled as well so add the pointers here as well.
Definition at line 74 of file mp_create_game.hpp.
Referenced by post_show(), and update_map_settings().