#include <connect_engine.hpp>
Public Member Functions | |
connect_engine (saved_game &state, const bool first_scenario, mp_campaign_info *campaign_info) | |
~connect_engine () | |
config * | current_config () |
void | import_user (const std::string &name, const bool observer, int side_taken=-1) |
void | import_user (const config &data, const bool observer, int side_taken=-1) |
bool | sides_available () const |
void | update_level () |
void | update_and_send_diff (bool update_time_of_day=false) |
bool | can_start_game () const |
void | start_game () |
void | start_game_commandline (const commandline_options &cmdline_opts) |
std::pair< bool, bool > | process_network_data (const config &data) |
int | find_user_side_index_by_id (const std::string &id) const |
const config & | level () const |
config & | scenario () |
const std::set< std::string > & | connected_users () const |
const std::vector< std::string > & | user_team_names () |
std::vector< side_engine_ptr > & | side_engines () |
const mp_game_settings & | params () const |
bool | first_scenario () const |
bool | force_lock_settings () const |
Private Member Functions | |
connect_engine (const connect_engine &) | |
void | operator= (const connect_engine &) |
void | send_level_data () const |
void | save_reserved_sides_information () |
void | load_previous_sides_users () |
void | update_side_controller_options () |
std::set< std::string > & | connected_users_rw () |
void | send_to_server (const config &cfg) const |
bool | receive_from_server (config &dst) const |
Private Attributes | |
config | level_ |
saved_game & | state_ |
const mp_game_settings & | params_ |
const ng::controller | default_controller_ |
mp_campaign_info * | campaign_info_ |
const bool | first_scenario_ |
bool | force_lock_settings_ |
std::vector< side_engine_ptr > | side_engines_ |
std::vector< const config * > | era_factions_ |
std::vector< std::string > | team_names_ |
std::vector< std::string > | user_team_names_ |
std::vector< std::string > | player_teams_ |
Friends | |
class | side_engine |
Definition at line 47 of file connect_engine.hpp.
ng::connect_engine::connect_engine | ( | saved_game & | state, |
const bool | first_scenario, | ||
mp_campaign_info * | campaign_info | ||
) |
players | the player which are already connected to the current game. This is always empty unless we advance form a previous scenario. |
Definition at line 80 of file connect_engine.cpp.
References _(), game_config::add_color_info(), ai::configuration::add_era_ai_from_config(), ai::configuration::add_mod_ai_from_config(), config::child(), config::child_range(), saved_game::classification(), current_config(), game_config::debug, config::attribute_value::empty(), config::empty(), preferences::era(), era_factions_, gui2::event::find(), first_scenario_, force_lock_settings_, import_user(), mp::initial_level_config(), game_classification::is_normal_mp_game(), level_, load_previous_sides_users(), preferences::login(), saved_game::mp_settings(), params_, player_teams_, mp_game_settings::saved_game, scenario(), send_level_data(), side_engine, side_engines_, state_, config::attribute_value::str(), config::attribute_value::t_str(), team_names_, t_string::to_serialized(), update_level(), mp_game_settings::use_map_settings, and user_team_names_.
ng::connect_engine::~connect_engine | ( | ) |
Definition at line 207 of file connect_engine.cpp.
|
private |
bool ng::connect_engine::can_start_game | ( | ) | const |
Definition at line 317 of file connect_engine.cpp.
References ng::CNTR_EMPTY, DBG_MP, and side_engines_.
Referenced by mp::connect::process_event_impl(), mp::connect::process_network_data(), and mp::connect::update_playerlist_state().
const std::set< std::string > & ng::connect_engine::connected_users | ( | ) | const |
Definition at line 851 of file connect_engine.cpp.
References campaign_info_, and mp_campaign_info::connected_players.
Referenced by load_previous_sides_users(), process_network_data(), ng::side_engine::update_controller_options(), and mp::connect::update_playerlist_state().
|
private |
Definition at line 861 of file connect_engine.cpp.
References campaign_info_, and mp_campaign_info::connected_players.
Referenced by import_user(), and process_network_data().
config * ng::connect_engine::current_config | ( | ) |
Definition at line 211 of file connect_engine.cpp.
References scenario().
Referenced by connect_engine(), and create_side_engine().
int ng::connect_engine::find_user_side_index_by_id | ( | const std::string & | id | ) | const |
Definition at line 763 of file connect_engine.cpp.
References i, and side_engines_.
Referenced by process_network_data().
|
inline |
Definition at line 101 of file connect_engine.hpp.
References first_scenario_.
|
inline |
Definition at line 102 of file connect_engine.hpp.
References force_lock_settings_.
Referenced by mp::connect::force_lock_settings().
void ng::connect_engine::import_user | ( | const std::string & | name, |
const bool | observer, | ||
int | side_taken = -1 |
||
) |
Definition at line 218 of file connect_engine.cpp.
Referenced by connect_engine(), load_previous_sides_users(), and process_network_data().
void ng::connect_engine::import_user | ( | const config & | data, |
const bool | observer, | ||
int | side_taken = -1 |
||
) |
Definition at line 226 of file connect_engine.cpp.
References campaign_info_, ng::CNTR_COMPUTER, ng::CNTR_LOCAL, connected_users_rw(), side_engines_, and update_side_controller_options().
|
inline |
Definition at line 86 of file connect_engine.hpp.
References level_.
Referenced by mp::connect::connect().
|
private |
Definition at line 816 of file connect_engine.cpp.
References campaign_info_, config::child(), ng::CNTR_COMPUTER, ng::CNTR_RESERVED, connected_users(), gui2::event::find(), import_user(), level_, utils::map_split(), and side_engines_.
Referenced by connect_engine().
|
private |
|
inline |
Definition at line 100 of file connect_engine.hpp.
References params_.
Referenced by mp::connect::params().
std::pair< bool, bool > ng::connect_engine::process_network_data | ( | const config & | data | ) |
Definition at line 613 of file connect_engine.cpp.
References config::add_child(), config::child(), connected_users(), connected_users_rw(), t_string::empty(), ERR_CF, gui2::event::find(), find_user_side_index_by_id(), first_scenario_, import_user(), LOG_CF, LOG_MP, LOG_NW, game_config::images::observer, send_to_server(), side_engines_, update_and_send_diff(), and update_side_controller_options().
Referenced by mp::connect::process_network_data().
|
private |
Definition at line 358 of file connect_engine.cpp.
References campaign_info_, twesnothd_connection::receive_data(), and mp_campaign_info::wesnothd_connection.
|
private |
Definition at line 800 of file connect_engine.cpp.
References config::child(), config::child_or_empty(), utils::join_map(), level_, utils::map_split(), and side_engines_.
Referenced by start_game(), and start_game_commandline().
|
inline |
Definition at line 87 of file connect_engine.hpp.
References config::child(), and level_.
Referenced by mp::connect::connect(), connect_engine(), current_config(), ng::side_engine::side_engine(), start_game_commandline(), and update_level().
|
private |
Definition at line 781 of file connect_engine.cpp.
References config::add_child(), first_scenario_, level_, mp_game_settings::name, params_, mp_game_settings::password, and send_to_server().
Referenced by connect_engine().
Definition at line 351 of file connect_engine.cpp.
References campaign_info_, twesnothd_connection::send_data(), and mp_campaign_info::wesnothd_connection.
Referenced by process_network_data(), send_level_data(), start_game(), start_game_commandline(), and update_and_send_diff().
|
inline |
Definition at line 99 of file connect_engine.hpp.
References side_engines_.
Referenced by mp::connect::connect(), and ng::side_engine::side_engine().
bool ng::connect_engine::sides_available | ( | ) | const |
Definition at line 282 of file connect_engine.cpp.
References side_engines_.
Referenced by mp::connect::update_playerlist_state().
void ng::connect_engine::start_game | ( | ) |
Definition at line 405 of file connect_engine.cpp.
References config::child(), DBG_MP, force_lock_settings_, rand_rng::mt_rng::get_next_random(), i, level_, mp::level_to_gamestate(), saved_game::mp_settings(), params_, save_reserved_sides_information(), send_to_server(), mp_game_settings::shuffle_sides, side_engines_, state_, and update_and_send_diff().
Referenced by sp::enter_connect_mode(), and mp::connect::start_game().
void ng::connect_engine::start_game_commandline | ( | const commandline_options & | cmdline_opts | ) |
Definition at line 494 of file connect_engine.cpp.
References DBG_MP, era_factions_, ERR_MP, level_, mp::level_to_gamestate(), commandline_options::multiplayer_ai_config, commandline_options::multiplayer_algorithm, commandline_options::multiplayer_controller, commandline_options::multiplayer_ignore_map_settings, commandline_options::multiplayer_parm, commandline_options::multiplayer_side, commandline_options::multiplayer_turns, save_reserved_sides_information(), scenario(), send_to_server(), side_engines_, state_, and update_and_send_diff().
Referenced by mp::connect::start_game_commandline().
void ng::connect_engine::update_and_send_diff | ( | bool | update_time_of_day = false | ) |
Definition at line 304 of file connect_engine.cpp.
References config::add_child(), config::empty(), config::get_diff(), level_, send_to_server(), and update_level().
Referenced by mp::connect::process_event_impl(), process_network_data(), start_game(), and start_game_commandline().
void ng::connect_engine::update_level | ( | ) |
Definition at line 293 of file connect_engine.cpp.
References config::add_child(), config::clear_children(), DBG_MP, scenario(), and side_engines_.
Referenced by connect_engine(), and update_and_send_diff().
|
private |
Definition at line 843 of file connect_engine.cpp.
References side_engines_.
Referenced by import_user(), and process_network_data().
|
inline |
Definition at line 97 of file connect_engine.hpp.
References user_team_names_.
|
friend |
Definition at line 115 of file connect_engine.hpp.
Referenced by connect_engine().
|
private |
Definition at line 123 of file connect_engine.hpp.
Referenced by connected_users(), connected_users_rw(), import_user(), load_previous_sides_users(), receive_from_server(), send_to_server(), and ng::side_engine::update_controller_options().
|
private |
Definition at line 122 of file connect_engine.hpp.
Referenced by ng::side_engine::controller_changed(), ng::side_engine::place_user(), ng::side_engine::reset(), ng::side_engine::side_engine(), and ng::side_engine::update_controller_options().
|
private |
Definition at line 129 of file connect_engine.hpp.
Referenced by connect_engine(), and start_game_commandline().
|
private |
Definition at line 124 of file connect_engine.hpp.
Referenced by connect_engine(), first_scenario(), process_network_data(), and send_level_data().
|
private |
Definition at line 126 of file connect_engine.hpp.
Referenced by connect_engine(), force_lock_settings(), and start_game().
|
private |
Definition at line 117 of file connect_engine.hpp.
Referenced by connect_engine(), level(), load_previous_sides_users(), save_reserved_sides_information(), scenario(), send_level_data(), start_game(), start_game_commandline(), and update_and_send_diff().
|
private |
Definition at line 120 of file connect_engine.hpp.
Referenced by connect_engine(), ng::side_engine::new_config(), params(), ng::side_engine::reset(), ng::side_engine::resolve_random(), send_level_data(), ng::side_engine::side_engine(), and start_game().
|
private |
Definition at line 132 of file connect_engine.hpp.
Referenced by connect_engine(), and ng::side_engine::player_teams().
|
private |
Definition at line 128 of file connect_engine.hpp.
Referenced by can_start_game(), connect_engine(), find_user_side_index_by_id(), import_user(), load_previous_sides_users(), process_network_data(), save_reserved_sides_information(), side_engines(), sides_available(), start_game(), start_game_commandline(), ng::side_engine::swap_sides_on_drop_target(), update_level(), and update_side_controller_options().
|
private |
Definition at line 118 of file connect_engine.hpp.
Referenced by connect_engine(), ng::side_engine::side_engine(), start_game(), and start_game_commandline().
|
private |
Definition at line 130 of file connect_engine.hpp.
Referenced by connect_engine(), ng::side_engine::new_config(), and ng::side_engine::side_engine().
|
private |
Definition at line 131 of file connect_engine.hpp.
Referenced by connect_engine(), ng::side_engine::new_config(), and user_team_names().