The Battle for Wesnoth  1.15.1+dev
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
gui2::dialogs::mp_create_game Class Reference

#include <mp_create_game.hpp>

Inheritance diagram for gui2::dialogs::mp_create_game:
Inheritance graph

Public Member Functions

 mp_create_game (const config &cfg, saved_game &state, bool local_mode, mp::user_info *host_info=nullptr)
 
- Public Member Functions inherited from gui2::dialogs::modal_dialog
 modal_dialog ()
 
virtual ~modal_dialog ()
 
bool show (const unsigned auto_close_time=0)
 Shows the window. More...
 
windowget_window () const
 Returns a pointer to the dialog's window. More...
 
int get_retval () const
 
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< ng::level::TYPE, std::string > level_type_info
 

Private Member Functions

virtual const std::string & window_id () const override
 Inherited from modal_dialog, implemented by REGISTER_DIALOG. More...
 
virtual void pre_show (window &window) override
 Inherited from modal_dialog. More...
 
virtual void post_show (window &window) override
 Inherited from modal_dialog. More...
 
void update_games_list (window &window)
 
void display_games_of_type (window &window, ng::level::TYPE type, const std::string &level)
 
void show_generator_settings (window &window)
 
void regenerate_random_map (window &window)
 
template<typename widget >
void on_filter_change (window &window, const std::string &id, bool do_select)
 
void on_game_select (window &window)
 
void on_tab_select (window &window)
 
void on_era_select (window &window)
 
void on_mod_toggle (window &window, const int index, toggle_button *sender)
 
void on_random_faction_mode_select (window &window)
 
std::vector< std::string > get_active_mods ()
 
void set_active_mods (const std::vector< std::string > &val)
 
void sync_with_depcheck (window &window)
 
void show_description (window &window, const std::string &new_description)
 
void update_details (window &window)
 
void update_map_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 (window &window)
 
- Private Member Functions inherited from gui2::dialogs::plugin_executor
 plugin_executor ()
 
 ~plugin_executor ()
 

Private Attributes

const configcfg_
 
ng::create_engine create_engine_
 
std::unique_ptr< ng::configure_engineconfig_engine_
 
std::unique_ptr< mp_options_helperoptions_manager_
 
int selected_game_index_
 
int selected_rfm_index_
 
std::vector< level_type_infolevel_types_
 
std::vector< mp_game_settings::RANDOM_FACTION_MODE > rfm_types_
 
field_booluse_map_settings_
 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. More...
 
field_boolfog_
 
field_boolshroud_
 
field_boolstart_time_
 
field_booltime_limit_
 
field_boolshuffle_sides_
 
field_boolobservers_
 
field_boolregistered_users_
 
field_boolstrict_sync_
 
field_integerturns_
 
field_integergold_
 
field_integersupport_
 
field_integerexperience_
 
field_integerinit_turn_limit_
 
field_integerturn_bonus_
 
field_integerreservoir_
 
field_integeraction_bonus_
 
listboxmod_list_
 
menu_buttoneras_menu_button_
 
bool local_mode_
 
mp::user_infohost_info_
 
- Private Attributes inherited from gui2::dialogs::plugin_executor
std::unique_ptr< plugins_contextplugins_context_
 

Additional Inherited Members

- Protected Member Functions inherited from gui2::dialogs::modal_dialog
field_boolregister_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_boolregister_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_integerregister_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_integerregister_integer (const std::string &id, const bool mandatory, int &linked_variable)
 Creates a new integer field. More...
 
field_textregister_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_textregister_text (const std::string &id, const bool mandatory, std::string &linked_variable, const bool capture_focus=false)
 Creates a new text field. More...
 
field_labelregister_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_labelregister_image (const std::string &id, const bool mandatory, const std::string &filename)
 Registers a new styled_widget as image. More...
 
- Protected Attributes inherited from gui2::dialogs::modal_dialog
std::unique_ptr< windowwindow_
 The window object build for this dialog. More...
 

Detailed Description

Definition at line 42 of file mp_create_game.hpp.

Member Typedef Documentation

◆ level_type_info

typedef std::pair<ng::level::TYPE, std::string> gui2::dialogs::mp_create_game::level_type_info
private

Definition at line 44 of file mp_create_game.hpp.

Member Enumeration Documentation

◆ tab

Enumerator
TAB_GENERAL 
TAB_OPTIONS 
TAB_SETTINGS 

Definition at line 152 of file mp_create_game.hpp.

Constructor & Destructor Documentation

◆ mp_create_game()

gui2::dialogs::mp_create_game::mp_create_game ( const config cfg,
saved_game state,
bool  local_mode,
mp::user_info host_info = nullptr 
)

Definition at line 69 of file mp_create_game.cpp.

References _(), and ng::depcheck::SCENARIO.

Member Function Documentation

◆ convert_to_game_filtered_index()

int gui2::dialogs::mp_create_game::convert_to_game_filtered_index ( const unsigned int  initial_index)
private

◆ dialog_exit_hook()

bool gui2::dialogs::mp_create_game::dialog_exit_hook ( window )
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 832 of file mp_create_game.cpp.

