The Battle for Wesnoth  1.17.0-dev
multiplayer.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2005 - 2018 Philippe Plantier <ayin@anathas.org>
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #pragma once
16 
17 #include <string>
18 
20 class config;
21 
22 namespace ng { class connect_engine; }
23 
24 /** Main entry points of multiplayer mode. */
25 namespace mp
26 {
27 /** Max length of a player name. */
28 const std::size_t max_login_size = 20;
29 
30 /**
31  * Starts a multiplayer game in client mode.
32  *
33  * @param host The host to connect to.
34  */
35 void start_client(const std::string& host);
36 
37 /** Starts a multiplayer game in single-user mode. */
38 void start_local_game();
39 
40 /**
41  * Starts a multiplayer game in single-user mode using command line settings.
42  *
43  * @param cmdline_opts The commandline options.
44  */
45 void start_local_game_commandline(const commandline_options& cmdline_opts);
46 
47 /**
48  * Opens the MP Staging screen and sets the game state according to the changes made.
49  * Meant to be used between scenarios in a campaign.
50  *
51  * @param engine A connect_engine instance to pass to MP Staging.
52  */
54 
55 /**
56  * Opens the MP Join Game screen and sets the game state according to the changes made.
57  * Meant to be used between scenarios in a campaign.
58  *
59  * @param observe Whether entering as an observer or player.
60  */
61 bool goto_mp_wait(bool observe);
62 
63 /** Gets whether the currently logged-in user is a moderator. */
65 
66 /** Gets the forum profile link for the given user. */
67 std::string get_profile_link(int user_id);
68 
69 }
const std::size_t max_login_size
Max length of a player name.
Definition: multiplayer.hpp:28
bool goto_mp_wait(bool observe)
Opens the MP Join Game screen and sets the game state according to the changes made.
bool logged_in_as_moderator()
Gets whether the currently logged-in user is a moderator.
Main entry points of multiplayer mode.
Definition: lobby_data.cpp:51
std::string get_profile_link(int user_id)
Gets the forum profile link for the given user.
void start_local_game_commandline(const commandline_options &cmdline_opts)
Starts a multiplayer game in single-user mode using command line settings.
bool goto_mp_staging(ng::connect_engine &engine)
Opens the MP Staging screen and sets the game state according to the changes made.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:59
void start_client(const std::string &host)
Pubic entry points for the MP workflow.
void start_local_game()
Starts a multiplayer game in single-user mode.