The Battle for Wesnoth  1.15.5+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 "commandline_options.hpp"
18 #include "connect_engine.hpp"
19 #include "mp_game_settings.hpp"
21 
22 class config;
24 class game_config_view;
25 
26 namespace mp {
27 
28 // max. length of a player name
29 const std::size_t max_login_size = 20;
30 
31 /*
32  * This is the main entry points of multiplayer mode.
33  */
34 
35 /** Starts a multiplayer game in single-user mode.
36  *
37  * @param game_config The global, top-level WML configuration for the game
38  */
40  saved_game& state);
41 
42 /** Starts a multiplayer game in single-user mode.
43  *
44  * Same parameters as start_local_game plus:
45  * cmdline_opts The commandline options
46  */
48  saved_game& state, const commandline_options& cmdline_opts);
49 
50 /** Starts a multiplayer game in client mode.
51  *
52  * @param game_config The global, top-level WML configuration for the game
53  * @param host The host to connect to.
54  */
56  saved_game& state, const std::string& host);
57 
58 /**
59  * Opens mp::connect screen and sets game state according to the
60  * changes made.
61  */
62 bool goto_mp_connect(ng::connect_engine& engine, wesnothd_connection* connection);
63 
64 /**
65  * Opens mp::wait screen and sets game state according to the
66  * changes made.
67  */
68 bool goto_mp_wait(saved_game& state, wesnothd_connection* connection, bool observe);
69 
70 }
const std::size_t max_login_size
Definition: multiplayer.hpp:29
Pubic entry points for the MP workflow.
Definition: lobby_data.cpp:51
A class that represents a TCP/IP connection to the wesnothd server.
void start_local_game_commandline(const game_config_view &game_config, saved_game &state, const commandline_options &cmdline_opts)
Starts a multiplayer game in single-user mode.
Game configuration data as global variables.
Definition: build_info.cpp:55
void start_client(const game_config_view &game_config, saved_game &state, const std::string &host)
Starts a multiplayer game in client mode.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:68
bool goto_mp_wait(saved_game &state, wesnothd_connection *connection, bool observe)
Opens mp::wait screen and sets game state according to the changes made.
void start_local_game(const game_config_view &game_config, saved_game &state)
Starts a multiplayer game in single-user mode.
bool goto_mp_connect(ng::connect_engine &engine, wesnothd_connection *connection)
Opens mp::connect screen and sets game state according to the changes made.