References _(), create_engine_, ng::create_engine::current_level_has_side_data(), ng::create_engine::is_campaign(), ng::create_engine::select_campaign_difficulty(), and gui2::show_transient_error_message().

Referenced by pre_show().

◆ display_games_of_type()

void gui2::dialogs::mp_create_game::display_games_of_type ( window window,
ng::level::TYPE  type,
const std::string &  level 
)
private

◆ get_active_mods()

std::vector< std::string > gui2::dialogs::mp_create_game::get_active_mods ( )
private

◆ load_game_callback()

void gui2::dialogs::mp_create_game::load_game_callback ( window window)
private

◆ on_era_select()

void gui2::dialogs::mp_create_game::on_era_select ( window window)
private

◆ on_filter_change()

template<typename widget >
void gui2::dialogs::mp_create_game::on_filter_change ( window window,
const std::string &  id,
bool  do_select 
)
private

◆ on_game_select()

void gui2::dialogs::mp_create_game::on_game_select ( window window)
private

◆ on_mod_toggle()

void gui2::dialogs::mp_create_game::on_mod_toggle ( window window,
const int  index,
toggle_button sender 
)
private

◆ on_random_faction_mode_select()

void gui2::dialogs::mp_create_game::on_random_faction_mode_select ( window window)
private

Definition at line 580 of file mp_create_game.cpp.

References selected_rfm_index_.

Referenced by pre_show().

◆ on_tab_select()

void gui2::dialogs::mp_create_game::on_tab_select ( window window)
private

Definition at line 549 of file mp_create_game.cpp.

References i.

Referenced by pre_show().

◆ post_show()

void gui2::dialogs::mp_create_game::post_show ( window window)
overrideprivatevirtual

Inherited from modal_dialog.

Reimplemented from gui2::dialogs::modal_dialog.

Definition at line 846 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(), ng::create_engine::get_parameters(), gui2::dialogs::modal_dialog::get_retval(), ng::create_engine::get_state(), 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(), name(), 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(), registered_users_, reservoir_, rfm_types_, ng::depcheck::SCENARIO, 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(), 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_.

◆ pre_show()

void gui2::dialogs::mp_create_game::pre_show ( window window)
overrideprivatevirtual

Inherited from modal_dialog.

Reimplemented from gui2::dialogs::modal_dialog.

Definition at line 131 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, cfg_, 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(), translation::dsgettext(), ng::create_engine::ERA, preferences::era(), eras_menu_button_, error(), experience_, gui2::event::find(), 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(), ng::create_engine::get_extras_by_type(), gui2::listbox::get_item_count(), gold_, host_info_, 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(), 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_, preferences::random_faction_mode(), regenerate_random_map(), mp::user_info::registered, registered_users_, reservoir_, rfm_types_, ng::depcheck::SCENARIO, 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(), strict_sync_, support_, turn_bonus_, preferences::turns(), turns_, UPDATE_ATTRIBUTE, update_games_list(), w, and gui2::field_base::widget_set_enabled().

◆ regenerate_random_map()

void gui2::dialogs::mp_create_game::regenerate_random_map ( window window)
private

◆ set_active_mods()

void gui2::dialogs::mp_create_game::set_active_mods ( const std::vector< std::string > &  val)
private

◆ show_description()

void gui2::dialogs::mp_create_game::show_description ( window window,
const std::string &  new_description 
)
private

◆ show_generator_settings()

void gui2::dialogs::mp_create_game::show_generator_settings ( window window)
private

◆ sync_with_depcheck()

void gui2::dialogs::mp_create_game::sync_with_depcheck ( window window)
private

◆ update_details()

void gui2::dialogs::mp_create_game::update_details ( window window)
private

◆ update_games_list()

void gui2::dialogs::mp_create_game::update_games_list ( window window)
private

◆ update_map_settings()

void gui2::dialogs::mp_create_game::update_map_settings ( )
private

◆ window_id()

virtual const std::string& gui2::dialogs::mp_create_game::window_id ( ) const
overrideprivatevirtual

Inherited from modal_dialog, implemented by REGISTER_DIALOG.

Implements gui2::dialogs::modal_dialog.

Member Data Documentation

◆ action_bonus_

field_integer* gui2::dialogs::mp_create_game::action_bonus_
private

Definition at line 113 of file mp_create_game.hpp.

Referenced by post_show(), pre_show(), and update_map_settings().

◆ cfg_

const config& gui2::dialogs::mp_create_game::cfg_
private

Definition at line 59 of file mp_create_game.hpp.

Referenced by load_game_callback(), and pre_show().

◆ config_engine_

std::unique_ptr<ng::configure_engine> gui2::dialogs::mp_create_game::config_engine_
private

Definition at line 62 of file mp_create_game.hpp.

Referenced by post_show(), pre_show(), update_details(), and update_map_settings().

◆ create_engine_

ng::create_engine gui2::dialogs::mp_create_game::create_engine_
private

◆ eras_menu_button_

menu_button* gui2::dialogs::mp_create_game::eras_menu_button_
private

