Main entry points of multiplayer mode. More...
Namespaces | |
ui_alerts | |
This namespace provides handlers which play the sounds / notifications for various mp server events, depending on the preference configuration. | |
Classes | |
struct | user_info |
This class represents the information a client has about another player. More... | |
struct | game_info |
This class represents the info a client has about a game on the server. More... | |
class | lobby_info |
This class represents the collective information the client has about the players and games on the server. More... | |
class | network_registrar |
RAII helper class to register a network handler. More... | |
Enumerations | |
enum class | notify_mode { none , message , message_other_window , server_message , own_nick , friend_message , whisper , whisper_other_window , lobby_join , lobby_quit , game_created } |
Functions | |
void | do_notify (notify_mode mode, const std::string &sender, const std::string &message) |
static void | add_multiplayer_classification (config &multiplayer, saved_game &state) |
config | initial_level_config (saved_game &state) |
void | level_to_gamestate (const config &level, saved_game &state) |
void | start_client (const std::string &host) |
Pubic entry points for the MP workflow. More... | |
void | start_local_game () |
Starts a multiplayer game in single-user mode. More... | |
void | start_local_game_commandline (const commandline_options &cmdline_opts) |
Starts a multiplayer game in single-user mode using command line settings. More... | |
bool | goto_mp_staging (ng::connect_engine &engine) |
Opens the MP Staging screen and sets the game state according to the changes made. More... | |
bool | goto_mp_wait (bool observe) |
Opens the MP Join Game screen and sets the game state according to the changes made. More... | |
bool | logged_in_as_moderator () |
Gets whether the currently logged-in user is a moderator. More... | |
std::string | get_profile_link (int user_id) |
Gets the forum profile link for the given user. More... | |
void | send_to_server (const config &data) |
Attempts to send given data to server if a connection is open. More... | |
lobby_info * | get_lobby_info () |
Returns the lobby_info object for the given session. More... | |
Variables | |
const std::size_t | max_login_size = 20 |
Max length of a player name. More... | |
Main entry points of multiplayer mode.
|
strong |
Enumerator | |
---|---|
none | |
message | |
message_other_window | |
server_message | |
own_nick | |
friend_message | |
whisper | |
whisper_other_window | |
lobby_join | |
lobby_quit | |
game_created |
Definition at line 154 of file lobby_info.hpp.
|
static |
Definition at line 42 of file mp_game_utils.cpp.
References game_classification::active_mods, game_classification::campaign, game_classification::campaign_name, saved_game::classification(), game_classification::difficulty, game_classification::era_id, saved_game::get_scenario_id(), saved_game::get_starting_point(), and utils::join().
Referenced by initial_level_config().
void mp::do_notify | ( | notify_mode | mode, |
const std::string & | sender, | ||
const std::string & | message | ||
) |
Definition at line 56 of file lobby_info.cpp.
References friend_message, mp::ui_alerts::friend_message(), game_created, mp::ui_alerts::game_created(), lobby_join, lobby_quit, message, own_nick, mp::ui_alerts::player_joins(), mp::ui_alerts::player_leaves(), mp::ui_alerts::private_message(), mp::ui_alerts::public_message(), server_message, mp::ui_alerts::server_message(), whisper, and whisper_other_window.
Referenced by gui2::chatbox::add_chat_room_message_received(), gui2::chatbox::add_whisper_received(), gui2::dialogs::mp_lobby::process_gamelist_diff(), and gui2::dialogs::mp_lobby::update_gamelist_diff().
class lobby_info * mp::get_lobby_info | ( | ) |
Returns the lobby_info object for the given session.
Definition at line 849 of file multiplayer.cpp.
References mp::lobby_info::lobby_info().
Referenced by gui2::chatbox::chat_input_keypress_callback().
std::string mp::get_profile_link | ( | int | user_id | ) |
Gets the forum profile link for the given user.
Definition at line 815 of file multiplayer.cpp.
Referenced by gui2::dialogs::mp_lobby::open_profile_url().
bool mp::goto_mp_staging | ( | ng::connect_engine & | engine | ) |
Opens the MP Staging screen and sets the game state according to the changes made.
Meant to be used between scenarios in a campaign.
engine | A connect_engine instance to pass to MP Staging. |
Definition at line 800 of file multiplayer.cpp.
Referenced by campaign_controller::play_game().
bool mp::goto_mp_wait | ( | bool | observe | ) |
Opens the MP Join Game screen and sets the game state according to the changes made.
Meant to be used between scenarios in a campaign.
observe | Whether entering as an observer or player. |
Definition at line 805 of file multiplayer.cpp.
Referenced by campaign_controller::play_game().
config mp::initial_level_config | ( | saved_game & | state | ) |
[era] and [modification]s are toplevel tags here. They are not part of the saved_game and are only used during mp_staging/mp_join_game.
– vultraz, 2017-11-24
Definition at line 53 of file mp_game_utils.cpp.
References game_classification::active_mods, add_multiplayer_classification(), saved_game::classification(), game_classification::era_id, saved_game::expand_mp_events(), saved_game::expand_mp_options(), saved_game::expand_random_scenario(), game_config_manager::game_config(), game_config_manager::get(), saved_game::get_starting_point(), i, game_config::images::level, saved_game::mp_settings(), N_, mp_game_settings::saved_game, saved_game::set_defaults(), saved_game::set_random_seed(), markup::span_color(), version_info::str(), markup::tag(), saved_game::to_config(), font::unicode_bullet, saved_game::valid(), VGETTEXT, game_config::wesnoth_version, and WRN_CF.
Referenced by ng::connect_engine::connect_engine().
void mp::level_to_gamestate | ( | const config & | level, |
saved_game & | state | ||
) |
Definition at line 131 of file mp_game_utils.cpp.
References saved_game::classification(), game_config::images::level, and game_classification::type.
Referenced by gui2::dialogs::mp_join_game::fetch_game_config(), gui2::dialogs::mp_join_game::post_show(), ng::connect_engine::start_game(), and ng::connect_engine::start_game_commandline().
bool mp::logged_in_as_moderator | ( | ) |
Gets whether the currently logged-in user is a moderator.
Definition at line 810 of file multiplayer.cpp.
Referenced by mp::game_info::can_observe(), gui2::dialogs::mp_lobby::enter_game(), events::console_handler::is_enabled(), events::chat_command_handler::is_enabled(), and gui2::dialogs::lobby_player_info::pre_show().
void mp::send_to_server | ( | const config & | data | ) |
Attempts to send given data to server if a connection is open.
Definition at line 828 of file multiplayer.cpp.
References data.
Referenced by gui2::dialogs::mp_lobby::enter_game(), gui2::dialogs::mp_join_game::fetch_game_config(), ng::connect_engine::leave_game(), gui2::dialogs::mp_join_game::post_show(), ng::connect_engine::process_network_data(), gui2::dialogs::mp_lobby::refresh_lobby(), ng::connect_engine::send_level_data(), gui2::chatbox::send_to_server(), gui2::dialogs::mp_join_game::show_flg_select(), ng::connect_engine::start_game(), ng::connect_engine::start_game_commandline(), and ng::connect_engine::update_and_send_diff().
void mp::start_client | ( | const std::string & | host | ) |
Pubic entry points for the MP workflow.
Starts a multiplayer game in client mode.
host | The host to connect to. |
Definition at line 681 of file multiplayer.cpp.
References DBG_MP.
Referenced by game_launcher::play_multiplayer().
void mp::start_local_game | ( | ) |
Starts a multiplayer game in single-user mode.
Definition at line 687 of file multiplayer.cpp.
References DBG_MP, prefs::get(), and prefs::set_message_private().
Referenced by game_launcher::play_multiplayer().
void mp::start_local_game_commandline | ( | const commandline_options & | cmdline_opts | ) |
Starts a multiplayer game in single-user mode using command line settings.
cmdline_opts | The commandline options. |
Definition at line 696 of file multiplayer.cpp.
References replay::add_log_data(), saved_game::classification(), DBG_MP, game_classification::era_define, game_classification::era_id, saved_game::expand_mp_events(), saved_game::expand_mp_options(), saved_game::expand_random_scenario(), game_config_manager::game_config(), game_config_manager::get(), prefs::get(), saved_game::get_scenario_id(), saved_game::get_starting_point(), settings::get_turns(), settings::get_village_gold(), settings::get_village_support(), settings::get_xp_modifier(), config::has_attribute(), i, label, game_config_manager::load_game_config_for_game(), saved_game::mp_settings(), commandline_options::multiplayer_era, commandline_options::multiplayer_ignore_map_settings, commandline_options::multiplayer_label, commandline_options::multiplayer_repeat, commandline_options::multiplayer_scenario, mp_game_settings::name, mp_game_settings::num_turns, PLAIN_LOG, resources::recorder, game_classification::scenario_define, saved_game::set_carryover_sides_start(), prefs::set_message_private(), ng::connect_engine::start_game_commandline(), game_classification::type, mp_game_settings::use_map_settings, mp_game_settings::village_gold, mp_game_settings::village_support, and mp_game_settings::xp_modifier.
Referenced by game_launcher::play_multiplayer_commandline().
const std::size_t mp::max_login_size = 20 |
Max length of a player name.
Definition at line 30 of file multiplayer.hpp.
Referenced by gui2::dialogs::mp_method_selection::pre_show().