The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
multiplayer.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2005 - 2017 Philippe Plantier <ayin@anathas.org>
3  Part of the Battle for Wesnoth Project http://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;
23 class CVideo;
25 namespace mp {
26 
27 // max. length of a player name
28 const size_t max_login_size = 20;
29 
30 /*
31  * This is the main entry points of multiplayer mode.
32  */
33 
34 /** Starts a multiplayer game in single-user mode.
35  *
36  * @param video The global display
37  * @param game_config The global, top-level WML configuration for the game
38  */
39 void start_local_game(CVideo& video, const config& game_config,
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 video The global display
53  * @param game_config The global, top-level WML configuration for the game
54  * @param host The host to connect to.
55  */
56 void start_client(CVideo& video, const config& game_config,
57  saved_game& state, const std::string& host);
58 
59 /**
60  * Opens mp::connect screen and sets game state according to the
61  * changes made.
62  */
63 bool goto_mp_connect(CVideo& video, ng::connect_engine& engine,
64  const config& game_config, wesnothd_connection* connection);
65 
66 /**
67  * Opens mp::wait screen and sets game state according to the
68  * changes made.
69  */
70 bool goto_mp_wait(CVideo& video, saved_game& state, const config& game_config, wesnothd_connection* connection, bool observe);
71 
72 }
std::vector< char_t > string
void start_client(CVideo &video, const config &game_config, saved_game &state, const std::string &host)
Starts a multiplayer game in client mode.
Definition: video.hpp:29
bool goto_mp_connect(CVideo &video, ng::connect_engine &engine, const config &game_config, wesnothd_connection *connection)
Opens mp::connect screen and sets game state according to the changes made.
bool goto_mp_wait(CVideo &video, saved_game &state, const config &game_config, wesnothd_connection *connection, bool observe)
Opens mp::wait screen and sets game state according to the changes made.
Pubic entry points for the MP workflow.
Definition: lobby_data.cpp:48
A class that represents a TCP/IP connection to the wesnothd server.
const size_t max_login_size
Definition: multiplayer.hpp:28
Game configuration data as global variables.
Definition: build_info.cpp:53
void start_local_game_commandline(CVideo &video, const config &game_config, saved_game &state, const commandline_options &cmdline_opts)
Starts a multiplayer game in single-user mode.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:93
void start_local_game(CVideo &video, const config &game_config, saved_game &state)
Starts a multiplayer game in single-user mode.