Definition at line 116 of file mp_create_game.hpp.

Referenced by on_era_select(), on_game_select(), pre_show(), and sync_with_depcheck().

◆ experience_

field_integer* gui2::dialogs::mp_create_game::experience_
private

Definition at line 109 of file mp_create_game.hpp.

Referenced by post_show(), pre_show(), and update_map_settings().

◆ fog_

field_bool* gui2::dialogs::mp_create_game::fog_
private

Definition at line 97 of file mp_create_game.hpp.

Referenced by post_show(), and update_map_settings().

◆ gold_

field_integer* gui2::dialogs::mp_create_game::gold_
private

Definition at line 107 of file mp_create_game.hpp.

Referenced by post_show(), pre_show(), and update_map_settings().

◆ host_info_

mp::user_info* gui2::dialogs::mp_create_game::host_info_
private

Definition at line 120 of file mp_create_game.hpp.

Referenced by pre_show().

◆ init_turn_limit_

field_integer* gui2::dialogs::mp_create_game::init_turn_limit_
private

Definition at line 110 of file mp_create_game.hpp.

Referenced by post_show(), pre_show(), and update_map_settings().

◆ level_types_

std::vector<level_type_info> gui2::dialogs::mp_create_game::level_types_
private

Definition at line 68 of file mp_create_game.hpp.

Referenced by pre_show(), sync_with_depcheck(), and update_games_list().

◆ local_mode_

bool gui2::dialogs::mp_create_game::local_mode_
private

Definition at line 118 of file mp_create_game.hpp.

Referenced by pre_show().

◆ mod_list_

listbox* gui2::dialogs::mp_create_game::mod_list_
private

Definition at line 115 of file mp_create_game.hpp.

Referenced by get_active_mods(), pre_show(), and set_active_mods().

◆ observers_

field_bool* gui2::dialogs::mp_create_game::observers_
private

Definition at line 102 of file mp_create_game.hpp.

Referenced by post_show(), and pre_show().

◆ options_manager_

std::unique_ptr<mp_options_helper> gui2::dialogs::mp_create_game::options_manager_
private

Definition at line 63 of file mp_create_game.hpp.

Referenced by on_era_select(), on_game_select(), on_mod_toggle(), post_show(), and pre_show().

◆ registered_users_

field_bool* gui2::dialogs::mp_create_game::registered_users_
private

Definition at line 103 of file mp_create_game.hpp.

Referenced by post_show(), and pre_show().

◆ reservoir_

field_integer* gui2::dialogs::mp_create_game::reservoir_
private

Definition at line 112 of file mp_create_game.hpp.

Referenced by post_show(), pre_show(), and update_map_settings().

◆ rfm_types_

std::vector<mp_game_settings::RANDOM_FACTION_MODE> gui2::dialogs::mp_create_game::rfm_types_
private

Definition at line 83 of file mp_create_game.hpp.

Referenced by post_show(), and pre_show().

◆ selected_game_index_

int gui2::dialogs::mp_create_game::selected_game_index_
private

◆ selected_rfm_index_

int gui2::dialogs::mp_create_game::selected_rfm_index_
private

Definition at line 66 of file mp_create_game.hpp.

Referenced by on_random_faction_mode_select(), and post_show().

◆ shroud_

field_bool* gui2::dialogs::mp_create_game::shroud_
private

Definition at line 98 of file mp_create_game.hpp.

Referenced by post_show(), and update_map_settings().

◆ shuffle_sides_

field_bool* gui2::dialogs::mp_create_game::shuffle_sides_
private

Definition at line 101 of file mp_create_game.hpp.

Referenced by post_show().

◆ start_time_

field_bool* gui2::dialogs::mp_create_game::start_time_
private

Definition at line 99 of file mp_create_game.hpp.

Referenced by post_show(), and update_map_settings().

◆ strict_sync_

field_bool* gui2::dialogs::mp_create_game::strict_sync_
private

Definition at line 104 of file mp_create_game.hpp.

Referenced by post_show(), and pre_show().

◆ support_

field_integer* gui2::dialogs::mp_create_game::support_
private

Definition at line 108 of file mp_create_game.hpp.

Referenced by post_show(), pre_show(), and update_map_settings().

◆ time_limit_

field_bool* gui2::dialogs::mp_create_game::time_limit_
private

Definition at line 100 of file mp_create_game.hpp.

Referenced by post_show(), and update_map_settings().

◆ turn_bonus_

field_integer* gui2::dialogs::mp_create_game::turn_bonus_
private

Definition at line 111 of file mp_create_game.hpp.

Referenced by post_show(), pre_show(), and update_map_settings().

◆ turns_

field_integer* gui2::dialogs::mp_create_game::turns_
private

Definition at line 106 of file mp_create_game.hpp.

Referenced by post_show(), pre_show(), and update_map_settings().

◆ use_map_settings_

field_bool* gui2::dialogs::mp_create_game::use_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 96 of file mp_create_game.hpp.

Referenced by post_show(), and update_map_settings().


The documentation for this class was generated from the following files: