#include "multiplayer.hpp"
#include "addon/manager.hpp"
#include "config_assign.hpp"
#include "dialogs.hpp"
#include "formula/string_utils.hpp"
#include "game_preferences.hpp"
#include "generators/map_create.hpp"
#include "generators/map_generator.hpp"
#include "gettext.hpp"
#include "gui/dialogs/lobby/lobby.hpp"
#include "gui/dialogs/message.hpp"
#include "gui/dialogs/multiplayer/mp_connect.hpp"
#include "gui/dialogs/multiplayer/mp_create_game.hpp"
#include "gui/dialogs/multiplayer/mp_login.hpp"
#include "gui/dialogs/network_transmission.hpp"
#include "gui/widgets/settings.hpp"
#include "gui/widgets/window.hpp"
#include "hash.hpp"
#include "lobby_reload_request_exception.hpp"
#include "log.hpp"
#include "mp_game_utils.hpp"
#include "multiplayer_configure.hpp"
#include "configure_engine.hpp"
#include "multiplayer_connect.hpp"
#include "multiplayer_create.hpp"
#include "multiplayer_error_codes.hpp"
#include "multiplayer_wait.hpp"
#include "multiplayer_lobby.hpp"
#include "playcampaign.hpp"
#include "settings.hpp"
#include "scripting/plugins/context.hpp"
#include "sdl/rect.hpp"
#include "sound.hpp"
#include "statistics.hpp"
#include "units/id.hpp"
#include "video.hpp"
#include "wesnothd_connection.hpp"
#include "game_config_manager.hpp"
#include "utils/functional.hpp"
Go to the source code of this file.
Namespaces | |
mp | |
This module controls the multiplayer lobby. | |
Macros | |
#define | LOG_NW LOG_STREAM(info, log_network) |
#define | DBG_MP LOG_STREAM(debug, log_mp) |
Functions | |
void | mp::run_lobby_loop (CVideo &video, mp::ui &ui) |
static std::unique_ptr < twesnothd_connection > | open_connection (CVideo &video, const std::string &original_host) |
static void | enter_wait_mode (CVideo &video, const config &game_config, saved_game &state, twesnothd_connection *wesnothd_connection, bool observe, int current_turn=0) |
static void | enter_create_mode (CVideo &video, const config &game_config, saved_game &state, twesnothd_connection *wesnothd_connection, bool local_players_only=false) |
static bool | enter_connect_mode (CVideo &video, const config &game_config, saved_game &state, twesnothd_connection *wesnothd_connection, bool local_players_only=false) |
static bool | enter_configure_mode (CVideo &video, const config &game_config, saved_game &state, twesnothd_connection *wesnothd_connection, bool local_players_only=false) |
static void | do_preferences_dialog (CVideo &video, const config &game_config) |
static void | enter_lobby_mode (CVideo &video, const config &game_config, saved_game &state, twesnothd_connection *wesnothd_connection, const std::vector< std::string > &installed_addons) |
void | mp::start_local_game (CVideo &video, const config &game_config, saved_game &state) |
Starts a multiplayer game in single-user mode. More... | |
void | mp::start_local_game_commandline (CVideo &video, const config &game_config, saved_game &state, const commandline_options &cmdline_opts) |
Starts a multiplayer game in single-user mode. More... | |
void | mp::start_client (CVideo &video, const config &game_config, saved_game &state, const std::string &host) |
Starts a multiplayer game in client mode. More... | |
mp::ui::result | mp::goto_mp_connect (CVideo &video, ng::connect_engine &engine, const config &game_config, twesnothd_connection *wesnothd_connection, const std::string &game_name) |
Opens mp::connect screen and sets game state according to the changes made. More... | |
mp::ui::result | mp::goto_mp_wait (CVideo &video, saved_game &state, const config &game_config, twesnothd_connection *wesnothd_connection, bool observe) |
Opens mp::wait screen and sets game state according to the changes made. More... | |
Variables | |
static lg::log_domain | log_network ("network") |
static lg::log_domain | log_mp ("mp/main") |
#define DBG_MP LOG_STREAM(debug, log_mp) |
Definition at line 61 of file multiplayer.cpp.
Referenced by do_preferences_dialog(), enter_configure_mode(), enter_connect_mode(), enter_create_mode(), enter_lobby_mode(), enter_wait_mode(), open_connection(), mp::run_lobby_loop(), mp::start_client(), mp::start_local_game(), and mp::start_local_game_commandline().
#define LOG_NW LOG_STREAM(info, log_network) |
Definition at line 58 of file multiplayer.cpp.
The screen size might have changed force an update of the size.
Definition at line 614 of file multiplayer.cpp.
References DBG_MP, gui2::settings::gamemap_height, gui2::settings::gamemap_width, screen_area(), gui2::settings::screen_height, gui2::settings::screen_width, CVideo::set_resolution(), and preferences::show_preferences_dialog().
Referenced by enter_lobby_mode().
|
static |
Definition at line 572 of file multiplayer.cpp.
References _(), config::child(), mp::ui::CREATE, DBG_MP, enter_connect_mode(), mp::configure::get_parameters(), mp::ui::get_result(), saved_game::get_starting_pos(), mp::ui::QUIT, mp::run_lobby_loop(), twesnothd_connection::send_data(), and gui2::show_error_message().
Referenced by enter_create_mode().
|
static |
Definition at line 457 of file multiplayer.cpp.
References mp_campaign_info::connected_players, mp::ui::CREATE, DBG_MP, enter_create_mode(), statistics::fresh_stats(), game_config_manager::get(), mp_campaign_info::is_host, preferences::login(), saved_game::mp_settings(), mp_game_settings::name, mp::ui::PLAY, campaign_controller::play_game(), mp::ui::QUIT, mp::run_lobby_loop(), twesnothd_connection::send_data(), and campaign_controller::set_mp_info().
Referenced by enter_configure_mode(), and enter_create_mode().
|
static |
Definition at line 521 of file multiplayer.cpp.
References mp::ui::CREATE, DBG_MP, enter_configure_mode(), enter_connect_mode(), mp::create::get_parameters(), mp::ui::get_result(), mp::ui::LOAD_GAME, gui2::new_widgets, mp::ui::QUIT, mp::run_lobby_loop(), twesnothd_connection::send_data(), and gui2::tdialog::show().
Referenced by enter_connect_mode(), enter_lobby_mode(), and mp::start_local_game().
|
static |
Definition at line 634 of file multiplayer.cpp.
References config::child(), config::child_range(), sound::commit_music_changes(), mp::ui::CREATE, gui2::tlobby_main::CREATE, mp::lobby::current_turn, DBG_MP, do_preferences_dialog(), sound::empty_playlist(), enter_create_mode(), enter_wait_mode(), error(), sdl::fill_rect(), gui2::tlobby_main::get_legacy_result(), mp::ui::get_result(), CVideo::getSurface(), i, mp::ui::JOIN, gui2::tlobby_main::JOIN, game::error::message, preferences::new_lobby(), mp::ui::OBSERVE, gui2::tlobby_main::OBSERVE, sound::play_music_config(), mp::ui::PREFERENCES, mp::ui::QUIT, mp::run_lobby_loop(), twesnothd_connection::send_data(), gui2::tlobby_main::set_preferences_callback(), gui2::tdialog::show(), gui2::show_error_message(), and sound::stop_music().
Referenced by mp::start_client().
|
static |
Definition at line 408 of file multiplayer.cpp.
References preferences::blindfold_replay(), mp_campaign_info::connected_players, DBG_MP, statistics::fresh_stats(), game_config_manager::get(), mp::ui::get_result(), mp_campaign_info::is_host, mp::wait::join_game(), mp::ui::PLAY, campaign_controller::play_game(), mp::ui::QUIT, mp::run_lobby_loop(), twesnothd_connection::send_data(), campaign_controller::set_mp_info(), preferences::skip_mp_replay(), mp_campaign_info::skip_replay_blindfolded, mp_campaign_info::skip_replay_until_turn, mp::wait::start_game(), and mp::ui::user_list().
Referenced by enter_lobby_mode().
|
static |
Definition at line 110 of file multiplayer.cpp.
References _(), config::add_child(), gui2::twindow::CANCEL, config::child(), config::clear(), util::create_hash(), DBG_MP, error(), util::get_iteration_count(), preferences::get_ping_timeout(), gui2::tdialog::get_retval(), util::get_salt(), h, config::has_attribute(), config::has_child(), preferences::login(), MP_INCORRECT_PASSWORD_ERROR, MP_INVALID_CHARS_IN_NAME_ERROR, MP_MUST_LOGIN, MP_NAME_INACTIVE_WARNING, MP_NAME_RESERVED_ERROR, MP_NAME_TAKEN_ERROR, MP_NAME_TOO_LONG_ERROR, MP_NAME_UNREGISTERED_ERROR, MP_NO_SEED_ERROR, MP_PASSWORD_REQUEST, MP_PASSWORD_REQUEST_FOR_LOGGED_IN_NAME, MP_TOO_MANY_ATTEMPTS_ERROR, dialogs::network_connect_dialog(), preferences::network_host(), dialogs::network_receive_dialog(), gui2::twindow::OK, gui2::tmessage::ok_cancel_buttons, preferences::prv::password, preferences::password(), pos, twesnothd_connection::send_data(), preferences::server_list(), preferences::set_network_host(), gui2::tdialog::show(), gui2::show_message(), game_config::version, vgettext(), and gui2::tmessage::yes_no_buttons.
Referenced by mp::start_client().
|
static |
|
static |