#include <mp_join_game.hpp>
Public Member Functions | |
mp_join_game (saved_game &state, wesnothd_connection &connection, const bool first_scenario=true, const bool observe_game=false) | |
~mp_join_game () | |
bool | fetch_game_config () |
bool | started () const |
![]() | |
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 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... | |
bool | show_flg_select (int side_num, bool first_time=false) |
void | generate_side_list () |
void | close_faction_select_dialog_if_open () |
Will close the Faction Select dialog if it's open. More... | |
void | network_handler () |
config & | get_scenario () |
![]() | |
plugin_executor () | |
~plugin_executor () | |
Private Attributes | |
config | level_ |
saved_game & | state_ |
wesnothd_connection & | network_connection_ |
std::size_t | update_timer_ |
const bool | first_scenario_ |
bool | observe_game_ |
bool | stop_updates_ |
std::map< std::string, tree_view_node * > | team_tree_map_ |
std::unique_ptr< player_list_helper > | player_list_ |
faction_select * | flg_dialog_ |
![]() | |
std::unique_ptr< plugins_context > | plugins_context_ |
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 33 of file mp_join_game.hpp.
gui2::dialogs::mp_join_game::mp_join_game | ( | saved_game & | state, |
wesnothd_connection & | connection, | ||
const bool | first_scenario = true , |
||
const bool | observe_game = false |
||
) |
Definition at line 63 of file mp_join_game.cpp.
gui2::dialogs::mp_join_game::~mp_join_game | ( | ) |
Definition at line 77 of file mp_join_game.cpp.
References gui2::remove_timer(), and update_timer_.
|
private |
Will close the Faction Select dialog if it's open.
This is used in network_handler to dismiss the dialog if certain actions occur, such as the game starting.
Definition at line 487 of file mp_join_game.cpp.
References gui2::CANCEL, flg_dialog_, gui2::dialogs::modal_dialog::get_window(), and w.
Referenced by network_handler(), and started().
bool gui2::dialogs::mp_join_game::fetch_game_config | ( | ) |
Definition at line 88 of file mp_join_game.cpp.
References game_config::add_color_info(), config::child(), config::child_range(), saved_game::classification(), saved_game::clear(), gui2::dialogs::loading_screen::display(), download_level_data, lg::err(), first_scenario_, game_config_manager::get(), get_scenario(), saved_game::get_scenario_id(), config::has_attribute(), utf8::index(), level_, mp::level_to_gamestate(), game_config_manager::load_game_config_for_game(), preferences::login(), network_connection_, next_scenario, observe_game_, gui2::dialogs::loading_screen::progress(), mp::send_to_server(), show_flg_select(), state_, config::swap(), wesnothd_connection::wait_and_receive_data(), and game_config_view::wrap().
|
private |
Definition at line 347 of file mp_join_game.cpp.
References _(), gui2::tree_view::add_node(), gui2::tree_view_node::add_sibling(), config::child_range(), gui2::tree_view::clear(), gui2::event::connect_signal_mouse_left_click(), unit_type_data::find(), unit_type::flag_rgb(), t_string::from_serialized(), gui2::dialogs::generate_user_description(), gui2::tree_view_node::get_grid(), font::get_pango_color_from_id(), get_scenario(), gui2::dialogs::modal_dialog::get_window(), gui2::widget::hidden, unit_type::image(), gui2::widget::invisible, preferences::login(), ng::random_enemy_picture(), show_flg_select(), stop_updates_, team_tree_map_, unit_type::type_name(), and unit_types.
Referenced by network_handler(), pre_show(), and started().
|
private |
Definition at line 562 of file mp_join_game.cpp.
References config::child(), and level_.
Referenced by fetch_game_config(), generate_side_list(), network_handler(), pre_show(), show_flg_select(), and started().
|
private |
Definition at line 496 of file mp_join_game.cpp.
References _(), config::apply_diff(), c, gui2::CANCEL, config::child(), config::child_range(), close_faction_select_dialog_if_open(), ERR_MP, config::find_child(), first_scenario_, flg_dialog_, generate_side_list(), get_scenario(), gui2::dialogs::faction_select::get_side_num(), gui2::dialogs::modal_dialog::get_window(), config::has_child(), level_, network_connection_, gui2::OK, player_list_, wesnothd_connection::receive_data(), gui2::dialogs::modal_dialog::set_retval(), gui2::show_transient_message(), and stop_updates_.
Referenced by pre_show(), and started().
|
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 573 of file mp_join_game.cpp.
References config::child(), statistics::fresh_stats(), mp::ui_alerts::game_has_begun(), gui2::window::get_retval(), level_, mp::level_to_gamestate(), preferences::login(), observe_game_, gui2::OK, statistics::read_stats(), gui2::remove_timer(), mp::send_to_server(), state_, and update_timer_.
Referenced by started().
|
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 237 of file mp_join_game.cpp.
References gui2::chatbox::active_window_changed(), gui2::add_timer(), gui2::CANCEL, config::child(), default_chat_log, generate_side_list(), get_scenario(), level_, gui2::chatbox::load_log(), game_config::lobby_network_timer, N_, network_handler(), gui2::OK, player_list_, gui2::dialogs::plugin_executor::plugins_context_, gui2::chatbox::room_window_open(), gui2::chatbox::send_chat_message(), gui2::window::set_enter_disabled(), gui2::window::set_escape_disabled(), gui2::styled_widget::set_label(), font::unicode_em_dash, and update_timer_.
Referenced by started().
|
private |
Definition at line 283 of file mp_join_game.cpp.
References config::add_child(), config::child(), config::child_range(), saved_game::classification(), ng::flg_manager::current_faction(), ng::flg_manager::current_gender(), ng::flg_manager::current_leader(), preferences::era(), ERR_MP, flg_dialog_, string_enums::enum_base< T >::get_enum(), get_scenario(), game_classification::is_normal_mp_game(), level_, preferences::login(), ON_SCOPE_EXIT, mp::send_to_server(), gui2::dialogs::modal_dialog::show(), state_, preferences::use_map_settings(), and WRN_MP.
Referenced by fetch_game_config(), generate_side_list(), and started().
|
inline |
Definition at line 42 of file mp_join_game.hpp.
References close_faction_select_dialog_if_open(), generate_side_list(), get_scenario(), level_, network_handler(), post_show(), pre_show(), show_flg_select(), and window_id().
|
overrideprivatevirtual |
|
private |
Definition at line 78 of file mp_join_game.hpp.
Referenced by fetch_game_config(), and network_handler().
|
private |
Definition at line 87 of file mp_join_game.hpp.
Referenced by close_faction_select_dialog_if_open(), network_handler(), and show_flg_select().
|
private |
Definition at line 70 of file mp_join_game.hpp.
Referenced by fetch_game_config(), get_scenario(), network_handler(), post_show(), pre_show(), show_flg_select(), and started().
|
private |
Definition at line 74 of file mp_join_game.hpp.
Referenced by fetch_game_config(), and network_handler().
|
private |
Definition at line 80 of file mp_join_game.hpp.
Referenced by fetch_game_config(), and post_show().
|
private |
Definition at line 85 of file mp_join_game.hpp.
Referenced by network_handler(), and pre_show().
|
private |
Definition at line 72 of file mp_join_game.hpp.
Referenced by fetch_game_config(), post_show(), and show_flg_select().
|
private |
Definition at line 81 of file mp_join_game.hpp.
Referenced by generate_side_list(), and network_handler().
|
private |
Definition at line 83 of file mp_join_game.hpp.
Referenced by generate_side_list().
|
private |
Definition at line 76 of file mp_join_game.hpp.
Referenced by post_show(), pre_show(), and ~mp_join_game().