The Battle for Wesnoth  1.17.4+dev
Namespaces | Classes | Enumerations | Functions | Variables
mp Namespace Reference

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  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...
 
struct  user_info
 This class represents the information a client has about another player. More...
 

Enumerations

enum  notify_mode {
  notify_mode::none, notify_mode::message, notify_mode::message_other_window, notify_mode::server_message,
  notify_mode::own_nick, notify_mode::friend_message, notify_mode::whisper, notify_mode::whisper_other_window,
  notify_mode::lobby_join, notify_mode::lobby_quit, notify_mode::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_infoget_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...
 

Detailed Description

Main entry points of multiplayer mode.

Enumeration Type Documentation

◆ notify_mode

enum mp::notify_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 155 of file lobby_info.hpp.

Function Documentation

◆ add_multiplayer_classification()

static void mp::add_multiplayer_classification ( config multiplayer,
saved_game state 
)
static

◆ do_notify()

void mp::do_notify ( notify_mode  mode,
const std::string &  sender,
const std::string &  message 
)

◆ get_lobby_info()

class lobby_info * mp::get_lobby_info ( )

Returns the lobby_info object for the given session.

Definition at line 866 of file multiplayer.cpp.

References mp::lobby_info::lobby_info().

Referenced by gui2::chatbox::chat_input_keypress_callback().

◆ get_profile_link()

std::string mp::get_profile_link ( int  user_id)

Gets the forum profile link for the given user.

Definition at line 832 of file multiplayer.cpp.

Referenced by gui2::dialogs::mp_lobby::pre_show().

◆ goto_mp_staging()

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.

Parameters
engineA connect_engine instance to pass to MP Staging.

Definition at line 817 of file multiplayer.cpp.

Referenced by campaign_controller::play_game().

◆ goto_mp_wait()

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.

Parameters
observeWhether entering as an observer or player.

Definition at line 822 of file multiplayer.cpp.

Referenced by campaign_controller::play_game().

◆ initial_level_config()

config mp::initial_level_config ( saved_game state)

◆ level_to_gamestate()

void mp::level_to_gamestate ( const config level,
saved_game state 
)

◆ logged_in_as_moderator()

bool mp::logged_in_as_moderator ( )

◆ send_to_server()

void mp::send_to_server ( const config data)

◆ start_client()

void mp::start_client ( const std::string &  host)

Pubic entry points for the MP workflow.

Starts a multiplayer game in client mode.

Parameters
hostThe host to connect to.

Definition at line 696 of file multiplayer.cpp.

References DBG_MP.

Referenced by game_launcher::play_multiplayer().

◆ start_local_game()

void mp::start_local_game ( )

Starts a multiplayer game in single-user mode.

Definition at line 702 of file multiplayer.cpp.

References DBG_MP, and preferences::set_message_private().

Referenced by game_launcher::play_multiplayer().

◆ start_local_game_commandline()

void mp::start_local_game_commandline ( const commandline_options cmdline_opts)

Starts a multiplayer game in single-user mode using command line settings.

Parameters
cmdline_optsThe commandline options.

Definition at line 711 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_view::find_child(), statistics::fresh_stats(), game_config_manager::game_config(), game_config_manager::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(), 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, campaign_controller::play_game(), resources::recorder, game_classification::scenario_define, saved_game::set_carryover_sides_start(), preferences::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().

Variable Documentation

◆ max_login_size

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().