The Battle for Wesnoth  1.17.17+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  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_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 845 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 811 of file multiplayer.cpp.

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

◆ 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 796 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 801 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 677 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 683 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)

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