#include <game.hpp>

Public Member Functions | |
| game (player_map &players, const network::connection host=0, const std::string &name="", bool save_replays=false, const std::string &replay_save_path="") | |
| ~game () | |
| int | id () const |
| const std::string & | name () const |
| bool | is_owner (const network::connection player) const |
| bool | is_member (const network::connection player) const |
| bool | allow_observers () const |
| bool | is_observer (const network::connection player) const |
| bool | is_player (const network::connection player) const |
| bool | player_is_banned (const network::connection player) const |
| Checks whether the connection's ip address is banned. | |
| bool | level_init () const |
| bool | started () const |
| size_t | nplayers () const |
| size_t | nobservers () const |
| size_t | current_turn () const |
| void | mute_all_observers () |
| void | mute_observer (const simple_wml::node &mute, const player_map::const_iterator muter) |
| Mute an observer or give a message of all currently muted observers if no name is given. | |
| void | unmute_observer (const simple_wml::node &unmute, const player_map::const_iterator unmuter) |
| network::connection | kick_member (const simple_wml::node &kick, const player_map::const_iterator kicker) |
| Kick a member by name. | |
| network::connection | ban_user (const simple_wml::node &ban, const player_map::const_iterator banner) |
| Ban and kick a user by name. | |
| void | unban_user (const simple_wml::node &unban, const player_map::const_iterator unbanner) |
| bool | add_player (const network::connection player, bool observer=false) |
| Add a user to the game. | |
| bool | remove_player (const network::connection player, const bool disconnect=false, const bool destruct=false) |
| Removes a user from the game. | |
| const user_vector | all_game_users () const |
| Adds players and observers into one vector and returns that. | |
| void | start_game (const player_map::const_iterator starter) |
| void | load_next_scenario (const player_map::const_iterator user) const |
| A user (player only?) asks for the next scenario to advance to. | |
| void | update_side_data () |
| Resets the side configuration according to the scenario data. | |
| void | transfer_side_control (const network::connection sock, const simple_wml::node &cfg) |
| Let's a player owning a side give it to another player or observer. | |
| void | process_message (simple_wml::document &data, const player_map::iterator user) |
| bool | process_turn (simple_wml::document &data, const player_map::const_iterator user) |
| Handles [end_turn], repackages [commands] with private [speak]s in them and sends the data. | |
| void | process_whiteboard (simple_wml::document &data, const player_map::const_iterator user) |
| Handles incoming [whiteboard] data. | |
| bool | describe_slots () |
| Set the description to the number of available slots. | |
| void | send_server_message_to_all (const char *message, network::connection exclude=0) const |
| void | send_server_message_to_all (const std::string &message, network::connection exclude=0) const |
| void | send_server_message (const char *message, network::connection sock=0, simple_wml::document *doc=NULL) const |
| void | send_server_message (const std::string &message, network::connection sock=0, simple_wml::document *doc=NULL) const |
| void | send_and_record_server_message (const char *message, const network::connection exclude=0) |
| Send data to all players in this game except 'exclude'. | |
| void | send_and_record_server_message (const std::string &message, const network::connection exclude=0) |
| void | send_data (simple_wml::document &data, const network::connection exclude=0, std::string packet_type="") const |
| void | clear_history () |
| void | record_data (simple_wml::document *data) |
| void | save_replay () |
| simple_wml::document & | level () |
| The full scenario data. | |
| 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. | |
| simple_wml::node * | description () const |
| void | set_password (const std::string &passwd) |
| bool | password_matches (const std::string &passwd) const |
| const std::string & | termination_reason () const |
| void | set_termination_reason (const std::string &reason) |
| void | allow_global (const simple_wml::document &data) |
Private Member Functions | |
| game (const game &) | |
| void | operator= (const game &) |
| size_t | current_side () const |
| network::connection | current_player () const |
| bool | is_current_player (const network::connection player) const |
| bool | is_muted_observer (const network::connection player) const |
| bool | all_observers_muted () const |
| void | send_muted_observers (const player_map::const_iterator user) const |
| bool | send_taken_side (simple_wml::document &cfg, const simple_wml::node::child_list::const_iterator side) const |
| bool | take_side (const player_map::const_iterator user) |
| Figures out which side to take and tells that side to the game owner. | |
| void | change_controller (const size_t side_num, const network::connection sock, const std::string &player_name, const bool player_left=true, const std::string &controller="") |
| Send [change_controller] message to tell all clients the new controller's name or controller type (human or ai). | |
| void | transfer_ai_sides (const network::connection player) |
| void | send_leave_game (network::connection user) const |
| void | send_data_team (simple_wml::document &data, const simple_wml::string_span &team, const network::connection exclude=0, std::string packet_type="") const |
| void | send_data_observers (simple_wml::document &data, const network::connection exclude=0, std::string packet_type="") const |
| void | send_observerjoins (const network::connection sock=0) const |
| Send [observer] tags of all the observers in the game to the user or everyone if none given. | |
| void | send_observerquit (const player_map::const_iterator observer) const |
| void | send_history (const network::connection sock) const |
| void | notify_new_host () |
| In case of a host transfer, notify the new host about its status. | |
| player_map::iterator | find_user (const simple_wml::string_span &name) |
| Shortcut to a convenience function for finding a user by name. | |
| bool | observers_can_label () const |
| bool | observers_can_chat () const |
| bool | is_legal_command (const simple_wml::node &command, bool is_player) |
| bool | is_on_team (const simple_wml::string_span &team, const network::connection player) const |
| Function which returns true iff 'player' is on 'team'. | |
| std::string | has_same_ip (const network::connection &user, bool observer) const |
| Checks whether a user has the same IP as members of this game. | |
| bool | end_turn () |
| Function which should be called every time a player ends their turn (i.e. | |
| void | send_user_list (const network::connection exclude=0) const |
| Function to send a list of users to all clients. | |
| std::string | username (const player_map::const_iterator pl) const |
| Returns the name of the user or "(unfound)". | |
| std::string | list_users (user_vector users, const std::string &func) const |
| Returns a comma separated list of user names. | |
| void | missing_user (network::connection socket, const std::string &func) const |
| Function to log when we don't find a connection in player_info_. | |
| std::string | debug_player_info () const |
| Helps debugging player and observer lists. | |
Private Attributes | |
| player_map * | player_info_ |
| int | id_ |
| std::string | name_ |
| The name of the game. | |
| std::string | password_ |
| network::connection | owner_ |
| The game host or later owner (if the host left). | |
| user_vector | players_ |
| A vector of players (members owning a side). | |
| user_vector | observers_ |
| A vector of observers (members not owning a side). | |
| user_vector | muted_observers_ |
| side_vector | sides_ |
| A vector of side owners. | |
| std::vector< std::string > | side_controllers_ |
| A vector of controller strings indicating the type. | |
| int | nsides_ |
| Number of sides in the current scenario. | |
| bool | started_ |
| simple_wml::document | level_ |
| The current scenario data. | |
| std::vector < simple_wml::document * > | history_ |
| Replay data. | |
| simple_wml::node * | description_ |
| Pointer to the game's description in the games_and_users_list_. | |
| int | end_turn_ |
| bool | all_observers_muted_ |
| std::vector< std::string > | bans_ |
| std::string | termination_ |
| bool | save_replays_ |
| std::string | replay_save_path_ |
| int | global_wait_side_ |
| The side from which global variable data is expected. | |
Static Private Attributes | |
| static int | id_num = 1 |
Definition at line 35 of file game.hpp.
| wesnothd::game::game | ( | player_map & | players, | |
| const network::connection | host = 0, |
|||
| const std::string & | name = "", |
|||
| bool | save_replays = false, |
|||
| const std::string & | replay_save_path = "" | |||
| ) |
Definition at line 47 of file game.cpp.
References id_, missing_user(), name_, owner_, player_info_, players_, and wesnothd::player::PLAYING.

| wesnothd::game::~game | ( | ) |
Definition at line 85 of file game.cpp.
References all_game_users(), clear_history(), remove_player(), and save_replay().

| wesnothd::game::game | ( | const game & | ) | [private] |
| bool wesnothd::game::add_player | ( | const network::connection | player, | |
| bool | observer = false | |||
| ) |
Add a user to the game.
Definition at line 947 of file game.cpp.
References allow_observers(), DBG_GAME, debug_player_info(), ERR_GAME, has_same_ip(), id_, simple_wml::INIT_COMPRESSED, network::ip_address(), is_member(), level_, LOG_GAME, missing_user(), name_, observers_, wesnothd::player::OBSERVING, player_info_, players_, wesnothd::player::PLAYING, send_and_record_server_message(), send_data(), send_history(), send_observerjoins(), send_server_message(), wesnothd::send_to_one(), send_user_list(), started_, and take_side().

| const user_vector wesnothd::game::all_game_users | ( | ) | const |
Adds players and observers into one vector and returns that.
Definition at line 1345 of file game.cpp.
References observers_, and players_.
Referenced by wesnothd::room_manager::enter_lobby(), has_same_ip(), send_data(), send_user_list(), update_side_data(), and ~game().

| bool wesnothd::game::all_observers_muted | ( | ) | const [inline, private] |
Definition at line 206 of file game.hpp.
References all_observers_muted_.
| void wesnothd::game::allow_global | ( | const simple_wml::document & | data | ) |
Definition at line 1338 of file game.cpp.
References global_wait_side_, nsides_, and simple_wml::document::root().
Referenced by server::process_data_game().


| bool wesnothd::game::allow_observers | ( | ) | const |
Definition at line 96 of file game.cpp.
References level_.
Referenced by add_player().

| network::connection wesnothd::game::ban_user | ( | const simple_wml::node & | ban, | |
| const player_map::const_iterator | banner | |||
| ) |
Ban and kick a user by name.
The user does not need to be in this game but logged in.
Definition at line 663 of file game.cpp.
References bans_, find_user(), id_, network::ip_address(), is_member(), LOG_GAME, name_, owner_, player_info_, player_is_banned(), remove_player(), send_and_record_server_message(), send_leave_game(), send_server_message(), simple_wml::string_span::to_string(), and username().
Referenced by server::process_data_game().


| void wesnothd::game::change_controller | ( | const size_t | side_num, | |
| const network::connection | sock, | |||
| const std::string & | player_name, | |||
| const bool | player_left = true, |
|||
| const std::string & | controller = "" | |||
| ) | [private] |
Send [change_controller] message to tell all clients the new controller's name or controller type (human or ai).
Definition at line 435 of file game.cpp.
References DBG_GAME, level_, lexical_cast(), simple_wml::document::root(), send_and_record_server_message(), send_data(), wesnothd::send_to_one(), simple_wml::node::set_attr(), side_controllers_, sides_, and started_.
Referenced by remove_player(), and transfer_side_control().


| void wesnothd::game::clear_history | ( | ) |
Definition at line 1312 of file game.cpp.
References history_.
Referenced by start_game(), and ~game().

| network::connection wesnothd::game::current_player | ( | ) | const [inline, private] |
Definition at line 201 of file game.hpp.
References current_side(), nsides_, and sides_.
Referenced by is_current_player(), and process_turn().


| size_t wesnothd::game::current_side | ( | ) | const [inline, private] |
Definition at line 200 of file game.hpp.
References end_turn_, and nsides_.
Referenced by current_player(), end_turn(), and process_turn().

| size_t wesnothd::game::current_turn | ( | ) | const [inline] |
Definition at line 60 of file game.hpp.
References end_turn_, and nsides_.
Referenced by end_turn(), remove_player(), and save_replay().

| std::string wesnothd::game::debug_player_info | ( | ) | const [private] |
Helps debugging player and observer lists.
Definition at line 1354 of file game.cpp.
References id_, observers_, player_info_, and players_.
Referenced by add_player(), remove_player(), and update_side_data().

| bool wesnothd::game::describe_slots | ( | ) |
Set the description to the number of available slots.
Definition at line 500 of file game.cpp.
References description_, level_, simple_wml::document::root(), simple_wml::node::set_attr_dup(), sides_, and started_.
Referenced by server::process_data_game().


| simple_wml::node* wesnothd::game::description | ( | ) | const [inline] |
Definition at line 178 of file game.hpp.
References description_.
Referenced by server::process_data_game(), and server::update_game_in_lobby().

| bool wesnothd::game::end_turn | ( | ) | [private] |
Function which should be called every time a player ends their turn (i.e.
[end_turn] received). This will update the 'turn' attribute for the game's description when appropriate. Will return true iff there has been a change.
Definition at line 920 of file game.cpp.
References current_side(), current_turn(), description_, end_turn_, level_, gamemap::MAX_PLAYERS, nsides_, simple_wml::node::set_attr_dup(), and side_controllers_.
Referenced by process_turn(), and start_game().


| player_map::iterator wesnothd::game::find_user | ( | const simple_wml::string_span & | name | ) | [private] |
Shortcut to a convenience function for finding a user by name.
Definition at line 1385 of file game.cpp.
References player_info_.
Referenced by ban_user(), kick_member(), mute_observer(), transfer_side_control(), unban_user(), and unmute_observer().

| std::string wesnothd::game::has_same_ip | ( | const network::connection & | user, | |
| bool | observer | |||
| ) | const [private] |
Checks whether a user has the same IP as members of this game.
If observer is true it only checks against players.
Definition at line 1173 of file game.cpp.
References all_game_users(), network::ip_address(), player_info_, and players_.
Referenced by add_player().


| int wesnothd::game::id | ( | ) | const [inline] |
Definition at line 43 of file game.hpp.
References id_.
Referenced by wesnothd::game_id_matches::operator()(), and server::process_data_game().

| bool wesnothd::game::is_current_player | ( | const network::connection | player | ) | const [inline, private] |
Definition at line 203 of file game.hpp.
References current_player().
Referenced by process_turn().


| bool wesnothd::game::is_legal_command | ( | const simple_wml::node & | command, | |
| bool | is_player | |||
| ) | [private] |
Definition at line 741 of file game.cpp.
References simple_wml::node::child(), global_wait_side_, and simple_wml::node::one_child().
Referenced by process_turn().


| bool wesnothd::game::is_member | ( | const network::connection | player | ) | const [inline] |
Definition at line 47 of file game.hpp.
References is_observer(), and is_player().
Referenced by add_player(), ban_user(), kick_member(), wesnothd::game_is_member::operator()(), remove_player(), and transfer_side_control().


| bool wesnothd::game::is_muted_observer | ( | const network::connection | player | ) | const [private] |
Definition at line 104 of file game.cpp.
References all_observers_muted_, gui2::event::find(), is_observer(), and muted_observers_.
Referenced by mute_observer(), process_turn(), and unmute_observer().


| bool wesnothd::game::is_observer | ( | const network::connection | player | ) | const |
Definition at line 100 of file game.cpp.
References gui2::event::find(), and observers_.
Referenced by is_member(), is_muted_observer(), mute_observer(), remove_player(), transfer_side_control(), and unmute_observer().


| bool wesnothd::game::is_on_team | ( | const simple_wml::string_span & | team, | |
| const network::connection | player | |||
| ) | const [private] |
Function which returns true iff 'player' is on 'team'.
AI controlled sides are not considered on a team.
Definition at line 1153 of file game.cpp.
References DBG_GAME, level_, simple_wml::document::root(), side_controllers_, and sides_.
Referenced by process_turn(), process_whiteboard(), and send_data_team().


| bool wesnothd::game::is_owner | ( | const network::connection | player | ) | const [inline] |
Definition at line 46 of file game.hpp.
References owner_.
Referenced by wesnothd::game_is_member::operator()(), and server::process_data_game().

| bool wesnothd::game::is_player | ( | const network::connection | player | ) | const |
Definition at line 114 of file game.cpp.
References gui2::event::find(), and players_.
Referenced by is_member(), server::process_data_game(), process_turn(), process_whiteboard(), remove_player(), and transfer_side_control().


| network::connection wesnothd::game::kick_member | ( | const simple_wml::node & | kick, | |
| const player_map::const_iterator | kicker | |||
| ) |
Kick a member by name.
Definition at line 632 of file game.cpp.
References find_user(), id_, network::ip_address(), is_member(), LOG_GAME, name_, owner_, player_info_, remove_player(), send_and_record_server_message(), send_leave_game(), send_server_message(), simple_wml::string_span::to_string(), and username().
Referenced by server::process_data_game().


| simple_wml::document& wesnothd::game::level | ( | ) | [inline] |
The full scenario data.
Definition at line 171 of file game.hpp.
References level_.
Referenced by server::process_data_game(), and server::process_data_lobby().

| bool wesnothd::game::level_init | ( | ) | const [inline] |
Definition at line 55 of file game.hpp.
References simple_wml::document::child(), and level_.
Referenced by server::process_data_game().


| std::string wesnothd::game::list_users | ( | user_vector | users, | |
| const std::string & | func | |||
| ) | const [private] |
Returns a comma separated list of user names.
Definition at line 142 of file game.cpp.
References missing_user(), and player_info_.
Referenced by send_muted_observers(), and start_game().


| void wesnothd::game::load_next_scenario | ( | const player_map::const_iterator | user | ) | const |
A user (player only?) asks for the next scenario to advance to.
Definition at line 1123 of file game.cpp.
References level_, simple_wml::document::root(), send_history(), send_observerjoins(), send_server_message_to_all(), and wesnothd::send_to_one().
Referenced by server::process_data_game().


| void wesnothd::game::missing_user | ( | network::connection | socket, | |
| const std::string & | func | |||
| ) | const [private] |
Function to log when we don't find a connection in player_info_.
Definition at line 41 of file game.cpp.
References id_, name_, and WRN_GAME.
Referenced by add_player(), game(), list_users(), remove_player(), send_observerjoins(), transfer_side_control(), and update_side_data().

| void wesnothd::game::mute_all_observers | ( | ) |
Definition at line 532 of file game.cpp.
References all_observers_muted_, and send_and_record_server_message().
Referenced by server::process_data_game().


| void wesnothd::game::mute_observer | ( | const simple_wml::node & | mute, | |
| const player_map::const_iterator | muter | |||
| ) |
Mute an observer or give a message of all currently muted observers if no name is given.
Definition at line 552 of file game.cpp.
References simple_wml::string_span::empty(), find_user(), id_, network::ip_address(), is_muted_observer(), is_observer(), LOG_GAME, muted_observers_, name_, owner_, player_info_, send_and_record_server_message(), send_muted_observers(), send_server_message(), simple_wml::string_span::to_string(), and username().
Referenced by server::process_data_game().


| const std::string& wesnothd::game::name | ( | ) | const [inline] |
Definition at line 44 of file game.hpp.
References name_.
Referenced by server::process_data_game().

| size_t wesnothd::game::nobservers | ( | ) | const [inline] |
Definition at line 59 of file game.hpp.
References observers_.
| void wesnothd::game::notify_new_host | ( | ) | [private] |
In case of a host transfer, notify the new host about its status.
Definition at line 485 of file game.cpp.
References owner_, player_info_, send_and_record_server_message(), wesnothd::send_to_one(), simple_wml::node::set_attr(), and username().
Referenced by remove_player().


| size_t wesnothd::game::nplayers | ( | ) | const [inline] |
Definition at line 58 of file game.hpp.
References players_.
Referenced by server::process_data_game().

| bool wesnothd::game::observers_can_chat | ( | ) | const [inline, private] |
| bool wesnothd::game::observers_can_label | ( | ) | const [inline, private] |
| void wesnothd::game::operator= | ( | const game & | ) | [private] |
| bool wesnothd::game::password_matches | ( | const std::string & | passwd | ) | const [inline] |
| bool wesnothd::game::player_is_banned | ( | const network::connection | player | ) | const |
Checks whether the connection's ip address is banned.
Definition at line 526 of file game.cpp.
References bans_, gui2::event::find(), and network::ip_address().
Referenced by ban_user(), and unban_user().


| void wesnothd::game::process_message | ( | simple_wml::document & | data, | |
| const player_map::iterator | user | |||
| ) |
Definition at line 726 of file game.cpp.
References ERR_GAME, game_logic::msg(), owner_, simple_wml::document::root(), send_data(), simple_wml::node::set_attr_dup(), and wesnothd::chat_message::truncate_message().
Referenced by server::process_data_game().


| bool wesnothd::game::process_turn | ( | simple_wml::document & | data, | |
| const player_map::const_iterator | user | |||
| ) |
Handles [end_turn], repackages [commands] with private [speak]s in them and sends the data.
Also filters commands from all but the current player. Currently removes all commands but [speak] for observers and all but [speak], [label] and [rename] for players.
Definition at line 766 of file game.cpp.
References simple_wml::node::add_child(), simple_wml::string_span::begin(), simple_wml::node::children(), simple_wml::document::clone(), simple_wml::node::copy_into(), current_player(), current_side(), DBG_GAME, simple_wml::string_span::end(), end_turn(), end_turn_, gui2::event::find(), id_, is_current_player(), is_legal_command(), is_muted_observer(), is_on_team(), is_player(), LOG_GAME, gamemap::MAX_PLAYERS, game_logic::msg(), simple_wml::node::no_children(), simple_wml::node_to_string(), nsides_, game_config::observer_team_name, observers_, owner_, player_info_, record_data(), simple_wml::node::remove_child(), simple_wml::document::root(), send_and_record_server_message(), send_data(), send_data_team(), send_server_message(), wesnothd::send_to_many(), wesnothd::send_to_one(), simple_wml::node::set_attr_dup(), simple_wml::node::set_attr_int(), sides_, started_, wesnothd::chat_message::truncate_message(), and username().
Referenced by server::process_data_game().


| void wesnothd::game::process_whiteboard | ( | simple_wml::document & | data, | |
| const player_map::const_iterator | user | |||
| ) |
Handles incoming [whiteboard] data.
Definition at line 893 of file game.cpp.
References simple_wml::string_span::begin(), simple_wml::document::child(), simple_wml::string_span::end(), is_on_team(), is_player(), LOG_GAME, gamemap::MAX_PLAYERS, send_and_record_server_message(), send_data_team(), sides_, and started_.
Referenced by server::process_data_game().


| void wesnothd::game::record_data | ( | simple_wml::document * | data | ) |
Definition at line 1307 of file game.cpp.
References simple_wml::document::compress(), and history_.
Referenced by process_turn(), and send_and_record_server_message().


| bool wesnothd::game::remove_player | ( | const network::connection | player, | |
| const bool | disconnect = false, |
|||
| const bool | destruct = false | |||
| ) |
Removes a user from the game.
Definition at line 1018 of file game.cpp.
References change_controller(), current_turn(), DBG_GAME, debug_player_info(), ERR_GAME, id_, if(), network::ip_address(), is_member(), is_observer(), is_player(), lexical_cast(), LOG_GAME, missing_user(), name_, notify_new_host(), game_config::images::observer, observers_, owner_, player_info_, players_, wesnothd::player::PLAYING, schema_validation::remove, send_and_record_server_message(), send_observerquit(), send_server_message_to_all(), wesnothd::send_to_one(), send_user_list(), side_controllers_, sides_, started_, termination_reason(), and username().
Referenced by ban_user(), kick_member(), server::process_data_game(), and ~game().


| void wesnothd::game::save_replay | ( | ) |
Definition at line 1258 of file game.cpp.
References current_turn(), DBG_GAME, ERR_GAME, history_, id_, level_, game::error::message, name_, simple_wml::node_to_string(), ostream_file(), simple_wml::document::output(), replay_save_path_, save_replays_, started_, and WRN_CONFIG.
Referenced by server::process_data_game(), and ~game().


| void wesnothd::game::send_and_record_server_message | ( | const std::string & | message, | |
| const network::connection | exclude = 0 | |||
| ) | [inline] |
Definition at line 159 of file game.hpp.
References send_and_record_server_message().

| void wesnothd::game::send_and_record_server_message | ( | const char * | message, | |
| const network::connection | exclude = 0 | |||
| ) |
Send data to all players in this game except 'exclude'.
Definition at line 1396 of file game.cpp.
References record_data(), send_data(), send_server_message(), and started_.
Referenced by add_player(), ban_user(), change_controller(), kick_member(), mute_all_observers(), mute_observer(), notify_new_host(), process_turn(), process_whiteboard(), remove_player(), send_and_record_server_message(), start_game(), transfer_side_control(), unban_user(), and unmute_observer().


| void wesnothd::game::send_data | ( | simple_wml::document & | data, | |
| const network::connection | exclude = 0, |
|||
| std::string | packet_type = "" | |||
| ) | const |
Definition at line 1134 of file game.cpp.
References all_game_users(), and wesnothd::send_to_many().
Referenced by add_player(), change_controller(), server::process_data_game(), process_message(), process_turn(), send_and_record_server_message(), send_observerjoins(), send_observerquit(), send_server_message_to_all(), send_user_list(), start_game(), and transfer_side_control().


| void wesnothd::game::send_data_observers | ( | simple_wml::document & | data, | |
| const network::connection | exclude = 0, |
|||
| std::string | packet_type = "" | |||
| ) | const [private] |
| void wesnothd::game::send_data_team | ( | simple_wml::document & | data, | |
| const simple_wml::string_span & | team, | |||
| const network::connection | exclude = 0, |
|||
| std::string | packet_type = "" | |||
| ) | const [private] |
Definition at line 1141 of file game.cpp.
References DBG_GAME, is_on_team(), players_, and wesnothd::send_to_many().
Referenced by process_turn(), and process_whiteboard().


| void wesnothd::game::send_history | ( | const network::connection | sock | ) | const [private] |
Definition at line 1221 of file game.cpp.
References simple_wml::document::compress(), history_, game::error::message, simple_wml::document::output_compressed(), network::send_raw_data(), and WRN_CONFIG.
Referenced by add_player(), and load_next_scenario().


| void wesnothd::game::send_leave_game | ( | network::connection | user | ) | const [private] |
Definition at line 626 of file game.cpp.
References simple_wml::INIT_COMPRESSED, and wesnothd::send_to_one().
Referenced by ban_user(), and kick_member().


| void wesnothd::game::send_muted_observers | ( | const player_map::const_iterator | user | ) | const [private] |
Definition at line 541 of file game.cpp.
References all_observers_muted_, list_users(), muted_observers_, and send_server_message().
Referenced by mute_observer().


| void wesnothd::game::send_observerjoins | ( | const network::connection | sock = 0 |
) | const [private] |
Send [observer] tags of all the observers in the game to the user or everyone if none given.
Definition at line 1188 of file game.cpp.
References missing_user(), observers_, player_info_, simple_wml::document::root(), send_data(), and wesnothd::send_to_one().
Referenced by add_player(), load_next_scenario(), and start_game().


| void wesnothd::game::send_observerquit | ( | const player_map::const_iterator | observer | ) | const [private] |
Definition at line 1209 of file game.cpp.
References player_info_, simple_wml::document::root(), and send_data().
Referenced by remove_player(), and transfer_side_control().


| void wesnothd::game::send_server_message | ( | const char * | message, | |
| network::connection | sock = 0, |
|||
| simple_wml::document * | doc = NULL | |||
| ) | const |
Definition at line 1411 of file game.cpp.
References simple_wml::node::add_child(), game_logic::msg(), simple_wml::document::root(), wesnothd::send_to_one(), simple_wml::node::set_attr(), simple_wml::node::set_attr_dup(), and started_.
Referenced by add_player(), ban_user(), kick_member(), mute_observer(), server::process_data_game(), process_turn(), send_and_record_server_message(), send_muted_observers(), send_server_message(), send_server_message_to_all(), transfer_side_control(), unban_user(), and unmute_observer().


| void wesnothd::game::send_server_message | ( | const std::string & | message, | |
| network::connection | sock = 0, |
|||
| simple_wml::document * | doc = NULL | |||
| ) | const [inline] |
Definition at line 152 of file game.hpp.
References send_server_message().

| void wesnothd::game::send_server_message_to_all | ( | const std::string & | message, | |
| network::connection | exclude = 0 | |||
| ) | const [inline] |
Definition at line 146 of file game.hpp.
References send_server_message_to_all().

| void wesnothd::game::send_server_message_to_all | ( | const char * | message, | |
| network::connection | exclude = 0 | |||
| ) | const |
Definition at line 1404 of file game.cpp.
References send_data(), and send_server_message().
Referenced by load_next_scenario(), server::process_data_game(), remove_player(), and send_server_message_to_all().


| bool wesnothd::game::send_taken_side | ( | simple_wml::document & | cfg, | |
| const simple_wml::node::child_list::const_iterator | side | |||
| ) | const [private] |
Definition at line 227 of file game.cpp.
References gamemap::MAX_PLAYERS, owner_, simple_wml::document::root(), wesnothd::send_to_one(), and sides_.
Referenced by take_side().


| void wesnothd::game::send_user_list | ( | const network::connection | exclude = 0 |
) | const [private] |
Function to send a list of users to all clients.
Only sends data if the game is initialized but not yet started.
Definition at line 1104 of file game.cpp.
References all_game_users(), description_, player_info_, simple_wml::document::root(), send_data(), and started_.
Referenced by add_player(), and remove_player().


| void wesnothd::game::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 at line 1320 of file game.cpp.
References description_, password_, and simple_wml::node::set_attr().
Referenced by server::process_data_game().


| void wesnothd::game::set_password | ( | const std::string & | passwd | ) | [inline] |
Definition at line 180 of file game.hpp.
References password_.
Referenced by server::process_data_lobby().

| void wesnothd::game::set_termination_reason | ( | const std::string & | reason | ) |
Definition at line 1327 of file game.cpp.
References termination_.
Referenced by server::process_data_game().

| void wesnothd::game::start_game | ( | const player_map::const_iterator | starter | ) |
Definition at line 157 of file game.cpp.
References simple_wml::node::child(), clear_history(), DBG_GAME, end_turn(), end_turn_, id_, simple_wml::INIT_COMPRESSED, network::ip_address(), level_, list_users(), LOG_GAME, name_, nsides_, players_, simple_wml::document::root(), save(), send_and_record_server_message(), send_data(), send_observerjoins(), sides_, started_, and update_side_data().
Referenced by server::process_data_game().


| bool wesnothd::game::started | ( | ) | const [inline] |
Definition at line 56 of file game.hpp.
References started_.
Referenced by server::process_data_game().

| bool wesnothd::game::take_side | ( | const player_map::const_iterator | user | ) | [private] |
Figures out which side to take and tells that side to the game owner.
The owner then should send a [scenario_diff] that implements the side change and a subsequent update_side_data() call makes it actually happen. First we look for a side where save_id= or current_player= matches the new user's name then we search for the first controller="network" side.
Definition at line 239 of file game.cpp.
References DBG_GAME, level_, simple_wml::document::root(), send_taken_side(), and started_.
Referenced by add_player().


| const std::string& wesnothd::game::termination_reason | ( | ) | const [inline] |
Definition at line 185 of file game.hpp.
References started_, and termination_.
Referenced by remove_player().

| void wesnothd::game::transfer_ai_sides | ( | const network::connection | player | ) | [private] |
| void wesnothd::game::transfer_side_control | ( | const network::connection | sock, | |
| const simple_wml::node & | cfg | |||
| ) |
Let's a player owning a side give it to another player or observer.
Definition at line 337 of file game.cpp.
References change_controller(), DBG_GAME, simple_wml::string_span::empty(), gui2::event::find(), find_user(), is_member(), is_observer(), is_player(), level_, gamemap::MAX_PLAYERS, missing_user(), observers_, wesnothd::player::OBSERVING, owner_, player_info_, players_, wesnothd::player::PLAYING, schema_validation::remove, simple_wml::document::root(), send_and_record_server_message(), send_data(), send_observerquit(), send_server_message(), sides_, simple_wml::string_span::to_string(), and username().
Referenced by server::process_data_game().


| void wesnothd::game::unban_user | ( | const simple_wml::node & | unban, | |
| const player_map::const_iterator | unbanner | |||
| ) |
Definition at line 701 of file game.cpp.
References bans_, find_user(), id_, network::ip_address(), LOG_GAME, name_, owner_, player_info_, player_is_banned(), schema_validation::remove, send_and_record_server_message(), send_server_message(), simple_wml::string_span::to_string(), and username().
Referenced by server::process_data_game().


| void wesnothd::game::unmute_observer | ( | const simple_wml::node & | unmute, | |
| const player_map::const_iterator | unmuter | |||
| ) |
Definition at line 592 of file game.cpp.
References simple_wml::string_span::empty(), find_user(), id_, network::ip_address(), is_muted_observer(), is_observer(), LOG_GAME, muted_observers_, name_, owner_, player_info_, schema_validation::remove, send_and_record_server_message(), send_server_message(), simple_wml::string_span::to_string(), and username().
Referenced by server::process_data_game().


| void wesnothd::game::update_side_data | ( | ) |
Resets the side configuration according to the scenario data.
Definition at line 272 of file game.cpp.
References all_game_users(), DBG_GAME, debug_player_info(), lg::info, level_, gamemap::MAX_PLAYERS, missing_user(), observers_, wesnothd::player::OBSERVING, owner_, player_info_, players_, wesnothd::player::PLAYING, simple_wml::document::root(), side_controllers_, and sides_.
Referenced by server::process_data_game(), and start_game().


| std::string wesnothd::game::username | ( | const player_map::const_iterator | pl | ) | const [private] |
Returns the name of the user or "(unfound)".
Definition at line 133 of file game.cpp.
References player_info_.
Referenced by ban_user(), kick_member(), mute_observer(), notify_new_host(), process_turn(), remove_player(), transfer_side_control(), unban_user(), and unmute_observer().

bool wesnothd::game::all_observers_muted_ [private] |
Definition at line 338 of file game.hpp.
Referenced by all_observers_muted(), is_muted_observer(), mute_all_observers(), and send_muted_observers().
std::vector<std::string> wesnothd::game::bans_ [private] |
Definition at line 340 of file game.hpp.
Referenced by ban_user(), player_is_banned(), and unban_user().
simple_wml::node* wesnothd::game::description_ [private] |
Pointer to the game's description in the games_and_users_list_.
Definition at line 334 of file game.hpp.
Referenced by describe_slots(), description(), end_turn(), send_user_list(), and set_description().
int wesnothd::game::end_turn_ [private] |
Definition at line 336 of file game.hpp.
Referenced by current_side(), current_turn(), end_turn(), process_turn(), and start_game().
int wesnothd::game::global_wait_side_ [private] |
The side from which global variable data is expected.
Definition at line 348 of file game.hpp.
Referenced by allow_global(), and is_legal_command().
std::vector<simple_wml::document*> wesnothd::game::history_ [mutable, private] |
Replay data.
Definition at line 331 of file game.hpp.
Referenced by clear_history(), record_data(), save_replay(), and send_history().
int wesnothd::game::id_ [private] |
Definition at line 296 of file game.hpp.
Referenced by add_player(), ban_user(), debug_player_info(), game(), id(), kick_member(), missing_user(), mute_observer(), process_turn(), remove_player(), save_replay(), start_game(), unban_user(), and unmute_observer().
int wesnothd::game::id_num = 1 [static, private] |
simple_wml::document wesnothd::game::level_ [private] |
The current scenario data.
Definition at line 328 of file game.hpp.
Referenced by add_player(), allow_observers(), change_controller(), describe_slots(), end_turn(), is_on_team(), level(), level_init(), load_next_scenario(), save_replay(), start_game(), take_side(), transfer_side_control(), and update_side_data().
user_vector wesnothd::game::muted_observers_ [private] |
Definition at line 310 of file game.hpp.
Referenced by is_muted_observer(), mute_observer(), send_muted_observers(), and unmute_observer().
std::string wesnothd::game::name_ [private] |
The name of the game.
Definition at line 299 of file game.hpp.
Referenced by add_player(), ban_user(), game(), kick_member(), missing_user(), mute_observer(), name(), remove_player(), save_replay(), start_game(), unban_user(), and unmute_observer().
int wesnothd::game::nsides_ [private] |
Number of sides in the current scenario.
Definition at line 324 of file game.hpp.
Referenced by allow_global(), current_player(), current_side(), current_turn(), end_turn(), process_turn(), and start_game().
user_vector wesnothd::game::observers_ [private] |
A vector of observers (members not owning a side).
Definition at line 309 of file game.hpp.
Referenced by add_player(), all_game_users(), debug_player_info(), is_observer(), nobservers(), process_turn(), remove_player(), send_observerjoins(), transfer_side_control(), and update_side_data().
network::connection wesnothd::game::owner_ [private] |
The game host or later owner (if the host left).
Definition at line 303 of file game.hpp.
Referenced by ban_user(), game(), is_owner(), kick_member(), mute_observer(), notify_new_host(), process_message(), process_turn(), remove_player(), send_taken_side(), transfer_side_control(), unban_user(), unmute_observer(), and update_side_data().
std::string wesnothd::game::password_ [private] |
Definition at line 300 of file game.hpp.
Referenced by password_matches(), set_description(), and set_password().
player_map* wesnothd::game::player_info_ [private] |
Definition at line 293 of file game.hpp.
Referenced by add_player(), ban_user(), debug_player_info(), find_user(), game(), has_same_ip(), kick_member(), list_users(), mute_observer(), notify_new_host(), process_turn(), remove_player(), send_observerjoins(), send_observerquit(), send_user_list(), transfer_side_control(), unban_user(), unmute_observer(), update_side_data(), and username().
user_vector wesnothd::game::players_ [private] |
A vector of players (members owning a side).
Definition at line 306 of file game.hpp.
Referenced by add_player(), all_game_users(), debug_player_info(), game(), has_same_ip(), is_player(), nplayers(), remove_player(), send_data_team(), start_game(), transfer_side_control(), and update_side_data().
std::string wesnothd::game::replay_save_path_ [private] |
Definition at line 345 of file game.hpp.
Referenced by save_replay().
bool wesnothd::game::save_replays_ [private] |
Definition at line 344 of file game.hpp.
Referenced by save_replay().
std::vector<std::string> wesnothd::game::side_controllers_ [private] |
A vector of controller strings indicating the type.
"human" - a side controlled by a human "ai" - a side controlled by an AI "null" - an empty side
Definition at line 321 of file game.hpp.
Referenced by change_controller(), end_turn(), is_on_team(), remove_player(), and update_side_data().
side_vector wesnothd::game::sides_ [private] |
A vector of side owners.
Definition at line 313 of file game.hpp.
Referenced by change_controller(), current_player(), describe_slots(), is_on_team(), process_turn(), process_whiteboard(), remove_player(), send_taken_side(), start_game(), transfer_side_control(), and update_side_data().
bool wesnothd::game::started_ [private] |
Definition at line 325 of file game.hpp.
Referenced by add_player(), change_controller(), describe_slots(), process_turn(), process_whiteboard(), remove_player(), save_replay(), send_and_record_server_message(), send_server_message(), send_user_list(), start_game(), started(), take_side(), and termination_reason().
std::string wesnothd::game::termination_ [private] |
Definition at line 342 of file game.hpp.
Referenced by set_termination_reason(), and termination_reason().
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:26:58 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |