Classes | |
struct | error |
struct | load_game_failed |
struct | save_game_failed |
struct | game_error |
struct | load_game_exception |
Functions | |
game (player_map &players, const network::connection host, const std::string name) | |
~game () | |
bool | allow_observers () const |
bool | is_observer (const network::connection player) const |
bool | is_muted_observer (const network::connection player) const |
bool | is_player (const network::connection player) const |
void | start_game (const player_map::const_iterator starter) |
bool | take_side (const player_map::const_iterator user) |
Figures out which side to take and tells that side to the game owner. | |
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) |
void | send_change_controller (const size_t side_num, const player_map::const_iterator newplayer, const bool player_left) |
Send [change_controller] message to tell all clients the new controller's name. | |
void | transfer_ai_sides () |
void | notify_new_host () |
bool | describe_slots () |
bool | player_is_banned (const network::connection sock) const |
Checks whether the connection's ip address is banned. | |
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. | |
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 a user by name. | |
void | process_message (simple_wml::document &data, const player_map::iterator user) |
bool | is_legal_command (const simple_wml::node &command, bool is_player) |
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. | |
bool | end_turn () |
void | add_player (const network::connection player, bool observer) |
bool | remove_player (const network::connection player, const bool disconnect) |
Removes a user from the game. | |
void | send_user_list (const network::connection exclude) const |
void | load_next_scenario (const player_map::const_iterator user) const |
A member asks for the next scenario to advance to. | |
void | send_data (simple_wml::document &data, const network::connection exclude) const |
void | send_to_one (simple_wml::document &data, const network::connection sock) const |
void | send_data_team (simple_wml::document &data, const simple_wml::string_span &team, const network::connection exclude) const |
void | send_data_observers (simple_wml::document &data, const network::connection exclude) const |
bool | is_on_team (const simple_wml::string_span &team, const network::connection player) const |
void | send_observerjoins (const network::connection sock) 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 | record_data (simple_wml::document *data) |
void | set_description (simple_wml::node *desc) |
void | set_termination_reason (const std::string &reason) |
void | add_players (const game &other_game, const bool observer) |
const user_vector | all_game_users () const |
std::string | debug_player_info () const |
player_map::const_iterator | find_user (const simple_wml::string_span &name) const |
Find a user by name. | |
void | send_and_record_server_message (const char *message, const network::connection exclude) |
void | send_server_message_to_all (const char *message, network::connection exclude) const |
void | send_server_message (const char *message, network::connection sock, simple_wml::document *docptr) const |
void game::add_player | ( | const network::connection | player, | |
bool | observer | |||
) |
Definition at line 861 of file server/game.cpp.
References allow_observers(), simple_wml::string_span::begin(), DBG_GAME, debug_player_info(), ERR_GAME, id_, simple_wml::INIT_COMPRESSED, is_member(), level_, name_, observers_, simple_wml::document::output_compressed(), owner_, player_info_, players_, simple_wml::document::root(), send_data(), send_history(), send_observerjoins(), network::send_raw_data(), send_server_message(), send_user_list(), simple_wml::string_span::size(), start_game(), started_, and take_side().
void game::add_players | ( | const game & | other_game, | |
const bool | observer | |||
) |
Definition at line 1194 of file server/game.cpp.
References all_game_users(), observers_, and players_.
const user_vector game::all_game_users | ( | ) | const |
bool game::allow_observers | ( | ) | const |
network::connection game::ban_user | ( | const simple_wml::node & | ban, | |
const player_map::const_iterator | banner | |||
) |
Ban a user by name.
The user does not need to be in this game but logged in.
Definition at line 624 of file server/game.cpp.
References bans_, simple_wml::string_span::begin(), find_user(), id_, simple_wml::INIT_COMPRESSED, network::ip_address(), is_member(), LOG_GAME, name(), name_, simple_wml::document::output_compressed(), owner_, player_info_, player_is_banned(), remove_player(), send_and_record_server_message(), network::send_raw_data(), send_server_message(), simple_wml::string_span::size(), stream, and simple_wml::string_span::to_string().
std::string game::debug_player_info | ( | ) | const |
Definition at line 1213 of file server/game.cpp.
References id_, observers_, player_info_, and players_.
bool game::describe_slots | ( | ) |
Definition at line 496 of file server/game.cpp.
References buf, description_, level_, simple_wml::document::root(), simple_wml::node::set_attr_dup(), sides_taken_, and started_.
bool game::end_turn | ( | ) |
Definition at line 836 of file server/game.cpp.
References current_side(), current_turn(), describe_turns(), description_, end_turn_, level_, gamemap::MAX_PLAYERS, nsides_, simple_wml::node::set_attr_dup(), and side_controllers_.
player_map::const_iterator game::find_user | ( | const simple_wml::string_span & | name | ) | const |
game::game | ( | player_map & | players, | |
const network::connection | host, | |||
const std::string | name | |||
) |
Definition at line 54 of file server/game.cpp.
References ERR_GAME, id_, name_, owner_, player_info_, and players_.
Referenced by play_game(), and server::process_data_lobby().
bool game::is_legal_command | ( | const simple_wml::node & | command, | |
bool | is_player | |||
) |
Definition at line 696 of file server/game.cpp.
References simple_wml::node::child(), and simple_wml::node::one_child().
bool game::is_muted_observer | ( | const network::connection | player | ) | const |
Definition at line 89 of file server/game.cpp.
References all_observers_muted_, is_observer(), and muted_observers_.
bool game::is_observer | ( | const network::connection | player | ) | const |
bool game::is_on_team | ( | const simple_wml::string_span & | team, | |
const network::connection | player | |||
) | const |
Definition at line 1091 of file server/game.cpp.
References level_, lexical_cast(), simple_wml::document::root(), and sides_.
bool game::is_player | ( | const network::connection | player | ) | const |
network::connection game::kick_member | ( | const simple_wml::node & | kick, | |
const player_map::const_iterator | kicker | |||
) |
Kick a member by name.
Definition at line 590 of file server/game.cpp.
References simple_wml::string_span::begin(), find_user(), id_, simple_wml::INIT_COMPRESSED, network::ip_address(), is_member(), LOG_GAME, name(), name_, owner_, player_info_, remove_player(), send_and_record_server_message(), network::send_raw_data(), send_server_message(), simple_wml::string_span::size(), and simple_wml::string_span::to_string().
void game::load_next_scenario | ( | const player_map::const_iterator | user | ) | const |
A member asks for the next scenario to advance to.
Definition at line 1041 of file server/game.cpp.
References simple_wml::string_span::begin(), data, level_, simple_wml::document::root(), send_history(), send_observerjoins(), network::send_raw_data(), send_server_message_to_all(), and simple_wml::string_span::size().
void game::mute_all_observers | ( | ) |
Definition at line 530 of file server/game.cpp.
References all_observers_muted_, and send_and_record_server_message().
void 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.
Prevent muting ourselves.
Definition at line 541 of file server/game.cpp.
References all_observers_muted_, simple_wml::string_span::empty(), find_user(), id_, network::ip_address(), is_muted_observer(), is_observer(), LOG_GAME, muted_observers_, name(), name_, owner_, player_info_, send_and_record_server_message(), and send_server_message().
void game::notify_new_host | ( | ) |
Definition at line 480 of file server/game.cpp.
References simple_wml::string_span::begin(), cfg, data, simple_wml::document::output_compressed(), owner_, player_info_, simple_wml::document::root(), send_and_record_server_message(), network::send_raw_data(), simple_wml::node::set_attr(), and simple_wml::string_span::size().
bool game::player_is_banned | ( | const network::connection | sock | ) | const |
Checks whether the connection's ip address is banned.
Definition at line 524 of file server/game.cpp.
References bans_, and network::ip_address().
void game::process_message | ( | simple_wml::document & | data, | |
const player_map::iterator | user | |||
) |
Definition at line 664 of file server/game.cpp.
References simple_wml::string_span::begin(), network::ip_address(), LOG_GAME, message, owner_, simple_wml::document::root(), send_data(), send_server_message(), simple_wml::node::set_attr_dup(), simple_wml::string_span::size(), and chat_message::truncate_message().
bool 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. Returns true if the turn ended.
Definition at line 720 of file server/game.cpp.
References simple_wml::node::add_child(), simple_wml::string_span::begin(), simple_wml::node::children(), simple_wml::document::clone(), command, simple_wml::node::copy_into(), current_player(), current_side(), simple_wml::string_span::end(), end_turn(), is_current_player(), is_legal_command(), is_muted_observer(), is_on_team(), is_player(), LOG_GAME, gamemap::MAX_PLAYERS, message, simple_wml::node::no_children(), game_config::observer_team_name, simple_wml::document::output(), player_info_, record_data(), simple_wml::node::remove_child(), simple_wml::document::root(), send_and_record_server_message(), send_data(), send_data_observers(), send_data_team(), send_server_message(), simple_wml::node::set_attr_dup(), sides_, started_, and chat_message::truncate_message().
void game::record_data | ( | simple_wml::document * | data | ) |
Definition at line 1171 of file server/game.cpp.
References simple_wml::document::compress(), and history_.
bool game::remove_player | ( | const network::connection | player, | |
const bool | disconnect | |||
) |
Removes a user from the game.
Definition at line 928 of file server/game.cpp.
References current_turn(), DBG_GAME, debug_player_info(), ERR_GAME, host, id_, if(), network::ip_address(), is_member(), is_observer(), is_player(), LOG_GAME, name_, notify_new_host(), observers_, owner_, player_info_, players_, halo::remove(), simple_wml::document::root(), send_and_record_server_message(), send_change_controller(), send_observerquit(), send_server_message_to_all(), send_to_one(), send_user_list(), side_controllers_, sides_, sides_taken_, started_, termination_reason(), and transfer_ai_sides().
void game::send_and_record_server_message | ( | const char * | message, | |
const network::connection | exclude | |||
) |
Definition at line 1255 of file server/game.cpp.
References record_data(), send_data(), send_server_message(), and started_.
void game::send_change_controller | ( | const size_t | side_num, | |
const player_map::const_iterator | newplayer, | |||
const bool | player_left | |||
) |
Send [change_controller] message to tell all clients the new controller's name.
Definition at line 421 of file server/game.cpp.
References level_, lexical_cast(), player_info_, simple_wml::document::root(), send_and_record_server_message(), send_data(), send_to_one(), simple_wml::node::set_attr(), and started_.
void game::send_data | ( | simple_wml::document & | data, | |
const network::connection | exclude | |||
) | const |
Definition at line 1053 of file server/game.cpp.
References all_game_users(), simple_wml::string_span::begin(), simple_wml::document::output_compressed(), network::send_raw_data(), and simple_wml::string_span::size().
Referenced by network::send_data(), and network::send_data_all_except().
void game::send_data_observers | ( | simple_wml::document & | data, | |
const network::connection | exclude | |||
) | const |
Definition at line 1082 of file server/game.cpp.
References simple_wml::string_span::begin(), observers_, simple_wml::document::output_compressed(), network::send_raw_data(), and simple_wml::string_span::size().
void game::send_data_team | ( | simple_wml::document & | data, | |
const simple_wml::string_span & | team, | |||
const network::connection | exclude | |||
) | const |
Definition at line 1070 of file server/game.cpp.
References simple_wml::string_span::begin(), is_on_team(), simple_wml::document::output_compressed(), players_, network::send_raw_data(), and simple_wml::string_span::size().
void game::send_history | ( | const network::connection | sock | ) | const |
Definition at line 1147 of file server/game.cpp.
References buf, simple_wml::document::compress(), data, history_, simple_wml::INIT_STATIC, simple_wml::document::output_compressed(), and network::send_raw_data().
void game::send_observerjoins | ( | const network::connection | sock | ) | const |
Send [observer] tags of all the observers in the game to the user or everyone if none given.
Definition at line 1111 of file server/game.cpp.
References simple_wml::string_span::begin(), cfg, data, ERR_GAME, id_, observers_, simple_wml::document::output_compressed(), player_info_, simple_wml::document::root(), send_data(), network::send_raw_data(), and simple_wml::string_span::size().
void game::send_observerquit | ( | const player_map::const_iterator | observer | ) | const |
Definition at line 1135 of file server/game.cpp.
References player_info_, simple_wml::document::root(), and send_data().
void game::send_server_message | ( | const char * | message, | |
network::connection | sock, | |||
simple_wml::document * | docptr | |||
) | const |
Definition at line 1271 of file server/game.cpp.
References simple_wml::node::add_child(), cfg, simple_wml::document::root(), send_to_one(), simple_wml::node::set_attr(), simple_wml::node::set_attr_dup(), and started_.
void game::send_server_message_to_all | ( | const char * | message, | |
network::connection | exclude | |||
) | const |
void game::send_to_one | ( | simple_wml::document & | data, | |
const network::connection | sock | |||
) | const |
Definition at line 1064 of file server/game.cpp.
References simple_wml::string_span::begin(), simple_wml::document::output_compressed(), network::send_raw_data(), and simple_wml::string_span::size().
void game::send_user_list | ( | const network::connection | exclude | ) | const |
Definition at line 1021 of file server/game.cpp.
References all_game_users(), cfg, description_, player_info_, simple_wml::document::root(), send_data(), and started_.
void game::set_description | ( | simple_wml::node * | desc | ) |
Definition at line 1176 of file server/game.cpp.
References description_, password_, and simple_wml::node::set_attr().
void game::set_termination_reason | ( | const std::string & | reason | ) |
Definition at line 1183 of file server/game.cpp.
References simple_wml::document::child(), preferences::era(), level_, termination_, and simple_wml::string_span::to_string().
void game::start_game | ( | const player_map::const_iterator | starter | ) |
Definition at line 118 of file server/game.cpp.
References simple_wml::node::child(), DBG_GAME, end_turn(), end_turn_, history_, id_, simple_wml::INIT_COMPRESSED, network::ip_address(), level_, LOG_GAME, name_, nsides_, simple_wml::document::root(), send_data(), send_observerjoins(), started_, and update_side_data().
bool game::take_side | ( | const player_map::const_iterator | user | ) |
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 186 of file server/game.cpp.
References simple_wml::string_span::begin(), cfg, data, DBG_GAME, debug_player_info(), level_, gamemap::MAX_PLAYERS, simple_wml::document::output_compressed(), owner_, simple_wml::document::root(), network::send_raw_data(), side_controllers_, sides_, sides_taken_, simple_wml::string_span::size(), and started_.
void game::transfer_ai_sides | ( | ) |
Definition at line 459 of file server/game.cpp.
References simple_wml::string_span::begin(), data, lexical_cast(), simple_wml::document::output_compressed(), owner_, simple_wml::document::root(), send_and_record_server_message(), network::send_raw_data(), side_controllers_, sides_, and simple_wml::string_span::size().
void game::transfer_side_control | ( | const network::connection | sock, | |
const simple_wml::node & | cfg | |||
) |
Definition at line 321 of file server/game.cpp.
References DBG_GAME, ERR_GAME, is_member(), is_observer(), is_player(), level_, gamemap::MAX_PLAYERS, observers_, owner_, player_info_, players_, halo::remove(), simple_wml::document::root(), send_and_record_server_message(), send_change_controller(), send_data(), send_observerquit(), send_server_message(), side_controllers_, sides_, sides_taken_, and transfer_ai_sides().
void game::update_side_data | ( | ) |
Resets the side configuration according to the scenario data.
Definition at line 251 of file server/game.cpp.
References all_game_users(), DBG_GAME, debug_player_info(), ERR_GAME, id_, lg::info, level_, gamemap::MAX_PLAYERS, observers_, owner_, player_info_, players_, simple_wml::document::root(), side_controllers_, sides_, and sides_taken_.
game::~game | ( | ) |
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |