The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
game.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2016 by David White <[email protected]>
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 #ifndef GAME_HPP_INCLUDED
16 #define GAME_HPP_INCLUDED
17 
18 #include "player_connection.hpp"
19 #include "player.hpp"
20 
21 #include "simple_wml.hpp"
22 
23 #include <map>
24 #include <vector>
25 
26 #include "mt_rng.hpp"
27 #include "utils/make_enum.hpp"
28 
29 #include <boost/ptr_container/ptr_vector.hpp>
30 //class player;
31 
32 namespace wesnothd {
33 
34 typedef std::vector<socket_ptr> user_vector;
35 typedef std::vector<socket_ptr> side_vector;
36 
37 class game
38 {
39 public:
40  MAKE_ENUM(CONTROLLER,
41  (HUMAN, "human")
42  (AI, "ai")
43  (EMPTY, "null")
44  )
45 
47  const std::string& name="", bool save_replays=false,
48  const std::string& replay_save_path="");
49  ~game();
50 
51  int id() const { return id_; }
52  const std::string& name() const { return name_; }
53 
54  bool is_owner(const socket_ptr player) const { return (player == owner_); }
55  bool is_member(const socket_ptr player) const
56  { return is_player(player) || is_observer(player); }
57  bool allow_observers() const;
58  bool registered_users_only() const;
59  bool is_observer(const socket_ptr player) const;
60  bool is_player(const socket_ptr player) const;
61 
62  /** Checks whether the connection's ip address is banned. */
63  bool player_is_banned(const socket_ptr player) const;
64  bool level_init() const { return level_.child("snapshot") || level_.child("scenario"); }
66  {
67  if(simple_wml::node* scenario = data.child("scenario"))
68  return scenario;
69  else if(simple_wml::node* snapshot = data.child("snapshot"))
70  return snapshot;
71  else
72  return &data;
73  }
75  {
76  if(const simple_wml::node* scenario = data.child("scenario"))
77  return scenario;
78  else if(const simple_wml::node* snapshot = data.child("snapshot"))
79  return snapshot;
80  else
81  return &data;
82  }
84  {
85  return starting_pos( level_.root())->children("side");
86  }
87  bool started() const { return started_; }
88 
89  size_t nplayers() const { return players_.size(); }
90  size_t nobservers() const { return observers_.size(); }
91  size_t current_turn() const { return (nsides_ ? end_turn_ / nsides_ + 1 : 0); }
92  void set_current_turn(int turn)
93  {
95  end_turn_ = current_side + nsides_ * ( turn - 1);
96  }
97 
98  void mute_all_observers();
99 
100  /**
101  * Mute an observer or give a message of all currently muted observers if no
102  * name is given.
103  */
104  void mute_observer(const simple_wml::node& mute, const socket_ptr muter);
105 
106  void unmute_observer(const simple_wml::node& unmute, const socket_ptr unmuter);
107 
108  /**
109  * Kick a member by name.
110  *
111  * @return The network handle of the removed member if
112  * successful, null pointer otherwise.
113  */
114  socket_ptr kick_member(const simple_wml::node& kick, const socket_ptr kicker);
115 
116  /**
117  * Ban and kick a user by name.
118  *
119  * The user does not need to be in this game but logged in.
120  *
121  * @return The network handle of the banned player if he
122  * was in this game, null pointer otherwise.
123  */
124  socket_ptr ban_user(const simple_wml::node& ban, const socket_ptr banner);
125 
126  void unban_user(const simple_wml::node& unban, const socket_ptr unbanner);
127 
128  /**
129  * Add a user to the game.
130  *
131  * @return True iff the user successfully joined the game.
132  */
133  bool add_player(const socket_ptr player, bool observer = false);
134 
135  /**
136  * Removes a user from the game.
137  *
138  * @return True iff the game ends. That is, if there are
139  * no more players or the host left on a not yet
140  * started game.
141  */
142  bool remove_player(const socket_ptr player, const bool disconnect=false, const bool destruct=false);
143 
144  /** Adds players and observers into one vector and returns that. */
145  const user_vector all_game_users() const;
146 
147  void start_game(const socket_ptr starter);
148  //this is performed just before starting and before [start_game] signal
149  //send scenario_diff's specific to each client so that they locally
150  //control their human sides
152 
153  void update_game();
154 
155  /** A user (player only?) asks for the next scenario to advance to. */
156  void load_next_scenario(const socket_ptr user); //const
157  // iceiceice: I unmarked this const because I want to send and record server messages when I fail to tweak sides properly
158 
159  /** Resets the side configuration according to the scenario data. */
160  void update_side_data();
161 
162  /** Let's a player owning a side give it to another player or observer. */
163  void transfer_side_control(const socket_ptr sock, const simple_wml::node& cfg);
164 
166 
167  /**
168  * Handles [end_turn], repackages [commands] with private [speak]s in them
169  * and sends the data.
170  * Also filters commands from all but the current player.
171  * Currently removes all commands but [speak] for observers and all but
172  * [speak], [label] and [rename] for players.
173  *
174  * @returns True if the turn ended.
175  */
177 
178  /** Handles incoming [whiteboard] data. */
180  /** Handles incoming [change_turns_wml] data. */
182 
183  /**
184  * Set the description to the number of available slots.
185  *
186  * @returns True iff the number of slots has changed.
187  */
188  bool describe_slots();
189 
190  void send_server_message_to_all(const char* message, socket_ptr exclude=socket_ptr()) const;
191  void send_server_message_to_all(const std::string& message, socket_ptr exclude=socket_ptr()) const
192  {
193  send_server_message_to_all(message.c_str(), exclude);
194  }
195 
196  void send_server_message(const char* message, socket_ptr sock=socket_ptr(), simple_wml::document* doc=nullptr) const;
197  void send_server_message(const std::string& message, socket_ptr sock=socket_ptr(), simple_wml::document* doc=nullptr) const
198  {
199  send_server_message(message.c_str(), sock, doc);
200  }
201 
202  /** Send data to all players in this game except 'exclude'. */
203  void send_and_record_server_message(const char* message, const socket_ptr exclude=socket_ptr());
204  void send_and_record_server_message(const std::string& message, const socket_ptr exclude=socket_ptr())
205  {
206  send_and_record_server_message(message.c_str(), exclude);
207  }
208 
209  void send_data(simple_wml::document& data, const socket_ptr exclude=socket_ptr(), std::string packet_type = "") const;
210 
211  void clear_history();
212  void record_data(simple_wml::document* data);
213  void save_replay();
214 
215  /** The full scenario data. */
217 
218  /**
219  * Functions to set/get the address of the game's summary description as
220  * sent to players in the lobby.
221  */
222  void set_description(simple_wml::node* desc);
224 
225  void set_password(const std::string& passwd) { password_ = passwd; }
226  bool password_matches(const std::string& passwd) const {
227  return password_.empty() || passwd == password_;
228  }
229 
231  static const std::string aborted = "aborted";
232  static const std::string not_started = "not started";
233  return started_ ? (termination_.empty() ? aborted : termination_) : not_started;
234  }
235 
236  void set_termination_reason(const std::string& reason);
237 
238  void handle_choice(const simple_wml::node& data, const socket_ptr user);
239 
240  void handle_random_choice(const simple_wml::node& data);
241 
242  void handle_controller_choice(const simple_wml::node& data);
243 
245  /**
246  * Function which returns true iff 'player' controls any of the sides spcified in 'sides'.
247  */
248  bool controls_side(const std::vector<int>& sides, const socket_ptr player) const;
249 private:
250  //forbidden operations
251  game(const game&);
252  void operator=(const game&);
253 
254  size_t current_side() const { return (nsides_ ? end_turn_ % nsides_ : 0); }
256  { return (nsides_ ? sides_[current_side()] : socket_ptr()); }
258  { return (current_player() == player); }
259  bool is_muted_observer(const socket_ptr player) const;
260  bool all_observers_muted() const { return all_observers_muted_; }
261  void send_muted_observers(const socket_ptr user) const;
262 
263  bool send_taken_side(simple_wml::document& cfg, const simple_wml::node::child_list::const_iterator side) const;
264  /**
265  * Figures out which side to take and tells that side to the game owner.
266  *
267  * The owner then should send a [scenario_diff] that implements the side
268  * change and a subsequent update_side_data() call makes it actually
269  * happen.
270  * First we look for a side where save_id= or current_player= matches the
271  * new user's name then we search for the first controller="network" side.
272  */
273  bool take_side(const socket_ptr user);
274 
275  /**
276  * Send [change_controller] message to tell all clients the new controller's name
277  * or controller type (human or ai).
278  */
279  void change_controller(const size_t side_num,
280  const socket_ptr sock,
281  const std::string& player_name,
282  const bool player_left = true);
283  void transfer_ai_sides(const socket_ptr player);
284  void send_leave_game(socket_ptr user) const;
285  /**
286  @param sides: a comma sperated list of side numbers to which the package should be sent,
287  */
289  const socket_ptr exclude=socket_ptr(), std::string packet_type = "") const;
290  void send_data_observers(simple_wml::document& data, const socket_ptr exclude=socket_ptr(), std::string packet_type = "") const;
291 
292  /**
293  * Send [observer] tags of all the observers in the game to the user or
294  * everyone if none given.
295  */
296  void send_observerjoins(const socket_ptr sock=socket_ptr()) const;
297  void send_observerquit(const socket_ptr observer) const;
298  void send_history(const socket_ptr sock) const;
299 
300  /** In case of a host transfer, notify the new host about its status. */
301  void notify_new_host();
302 
303  /** Shortcut to a convenience function for finding a user by name. */
305 
306  bool observers_can_label() const { return false; }
307  bool observers_can_chat() const { return true; }
308  bool is_legal_command(const simple_wml::node& command, const socket_ptr user);
309 
310  /**
311  * Checks whether a user has the same IP as members of this game.
312  * If observer is true it only checks against players.
313  * @return A comma separated string of members with matching IPs.
314  */
315  std::string has_same_ip(const socket_ptr user, bool observer) const;
316 
317  /**
318  * Function which should be called every time a player ends their turn
319  * (i.e. [end_turn] received). This will update the 'turn' attribute for
320  * the game's description when appropriate. Will return true iff there has
321  * been a change.
322  */
323  bool end_turn();
324 
325  /**
326  * Function to send a list of users to all clients.
327  *
328  * Only sends data if the game is initialized but not yet started.
329  */
330  void send_user_list(const socket_ptr exclude=socket_ptr()) const;
331 
332  /** Returns the name of the user or "(unfound)". */
333  std::string username(const socket_ptr pl) const;
334 
335  /** Returns a comma separated list of user names. */
336  std::string list_users(user_vector users, const std::string& func) const;
337 
338  /** Function to log when we don't find a connection in player_info_. */
339  void missing_user(socket_ptr socket, const std::string& func) const;
340 
341  /** calculates the initial value for sides_, side_controllerds_, nsides_*/
342  void reset_sides();
343  /** Helps debugging player and observer lists. */
345  /** Helps debugging controller tweaks. */
347 
349 
350  static int id_num;
351  int id_;
352 
353  /** The name of the game. */
356 
357  /** The game host or later owner (if the host left). */
359 
360  /** A vector of players (members owning a side). */
361  user_vector players_;
362 
363  /** A vector of observers (members not owning a side). */
364  user_vector observers_;
365  user_vector muted_observers_;
366 
367  /** A vector of side owners. */
368  side_vector sides_;
369 
370  std::vector<CONTROLLER> side_controllers_;
371 
372  /** Number of sides in the current scenario. */
373  int nsides_;
374  bool started_;
375 
376  /**
377  The current scenario data.´
378  WRONG! This contains the initial state or the state from which
379  the game was loaded from.
380  Using this to make assumptions about the current gamestate is
381  extremely dangerous and should especially not be done for anything
382  that can be nodified by wml (especially by [modify_side]),
383  like team_name, controller ... in [side].
384  FIXME: move every code here that uses this object to query those
385  information to the clients. But note that there are some checks
386  (like controller == null) that are definitely needed by the server and
387  in this case we should try to modify the client to inform the server if
388  a change of those properties occur. Ofc we shouldn't update level_
389  then, but rather store that information in a seperate object
390  (like in side_controllers_).
391  */
393 
394  /** Replay data. */
395  typedef boost::ptr_vector<simple_wml::document> t_history;
396  mutable t_history history_;
397 
398  /** Pointer to the game's description in the games_and_users_list_. */
400 
404 
405  std::vector<std::string> bans_;
406 
408 
411 
412  /** A wrapper for mersenne twister rng which generates randomness for this game */
415 };
416 
418  game_is_member(socket_ptr sock) : sock_(sock) {}
419  bool operator()(const game& g) const { return g.is_owner(sock_) || g.is_member(sock_); }
420 
421 private:
423 };
424 
426  game_id_matches(int id) : id_(id) {}
427  bool operator()(const game& g) const { return g.id() == id_; }
428 
429 private:
430  int id_;
431 };
432 }
433 #endif
434 
bool process_turn(simple_wml::document &data, const socket_ptr user)
Handles [end_turn], repackages [commands] with private [speak]s in them and sends the data...
Definition: game.cpp:886
bool player_is_banned(const socket_ptr player) const
Checks whether the connection's ip address is banned.
Definition: game.cpp:630
bool save_replays_
Definition: game.hpp:409
void start_game(const socket_ptr starter)
Definition: game.cpp:271
rand_rng::mt_rng rng_
A wrapper for mersenne twister rng which generates randomness for this game.
Definition: game.hpp:413
bool allow_observers() const
Definition: game.cpp:145
int end_turn_
Definition: game.hpp:401
void set_current_turn(int turn)
Definition: game.hpp:92
bool password_matches(const std::string &passwd) const
Definition: game.hpp:226
void update_game()
Definition: game.cpp:338
std::string debug_sides_info() const
Helps debugging controller tweaks.
Definition: game.cpp:1626
void unmute_observer(const simple_wml::node &unmute, const socket_ptr unmuter)
Definition: game.cpp:696
void send_observerquit(const socket_ptr observer) const
Definition: game.cpp:1463
void save_replay()
Definition: game.cpp:1506
player_connections & player_connections_
Definition: game.hpp:348
const std::string & name() const
Definition: game.hpp:52
void send_server_message(const char *message, socket_ptr sock=socket_ptr(), simple_wml::document *doc=nullptr) const
Definition: game.cpp:1667
void handle_random_choice(const simple_wml::node &data)
Definition: game.cpp:993
void change_controller(const size_t side_num, const socket_ptr sock, const std::string &player_name, const bool player_left=true)
Send [change_controller] message to tell all clients the new controller's name or controller type (hu...
Definition: game.cpp:551
size_t nobservers() const
Definition: game.hpp:90
bool observers_can_label() const
Definition: game.hpp:306
user_vector muted_observers_
Definition: game.hpp:365
void update_side_data()
Resets the side configuration according to the scenario data.
Definition: game.cpp:400
std::vector< socket_ptr > side_vector
Definition: game.hpp:35
socket_ptr const std::string bool save_replays
Definition: game.hpp:47
std::string has_same_ip(const socket_ptr user, bool observer) const
Checks whether a user has the same IP as members of this game.
Definition: game.cpp:1432
bool operator()(const game &g) const
Definition: game.hpp:427
void transfer_side_control(const socket_ptr sock, const simple_wml::node &cfg)
Let's a player owning a side give it to another player or observer.
Definition: game.cpp:464
int nsides_
Number of sides in the current scenario.
Definition: game.hpp:373
user_vector observers_
A vector of observers (members not owning a side).
Definition: game.hpp:364
void process_message(simple_wml::document &data, const socket_ptr user)
Definition: game.cpp:830
const user_vector all_game_users() const
Adds players and observers into one vector and returns that.
Definition: game.cpp:1586
size_t nplayers() const
Definition: game.hpp:89
socket_ptr find_user(const simple_wml::string_span &name)
Shortcut to a convenience function for finding a user by name.
Definition: game.cpp:1642
MAKE_ENUM(CONTROLLER,(HUMAN,"human")(AI,"ai")(EMPTY,"null")) game(player_connections &player_connections
STL namespace.
bool is_member(const socket_ptr player) const
Definition: game.hpp:55
bool all_observers_muted_
Definition: game.hpp:403
size_t current_side() const
Definition: game.hpp:254
bool operator()(const game &g) const
Definition: game.hpp:419
GLboolean GLboolean g
Definition: glew.h:7319
const simple_wml::node::child_list & get_sides_list() const
Definition: game.hpp:83
bool started() const
Definition: game.hpp:87
std::string termination_
Definition: game.hpp:407
socket_ptr host
Definition: game.hpp:46
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
Definition: glew.h:1347
socket_ptr const std::string bool const std::string & replay_save_path
Definition: game.hpp:48
boost::ptr_vector< simple_wml::document > t_history
Replay data.
Definition: game.hpp:395
std::vector< std::string > bans_
Definition: game.hpp:405
bool take_side(const socket_ptr user)
Figures out which side to take and tells that side to the game owner.
Definition: game.cpp:361
bool is_player(const socket_ptr player) const
Definition: game.cpp:168
node * child(const char *name)
Definition: simple_wml.hpp:257
node * child(const char *name)
Definition: simple_wml.cpp:607
socket_ptr kick_member(const simple_wml::node &kick, const socket_ptr kicker)
Kick a member by name.
Definition: game.cpp:736
socket_ptr current_player() const
Definition: game.hpp:255
bool send_taken_side(simple_wml::document &cfg, const simple_wml::node::child_list::const_iterator side) const
Definition: game.cpp:347
void handle_choice(const simple_wml::node &data, const socket_ptr user)
Definition: game.cpp:1059
int last_choice_request_id_
Definition: game.hpp:414
void send_and_record_server_message(const char *message, const socket_ptr exclude=socket_ptr())
Send data to all players in this game except 'exclude'.
Definition: game.cpp:1651
std::string username(const socket_ptr pl) const
Returns the name of the user or "(unfound)".
Definition: game.cpp:187
void reset_sides()
calculates the initial value for sides_, side_controllerds_, nsides_
Definition: game.cpp:391
void send_data(simple_wml::document &data, const socket_ptr exclude=socket_ptr(), std::string packet_type="") const
Definition: game.cpp:1384
std::vector< CONTROLLER > side_controllers_
Definition: game.hpp:370
int num_turns_
Definition: game.hpp:402
simple_wml::node * description() const
Definition: game.hpp:223
const std::string & termination_reason() const
Definition: game.hpp:230
void handle_controller_choice(const simple_wml::node &data)
Definition: game.cpp:1011
bool describe_slots()
Set the description to the number of available slots.
Definition: game.cpp:604
socket_ptr ban_user(const simple_wml::node &ban, const socket_ptr banner)
Ban and kick a user by name.
Definition: game.cpp:767
bool controls_side(const std::vector< int > &sides, const socket_ptr player) const
Function which returns true iff 'player' controls any of the sides spcified in 'sides'.
Definition: game.cpp:1420
bool registered_users_only() const
Definition: game.cpp:149
void missing_user(socket_ptr socket, const std::string &func) const
Function to log when we don't find a connection in player_info_.
Definition: game.cpp:74
bool is_legal_command(const simple_wml::node &command, const socket_ptr user)
Definition: game.cpp:845
void perform_controller_tweaks()
Definition: game.cpp:212
bool add_player(const socket_ptr player, bool observer=false)
Add a user to the game.
Definition: game.cpp:1165
void send_leave_game(socket_ptr user) const
Definition: game.cpp:730
void send_history(const socket_ptr sock) const
Definition: game.cpp:1472
socket_ptr owner_
The game host or later owner (if the host left).
Definition: game.hpp:358
static simple_wml::node * starting_pos(simple_wml::node &data)
Definition: game.hpp:65
bool is_observer(const socket_ptr player) const
Definition: game.cpp:153
bool is_owner(const socket_ptr player) const
Definition: game.hpp:54
static const simple_wml::node * starting_pos(const simple_wml::node &data)
Definition: game.hpp:74
void process_whiteboard(simple_wml::document &data, const socket_ptr user)
Handles incoming [whiteboard] data.
Definition: game.cpp:1093
std::string list_users(user_vector users, const std::string &func) const
Returns a comma separated list of user names.
Definition: game.cpp:197
multi_index_container< player_record, indexed_by< ordered_unique< tag< socket_t >, BOOST_MULTI_INDEX_CONST_MEM_FUN(player_record, const socket_ptr, socket)>, hashed_unique< tag< name_t >, BOOST_MULTI_INDEX_CONST_MEM_FUN(player_record, const std::string &, name)>, ordered_non_unique< tag< game_t >, BOOST_MULTI_INDEX_CONST_MEM_FUN(player_record, int, game_id)> >> player_connections
std::vector< node * > child_list
Definition: simple_wml.hpp:121
game(const game &)
Definition: game.cpp:80
void reset_last_synced_context_id()
Definition: game.hpp:244
void record_data(simple_wml::document *data)
Definition: game.cpp:1558
side_vector sides_
A vector of side owners.
Definition: game.hpp:368
void notify_new_host()
In case of a host transfer, notify the new host about its status.
Definition: game.cpp:594
void send_and_record_server_message(const std::string &message, const socket_ptr exclude=socket_ptr())
Definition: game.hpp:204
bool disconnect(connection s)
Function to disconnect from a certain host, or close all connections if connection_num is 0...
Definition: network.cpp:646
void load_next_scenario(const socket_ptr user)
A user (player only?) asks for the next scenario to advance to.
Definition: game.cpp:1338
void set_description(simple_wml::node *desc)
Functions to set/get the address of the game's summary description as sent to players in the lobby...
Definition: game.cpp:1568
void set_password(const std::string &passwd)
Definition: game.hpp:225
std::string observer
Definition: game_config.cpp:84
void send_server_message_to_all(const char *message, socket_ptr exclude=socket_ptr()) const
Definition: game.cpp:1660
size_t current_turn() const
Definition: game.hpp:91
game_is_member(socket_ptr sock)
Definition: game.hpp:418
GLuint const GLchar * name
Definition: glew.h:1782
int id() const
Definition: game.hpp:51
simple_wml::node * description_
Pointer to the game's description in the games_and_users_list_.
Definition: game.hpp:399
std::string name_
The name of the game.
Definition: game.hpp:354
bool observers_can_chat() const
Definition: game.hpp:307
bool is_current_player(const socket_ptr player) const
Definition: game.hpp:257
bool is_muted_observer(const socket_ptr player) const
Definition: game.cpp:157
void send_data_observers(simple_wml::document &data, const socket_ptr exclude=socket_ptr(), std::string packet_type="") const
static int id_num
Definition: game.hpp:350
Definition: ban.cpp:28
std::string replay_save_path_
Definition: game.hpp:410
void send_data_sides(simple_wml::document &data, const simple_wml::string_span &sides, const socket_ptr exclude=socket_ptr(), std::string packet_type="") const
Definition: game.cpp:1408
user_vector players_
A vector of players (members owning a side).
Definition: game.hpp:361
bool level_init() const
Definition: game.hpp:64
std::vector< socket_ptr > user_vector
Definition: game.hpp:34
GLsizei GLenum GLuint GLuint GLsizei char * message
Definition: glew.h:2499
void send_observerjoins(const socket_ptr sock=socket_ptr()) const
Send [observer] tags of all the observers in the game to the user or everyone if none given...
Definition: game.cpp:1447
bool all_observers_muted() const
Definition: game.hpp:260
std::string password_
Definition: game.hpp:355
void send_server_message(const std::string &message, socket_ptr sock=socket_ptr(), simple_wml::document *doc=nullptr) const
Definition: game.hpp:197
void process_change_turns_wml(simple_wml::document &data, const socket_ptr user)
Handles incoming [change_turns_wml] data.
Definition: game.cpp:1118
void operator=(const game &)
boost::shared_ptr< boost::asio::ip::tcp::socket > socket_ptr
void mute_observer(const simple_wml::node &mute, const socket_ptr muter)
Mute an observer or give a message of all currently muted observers if no name is given...
Definition: game.cpp:656
void send_user_list(const socket_ptr exclude=socket_ptr()) const
Function to send a list of users to all clients.
Definition: game.cpp:1319
std::string debug_player_info() const
Helps debugging player and observer lists.
Definition: game.cpp:1595
bool started_
Definition: game.hpp:374
bool end_turn()
Function which should be called every time a player ends their turn (i.e.
Definition: game.cpp:1138
void transfer_ai_sides(const socket_ptr player)
void unban_user(const simple_wml::node &unban, const socket_ptr unbanner)
Definition: game.cpp:805
void send_server_message_to_all(const std::string &message, socket_ptr exclude=socket_ptr()) const
Definition: game.hpp:191
t_history history_
Definition: game.hpp:396
Defines the MAKE_ENUM macro.
simple_wml::document level_
The current scenario data.
Definition: game.hpp:392
GLsizei const GLcharARB ** string
Definition: glew.h:4503
void clear_history()
Definition: game.cpp:1563
void send_muted_observers(const socket_ptr user) const
Definition: game.cpp:645
void mute_all_observers()
Definition: game.cpp:636
bool remove_player(const socket_ptr player, const bool disconnect=false, const bool destruct=false)
Removes a user from the game.
Definition: game.cpp:1234
void set_termination_reason(const std::string &reason)
Definition: game.cpp:1575
simple_wml::document & level()
The full scenario data.
Definition: game.hpp:216