#include <multiplayer_lobby.hpp>
Classes | |
class | lobby_sorter |
struct | process_event_data |
Public Member Functions | |
lobby (CVideo &v, twesnothd_connection *wesnothd_connection, const config &cfg, chat &c, config &gamelist, const std::vector< std::string > &installed_addons) | |
virtual void | process_event () |
Public Member Functions inherited from mp::ui | |
ui (CVideo &v, twesnothd_connection *wesnothd_connection, const std::string &title, const config &cfg, chat &c, config &gamelist) | |
void | process_network () |
Asks the multiplayer_ui to pump some data from the network, and then to process it. More... | |
result | get_result () |
Returns the result of the current widget. More... | |
void | set_location (const SDL_Rect &rect) |
Hides children, moves them (using layout_children), then shows them. More... | |
const std::vector< std::string > & | user_list () const |
void | send_to_server (const config &cfg) override |
bool | receive_from_server (config &dst) |
plugins_context * | get_plugins_context () |
Public Member Functions inherited from gui::widget | |
SDL_Rect const & | location () const |
void | set_location (int x, int y) |
void | set_width (int w) |
void | set_height (int h) |
void | set_measurements (int w, int h) |
int | width () const |
int | height () const |
bool | focus (const SDL_Event *event) |
void | set_focus (bool focus) |
virtual void | hide (bool value=true) |
bool | hidden () const |
virtual void | enable (bool new_val=true) |
bool | enabled () const |
void | set_clip_rect (const SDL_Rect &rect) |
void | set_volatile (bool val=true) |
void | set_dirty (bool dirty=true) |
bool | dirty () const |
const std::string & | id () const |
void | set_id (const std::string &id) |
void | set_help_string (const std::string &str) |
void | set_tooltip_string (const std::string &str) |
virtual void | process_help_string (int mousex, int mousey) |
virtual void | process_tooltip_string (int mousex, int mousey) |
Public Member Functions inherited from events::sdl_handler | |
virtual bool | requires_event_focus (const SDL_Event *=nullptr) const |
virtual void | join () |
virtual void | join (context &c) |
virtual void | join_same (sdl_handler *parent) |
virtual void | leave () |
virtual void | join_global () |
virtual void | leave_global () |
Public Attributes | |
int | current_turn |
Protected Member Functions | |
virtual void | hide_children (bool hide=true) |
Hides or shows all gui::widget children of this widget. More... | |
virtual void | layout_children (const SDL_Rect &rect) |
Lays the children out. More... | |
virtual void | process_network_data (const config &data) |
Processes any pending network data. More... | |
virtual void | gamelist_updated (bool silent=true) |
Called each time the gamelist_ variable is updated. More... | |
Protected Member Functions inherited from mp::ui | |
int | xscale (int x) const |
int | yscale (int y) const |
SDL_Rect | client_area () const |
CVideo & | video () |
const config & | game_config () const |
Returns the main game config, as defined by loading the preprocessed WML files. More... | |
virtual void | draw_contents () |
virtual void | handle_event (const SDL_Event &event) |
virtual void | handle_key_event (const SDL_KeyboardEvent &event) |
void | add_chat_message (const time_t &time, const std::string &speaker, int side, const std::string &message, events::chat_handler::MESSAGE_TYPE type=events::chat_handler::MESSAGE_PRIVATE) |
Override chat_handler. More... | |
void | send_chat_message (const std::string &message, bool allies_only=false) |
void | process_message (const config &msg, const bool whisper=false) |
Process chat messages. More... | |
result | set_result (result res) |
Sets the result of this dialog, to be checked by get_result(). More... | |
void | set_selected_game (const std::string &game_name) |
Sets the name of the selected game which is used to highlight the names of the players which have joined this game. More... | |
void | set_user_list (const std::vector< std::string > &, bool silent) |
Sets the user list. More... | |
void | set_user_menu_items (const std::vector< std::string > &list) |
config & | gamelist () |
Returns the current gamelist. More... | |
void | append_to_title (const std::string &name) |
const gui::label & | title () const |
std::string | get_selected_user_game () |
bool | selected_user_changed () const |
void | set_selected_user_changed (const bool &changed) |
Protected Member Functions inherited from gui::widget | |
widget (widget const &o) | |
widget (CVideo &video, const bool auto_join=true) | |
virtual | ~widget () |
void | bg_register (SDL_Rect const &rect) |
void | bg_restore () const |
void | bg_restore (SDL_Rect const &rect) const |
void | bg_update () |
void | bg_cancel () |
CVideo & | video () const |
virtual void | draw () |
virtual void | update_location (SDL_Rect const &rect) |
const SDL_Rect * | clip_rect () const |
virtual sdl_handler_vector | member_handlers () |
virtual void | handle_window_event (SDL_Event const &event) |
bool | mouse_locked () const |
void | aquire_mouse_lock () |
void | free_mouse_lock () |
Protected Member Functions inherited from events::sdl_handler | |
sdl_handler (const bool auto_join=true) | |
virtual | ~sdl_handler () |
virtual std::vector < sdl_handler * > | handler_members () |
Private Member Functions | |
void | process_event_impl (const process_event_data &) |
bool | plugin_event_helper (const process_event_data &) |
Private Attributes | |
std::vector< bool > | game_vacant_slots_ |
std::vector< bool > | game_observers_ |
gui::button | observe_game_ |
gui::button | join_game_ |
gui::button | create_game_ |
gui::combo | replay_options_ |
gui::button | game_preferences_ |
gui::button | quit_game_ |
gui::button | apply_filter_ |
gui::button | invert_filter_ |
gui::button | vacant_slots_ |
gui::button | friends_in_game_ |
gui::label | filter_label_ |
gui::textbox | filter_text_ |
int | last_selected_game_ |
lobby_sorter | sorter_ |
gamebrowser | games_menu_ |
std::map< std::string, std::string > | minimaps_ |
std::string | search_string_ |
const std::vector< std::string > & | installed_addons_ |
Additional Inherited Members | |
Public Types inherited from mp::ui | |
enum | result { CONTINUE, JOIN, OBSERVE, CREATE, LOAD_GAME, PREFERENCES, PLAY, QUIT } |
enum | user_relation { ME, FRIEND, NEUTRAL, IGNORED } |
enum | user_state { LOBBY, GAME, SEL_GAME } |
Protected Attributes inherited from mp::ui | |
CVideo & | video_ |
twesnothd_connection * | wesnothd_connection_ |
boost::scoped_ptr < plugins_context > | plugins_context_ |
Protected Attributes inherited from gui::widget | |
bool | focus_ |
Static Protected Attributes inherited from mp::ui | |
static const int | xscale_base = 1024 |
static const int | yscale_base = 768 |
Definition at line 187 of file multiplayer_lobby.hpp.
mp::lobby::lobby | ( | CVideo & | v, |
twesnothd_connection * | wesnothd_connection, | ||
const config & | cfg, | ||
chat & | c, | ||
config & | gamelist, | ||
const std::vector< std::string > & | installed_addons | ||
) |
Definition at line 1027 of file multiplayer_lobby.cpp.
References _(), apply_filter_, preferences::blindfold_replay(), gui::button::checked(), gui::widget::enable(), gui::button::enable(), preferences::fi_friends_in_game(), preferences::fi_invert(), preferences::fi_vacant_slots(), filter_label_, preferences::filter_lobby(), filter_text_, friends_in_game_, mp::ui::game_config(), mp::ui::gamelist(), gamelist_updated(), games_menu_, get_str, invert_filter_, game_config::lobby_music, sound::play_music_repeatedly(), plugin_event_helper(), mp::ui::plugins_context_, replay_options_, search_string_, mp::gamebrowser::select_game(), mp::ui::send_chat_message(), gui::button::set_check(), gui::widget::set_help_string(), gui::combo::set_items(), gui::combo::set_selected(), gui::textbox::set_text(), preferences::skip_mp_replay(), and vacant_slots_.
|
protectedvirtual |
Called each time the gamelist_ variable is updated.
May be overridden by child classes to add custom gamelist behavior.
Reimplemented from mp::ui.
Definition at line 1168 of file multiplayer_lobby.cpp.
References config::child(), gui::button::enable(), mp::ui::game_config(), mp::ui::gamelist(), mp::ui::gamelist_updated(), games_menu_, installed_addons_, join_game_, observe_game_, mp::gamebrowser::selection_is_joinable(), mp::gamebrowser::selection_is_observable(), and mp::gamebrowser::set_game_items().
Referenced by lobby(), and process_event_impl().
|
protectedvirtual |
Hides or shows all gui::widget children of this widget.
Should be overridden by subclasses which add their own children.
Reimplemented from mp::ui.
Definition at line 1110 of file multiplayer_lobby.cpp.
References apply_filter_, create_game_, filter_label_, filter_text_, friends_in_game_, game_preferences_, games_menu_, gui::scrollarea::hide(), gui::widget::hide(), mp::ui::hide_children(), invert_filter_, join_game_, observe_game_, quit_game_, replay_options_, and vacant_slots_.
|
protectedvirtual |
Lays the children out.
This method is to be overridden by the subclasses of the mp_ui class; it will be called.
Reimplemented from mp::ui.
Definition at line 1129 of file multiplayer_lobby.cpp.
References apply_filter_, gui::ButtonVPadding, mp::ui::client_area(), create_game_, filter_label_, filter_text_, friends_in_game_, game_preferences_, games_menu_, gui::widget::height(), invert_filter_, join_game_, mp::ui::layout_children(), gui::widget::location(), observe_game_, quit_game_, replay_options_, gui::widget::set_location(), gui::widget::set_measurements(), schema_validation::space, mp::ui::title(), vacant_slots_, mp::ui::xscale(), mp::ui::xscale_base, and mp::ui::yscale().
|
private |
Definition at line 1370 of file multiplayer_lobby.cpp.
References mp::ui::CONTINUE, mp::ui::get_result(), and process_event_impl().
Referenced by lobby().
|
virtual |
Reimplemented from mp::ui.
Definition at line 1181 of file multiplayer_lobby.cpp.
References mp::lobby::process_event_data::create, create_game_, mp::lobby::process_event_data::join, join_game_, mp::lobby::process_event_data::observe, observe_game_, gui::button::pressed(), process_event_impl(), mp::lobby::process_event_data::quit, and quit_game_.
|
private |
Definition at line 1238 of file multiplayer_lobby.cpp.
References _(), config::add_child(), apply_filter_, gui::button::checked(), mp::ui::CREATE, mp::lobby::process_event_data::create, mp::gamebrowser::game_item::current_turn, current_turn, mp::gamebrowser::empty(), gui::widget::enable(), gui::button::enable(), gui2::tmp_join_game_password_prompt::execute(), filter_label_, filter_text_, friends_in_game_, game_preferences_, mp::ui::gamelist_updated(), gamelist_updated(), games_menu_, mp::ui::get_selected_user_game(), mp::handle_addon_requirements_gui(), mp::gamebrowser::game_item::id, invert_filter_, events::sdl_handler::join(), mp::ui::JOIN, mp::lobby::process_event_data::join, join_game_, last_selected_game_, mp::ui::OBSERVE, mp::lobby::process_event_data::observe, observe_game_, preferences::prv::password, mp::gamebrowser::game_item::password_required, mp::ui::PREFERENCES, gui::button::pressed(), mp::ui::QUIT, mp::lobby::process_event_data::quit, replay_options_, mp::gamebrowser::reset_selection(), search_string_, mp::gamebrowser::select_game(), gui::combo::selected(), game_config::images::selected, mp::gamebrowser::selected(), mp::gamebrowser::selected_game(), mp::ui::selected_user_changed(), mp::gamebrowser::selection(), mp::gamebrowser::selection_addon_outcome(), mp::gamebrowser::selection_addon_requirements(), mp::gamebrowser::selection_is_joinable(), mp::gamebrowser::selection_is_observable(), mp::gamebrowser::selection_needs_addons(), mp::ui::send_to_server(), preferences::set_blindfold_replay(), preferences::set_fi_friends_in_game(), preferences::set_fi_invert(), preferences::set_fi_text(), preferences::set_fi_vacant_slots(), preferences::set_filter_lobby(), preferences::set_message_private(), mp::ui::set_result(), mp::ui::set_selected_game(), mp::ui::set_selected_user_changed(), preferences::set_skip_mp_replay(), gui2::show_error_message(), gui::textbox::text(), vacant_slots_, and mp::ui::video().
Referenced by plugin_event_helper(), and process_event().
Processes any pending network data.
Called by the public process_network() method. Overridden by subclasses who add more behavior for network.
Reimplemented from mp::ui.
Definition at line 1376 of file multiplayer_lobby.cpp.
References last_selected_game_, and mp::ui::process_network_data().
|
private |
Definition at line 225 of file multiplayer_lobby.hpp.
Referenced by hide_children(), layout_children(), lobby(), and process_event_impl().
|
private |
Definition at line 220 of file multiplayer_lobby.hpp.
Referenced by hide_children(), layout_children(), and process_event().
int mp::lobby::current_turn |
Definition at line 194 of file multiplayer_lobby.hpp.
Referenced by enter_lobby_mode(), and process_event_impl().
|
private |
Definition at line 229 of file multiplayer_lobby.hpp.
Referenced by hide_children(), layout_children(), lobby(), and process_event_impl().
|
private |
Definition at line 230 of file multiplayer_lobby.hpp.
Referenced by hide_children(), layout_children(), lobby(), and process_event_impl().
|
private |
Definition at line 228 of file multiplayer_lobby.hpp.
Referenced by hide_children(), layout_children(), lobby(), and process_event_impl().
|
private |
Definition at line 216 of file multiplayer_lobby.hpp.
|
private |
Definition at line 222 of file multiplayer_lobby.hpp.
Referenced by hide_children(), layout_children(), and process_event_impl().
|
private |
Definition at line 215 of file multiplayer_lobby.hpp.
|
private |
Definition at line 235 of file multiplayer_lobby.hpp.
Referenced by gamelist_updated(), hide_children(), layout_children(), lobby(), and process_event_impl().
|
private |
Definition at line 241 of file multiplayer_lobby.hpp.
Referenced by gamelist_updated().
|
private |
Definition at line 226 of file multiplayer_lobby.hpp.
Referenced by hide_children(), layout_children(), lobby(), and process_event_impl().
|
private |
Definition at line 219 of file multiplayer_lobby.hpp.
Referenced by gamelist_updated(), hide_children(), layout_children(), process_event(), and process_event_impl().
|
private |
Definition at line 232 of file multiplayer_lobby.hpp.
Referenced by process_event_impl(), and process_network_data().
|
private |
Definition at line 237 of file multiplayer_lobby.hpp.
|
private |
Definition at line 218 of file multiplayer_lobby.hpp.
Referenced by gamelist_updated(), hide_children(), layout_children(), process_event(), and process_event_impl().
|
private |
Definition at line 223 of file multiplayer_lobby.hpp.
Referenced by hide_children(), layout_children(), and process_event().
|
private |
Definition at line 221 of file multiplayer_lobby.hpp.
Referenced by hide_children(), layout_children(), lobby(), and process_event_impl().
|
private |
Definition at line 239 of file multiplayer_lobby.hpp.
Referenced by lobby(), and process_event_impl().
|
private |
Definition at line 234 of file multiplayer_lobby.hpp.
|
private |
Definition at line 227 of file multiplayer_lobby.hpp.
Referenced by hide_children(), layout_children(), lobby(), and process_event_impl().