#include <multiplayer_lobby.hpp>
Classes | |
struct | game_item |
Public Member Functions | |
gamebrowser (CVideo &video, const config &map_hashes) | |
void | scroll (unsigned int pos) |
void | handle_event (const SDL_Event &event) |
void | set_inner_location (const SDL_Rect &rect) |
void | set_item_height (unsigned int height) |
void | populate_game_item (game_item &, const config &, const config &, const std::vector< std::string > &) |
void | populate_game_item_campaign_or_scenario_info (game_item &, const config &, const config &, bool &) |
void | populate_game_item_map_info (game_item &, const config &, const config &, bool &) |
void | populate_game_item_era_info (game_item &, const config &, const config &, bool &) |
void | populate_game_item_mod_info (game_item &, const config &, const config &, bool &) |
void | populate_game_item_addons_installed (game_item &, const config &, const std::vector< std::string > &) |
void | set_game_items (const config &cfg, const config &game_config, const std::vector< std::string > &installed_addons) |
void | draw () |
void | draw_contents () |
void | draw_row (const size_t row_index, const SDL_Rect &rect, ROW_TYPE type) |
SDL_Rect | get_item_rect (size_t index) const |
bool | empty () const |
bool | selection_is_joinable () const |
bool | selection_is_observable () const |
bool | selection_needs_content () const |
bool | selection_needs_addons () const |
bool | selection_in_joinable_state () const |
bool | selection_in_observable_state () const |
ADDON_REQ | selection_addon_outcome () const |
const std::vector < required_addon > * | selection_addon_requirements () const |
bool | selected () const |
void | reset_selection () |
int | selection () const |
game_item | selected_game () |
void | select_game (const std::string &id) |
bool | game_matches_filter (const game_item &i, const config &cfg) |
![]() | |
menu (CVideo &video, const std::vector< std::string > &items, bool click_selects=false, int max_height=-1, int max_width=-1, const sorter *sorter_obj=nullptr, style *menu_style=nullptr, const bool auto_join=true) | |
~menu () | |
Default implementation, but defined out-of-line for efficiency reasons. More... | |
int | selection () const |
void | move_selection (size_t id) |
void | move_selection_keeping_viewport (size_t id) |
void | reset_selection () |
const item & | get_item (int index) const |
const item & | get_selected_item () const |
void | change_item (int pos1, int pos2, const std::string &str) |
virtual void | erase_item (size_t index) |
void | set_heading (const std::vector< std::string > &heading) |
virtual void | set_items (const std::vector< std::string > &items, bool strip_spaces=true, bool keep_viewport=false) |
Set new items to show and redraw/recalculate everything. More... | |
void | set_max_height (const int new_max_height) |
Set a new max height for this menu. More... | |
void | set_max_width (const int new_max_width) |
int | get_max_height () |
int | get_max_width () |
size_t | number_of_items () const |
int | process () |
bool | double_clicked () |
void | set_click_selects (bool value) |
void | set_numeric_keypress_selection (bool value) |
void | scroll (unsigned int pos) |
void | set_sorter (sorter *s) |
void | sort_by (int column) |
int | get_sort_by () |
bool | get_sort_reversed () |
![]() | |
scrollarea (CVideo &video, bool auto_join=true) | |
Create a zone with automatic handling of scrollbar. More... | |
virtual void | hide (bool value=true) |
![]() | |
SDL_Rect const & | location () const |
virtual void | set_location (SDL_Rect const &rect) |
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) |
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_tooltip_string (int mousex, int mousey) |
![]() | |
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 () |
Protected Member Functions | |
unsigned int | row_height () const |
![]() | |
bool | item_ends_with_image (const std::string &item) const |
void | set_inner_location (const SDL_Rect &rect) |
bool | requires_event_focus (const SDL_Event *event=nullptr) const |
const std::vector< int > & | column_widths () const |
int | hit (int x, int y) const |
std::pair< int, int > | hit_cell (int x, int y) const |
int | hit_column (int x) const |
int | hit_heading (int x, int y) const |
void | invalidate_row (size_t id) |
void | invalidate_row_pos (size_t pos) |
void | invalidate_heading () |
![]() | |
virtual sdl_handler_vector | handler_members () |
virtual void | update_location (SDL_Rect const &rect) |
virtual void | process_event () |
SDL_Rect | inner_location () const |
unsigned | scrollbar_width () const |
unsigned | get_position () const |
unsigned | get_max_position () const |
void | set_position (unsigned pos) |
void | adjust_position (unsigned pos) |
void | move_position (int dep) |
void | set_shown_size (unsigned h) |
void | set_full_size (unsigned h) |
void | set_scroll_rate (unsigned r) |
bool | has_scrollbar () const |
![]() | |
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 |
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 () |
![]() | |
sdl_handler (const bool auto_join=true) | |
virtual | ~sdl_handler () |
Private Attributes | |
image::locator | gold_icon_locator_ |
image::locator | xp_icon_locator_ |
image::locator | map_size_icon_locator_ |
image::locator | vision_icon_locator_ |
image::locator | time_limit_icon_locator_ |
image::locator | observer_icon_locator_ |
image::locator | no_observer_icon_locator_ |
image::locator | shuffle_sides_icon_locator_ |
const config & | map_hashes_ |
unsigned int | item_height_ |
int | margin_ |
int | minimap_size_ |
int | h_padding_ |
int | h_padding_image_to_text_ |
int | header_height_ |
size_t | selected_ |
std::pair< size_t, size_t > | visible_range_ |
std::vector< game_item > | games_ |
std::vector< size_t > | redraw_items_ |
std::vector< int > | widths_ |
bool | double_clicked_ |
bool | ignore_next_doubleclick_ |
bool | last_was_doubleclick_ |
Additional Inherited Members | |
![]() | |
enum | ROW_TYPE { NORMAL_ROW, SELECTED_ROW, HEADING_ROW } |
![]() | |
static style & | default_style = menu::bluebg_style |
static style | simple_style |
static imgsel_style | bluebg_style |
![]() | |
style * | style_ |
bool | silent_ |
![]() | |
bool | focus_ |
Definition at line 45 of file multiplayer_lobby.hpp.
Definition at line 65 of file multiplayer_lobby.cpp.
References gui::menu::set_numeric_keypress_selection().
|
virtual |
Reimplemented from gui::widget.
Definition at line 124 of file multiplayer_lobby.cpp.
References util::scoped_resource< T *, delete_item >::assign(), gui::widget::bg_restore(), gui::widget::clip_rect(), gui::widget::dirty(), draw_contents(), gui::widget::hidden(), gui::widget::location(), gui::widget::set_dirty(), update_rect(), and gui::widget::video().
|
virtual |
Reimplemented from gui::widget.
Definition at line 139 of file multiplayer_lobby.cpp.
References _(), gui::menu::style::draw_row(), font::draw_text(), games_, get_item_rect(), i, gui::scrollarea::inner_location(), margin_, font::NORMAL_COLOR, gui::menu::NORMAL_ROW, selected_, gui::menu::SELECTED_ROW, font::SIZE_NORMAL, gui::menu::style_, gui::widget::video(), and visible_range_.
Referenced by draw().
|
virtual |
Reimplemented from gui::menu.
Definition at line 151 of file multiplayer_lobby.cpp.
References _(), mp::gamebrowser::game_item::addons_outcome, font::BAD_COLOR, CVideo::blit_surface(), font::DISABLED_COLOR, mp::gamebrowser::game_item::era_and_mod_info, games_, image::get_image(), font::get_rendered_text(), mp::gamebrowser::game_item::gold, gold_icon_locator_, font::GOOD_COLOR, font::GRAY_COLOR, h_padding_, h_padding_image_to_text_, mp::gamebrowser::game_item::have_all_mods, mp::gamebrowser::game_item::have_era, mp::gamebrowser::game_item::have_scenario, font::make_text_ellipsis(), mp::gamebrowser::game_item::map_data, mp::gamebrowser::game_item::map_info, mp::gamebrowser::game_item::map_info_size, map_size_icon_locator_, margin_, mp::gamebrowser::game_item::mini_map, minimap_size_, mp::gamebrowser::game_item::name, mp::NEED_DOWNLOAD, no_observer_icon_locator_, font::NORMAL_COLOR, observer_icon_locator_, mp::gamebrowser::game_item::observers, mp::gamebrowser::game_item::reloaded, mp::SATISFIED, mp::gamebrowser::game_item::shuffle_sides, shuffle_sides_icon_locator_, font::SIZE_NORMAL, font::SIZE_PLUS, mp::gamebrowser::game_item::started, mp::gamebrowser::game_item::status, mp::gamebrowser::game_item::time_limit, time_limit_icon_locator_, mp::gamebrowser::game_item::use_map_settings, mp::gamebrowser::game_item::vacant_slots, mp::gamebrowser::game_item::verified, gui::widget::video(), mp::gamebrowser::game_item::vision, vision_icon_locator_, mp::gamebrowser::game_item::xp, xp_icon_locator_, and font::YELLOW_COLOR.
|
inline |
Definition at line 129 of file multiplayer_lobby.hpp.
References games_.
Referenced by populate_game_item_campaign_or_scenario_info(), populate_game_item_era_info(), mp::lobby::process_event_impl(), select_game(), selected(), selection_addon_outcome(), selection_addon_requirements(), selection_in_joinable_state(), selection_in_observable_state(), selection_needs_addons(), and selection_needs_content().
Definition at line 921 of file multiplayer_lobby.cpp.
References chars_equal_insensitive(), config::child_range(), gui2::contains(), mp::gamebrowser::game_item::era_and_mod_info, preferences::fi_friends_in_game(), preferences::fi_text(), preferences::fi_vacant_slots(), mp::gamebrowser::game_item::id, preferences::is_friend(), mp::gamebrowser::game_item::map_info, mp::gamebrowser::game_item::name, utils::split(), utils::STRIP_SPACES, and mp::gamebrowser::game_item::vacant_slots.
Referenced by set_game_items().
SDL_Rect mp::gamebrowser::get_item_rect | ( | size_t | index | ) | const |
Definition at line 111 of file multiplayer_lobby.cpp.
References sdl::create_rect(), gui::scrollarea::inner_location(), row_height(), and visible_range_.
Referenced by draw_contents(), and handle_event().
|
virtual |
Reimplemented from gui::menu.
Definition at line 366 of file multiplayer_lobby.cpp.
References gui::scrollarea::adjust_position(), DOUBLE_CLICK_EVENT, double_clicked_, gui::widget::focus(), games_, get_item_rect(), i, ignore_next_doubleclick_, gui::scrollarea::inner_location(), last_was_doubleclick_, sdl::point_in_rect(), SDL_EVENTMASK, selected_, selection_is_joinable(), selection_is_observable(), gui::widget::set_dirty(), gui::widget::set_focus(), and visible_range_.
void mp::gamebrowser::populate_game_item | ( | gamebrowser::game_item & | item, |
const config & | game, | ||
const config & | game_config, | ||
const std::vector< std::string > & | installed_addons | ||
) |
Definition at line 775 of file multiplayer_lobby.cpp.
References _(), _n(), mp::gamebrowser::game_item::current_turn, mp::gamebrowser::game_item::fog, mp::gamebrowser::game_item::gold, mp::gamebrowser::game_item::have_era, mp::gamebrowser::game_item::have_scenario, mp::gamebrowser::game_item::id, lexical_cast(), mp::gamebrowser::game_item::map_info, mp::gamebrowser::game_item::name, mp::gamebrowser::game_item::observers, mp::gamebrowser::game_item::password_required, populate_game_item_addons_installed(), populate_game_item_campaign_or_scenario_info(), populate_game_item_era_info(), populate_game_item_map_info(), populate_game_item_mod_info(), mp::gamebrowser::game_item::registered_users_only, mp::gamebrowser::game_item::reloaded, mp::gamebrowser::game_item::shroud, mp::gamebrowser::game_item::shuffle_sides, mp::gamebrowser::game_item::started, mp::gamebrowser::game_item::status, mp::gamebrowser::game_item::time_limit, mp::gamebrowser::game_item::use_map_settings, mp::gamebrowser::game_item::vacant_slots, mp::gamebrowser::game_item::verified, mp::gamebrowser::game_item::vision, and mp::gamebrowser::game_item::xp.
Referenced by set_game_items().
void mp::gamebrowser::populate_game_item_addons_installed | ( | gamebrowser::game_item & | item, |
const config & | game, | ||
const std::vector< std::string > & | installed_addons | ||
) |
Definition at line 753 of file multiplayer_lobby.cpp.
References mp::required_addon::addon_id, mp::gamebrowser::game_item::addons, mp::gamebrowser::game_item::addons_outcome, config::child_range(), gui2::event::find(), mp::required_addon::message, mp::NEED_DOWNLOAD, mp::required_addon::outcome, mp::SATISFIED, and vgettext().
Referenced by populate_game_item().
void mp::gamebrowser::populate_game_item_campaign_or_scenario_info | ( | gamebrowser::game_item & | item, |
const config & | game, | ||
const config & | game_config, | ||
bool & | verified | ||
) |
Definition at line 465 of file multiplayer_lobby.cpp.
References _(), mp::gamebrowser::game_item::addons, mp::gamebrowser::game_item::addons_outcome, config::attribute_range(), mp::check_addon_version_compatibility(), gui2::tlegacy_menu_item::description(), empty(), config::find_child(), mp::gamebrowser::game_item::have_scenario, i, gui2::tlegacy_menu_item::label(), map_hashes_, mp::gamebrowser::game_item::map_info, mp::gamebrowser::game_item::reloaded, utils::split(), and vgettext().
Referenced by populate_game_item().
void mp::gamebrowser::populate_game_item_era_info | ( | gamebrowser::game_item & | item, |
const config & | game, | ||
const config & | game_config, | ||
bool & | verified | ||
) |
Definition at line 692 of file multiplayer_lobby.cpp.
References _(), mp::gamebrowser::game_item::addons, mp::gamebrowser::game_item::addons_outcome, mp::check_addon_version_compatibility(), empty(), mp::gamebrowser::game_item::era_and_mod_info, config::find_child(), mp::gamebrowser::game_item::have_era, and vgettext().
Referenced by populate_game_item().
void mp::gamebrowser::populate_game_item_map_info | ( | gamebrowser::game_item & | item, |
const config & | game, | ||
const config & | game_config, | ||
bool & | verified | ||
) |
Definition at line 590 of file multiplayer_lobby.cpp.
References twml_exception::dev_message, e, ERR_CF, games_, image::getMinimap(), gamemap::h(), i, mp::gamebrowser::game_item::map_data, mp::minimap_cache_item::map_data, mp::gamebrowser::game_item::map_info_size, mp::minimap_cache_item::map_info_size, game::error::message, mp::gamebrowser::game_item::mini_map, mp::minimap_cache_item::mini_map, minimap_size_, filesystem::read_map(), utils::unicode_multiplication_sign, and gamemap::w().
Referenced by populate_game_item().
void mp::gamebrowser::populate_game_item_mod_info | ( | gamebrowser::game_item & | item, |
const config & | game, | ||
const config & | game_config, | ||
bool & | verified | ||
) |
Definition at line 721 of file multiplayer_lobby.cpp.
References _(), mp::gamebrowser::game_item::addons, mp::gamebrowser::game_item::addons_outcome, mp::check_addon_version_compatibility(), config::child_or_empty(), config::child_range(), config::empty(), mp::gamebrowser::game_item::era_and_mod_info, config::find_child(), and mp::gamebrowser::game_item::have_all_mods.
Referenced by populate_game_item().
|
inline |
Definition at line 151 of file multiplayer_lobby.hpp.
References double_clicked_.
Referenced by mp::lobby::process_event_impl().
|
inlineprotected |
Definition at line 158 of file multiplayer_lobby.hpp.
References gui::menu::style::get_thickness(), item_height_, and gui::menu::style_.
Referenced by get_item_rect(), scroll(), set_game_items(), and set_inner_location().
Implements gui::scrollarea.
Definition at line 102 of file multiplayer_lobby.cpp.
References games_, gui::scrollarea::inner_location(), pos, row_height(), gui::widget::set_dirty(), and visible_range_.
Referenced by set_game_items(), and set_inner_location().
void mp::gamebrowser::select_game | ( | const std::string & | id | ) |
Definition at line 908 of file multiplayer_lobby.cpp.
References gui::scrollarea::adjust_position(), empty(), games_, i, selected_, and gui::widget::set_dirty().
Referenced by mp::lobby::lobby(), and mp::lobby::process_event_impl().
|
inline |
Definition at line 150 of file multiplayer_lobby.hpp.
References double_clicked_, and empty().
Referenced by mp::lobby::process_event_impl().
|
inline |
Definition at line 153 of file multiplayer_lobby.hpp.
References games_, and selected_.
Referenced by mp::lobby::process_event_impl(), and set_game_items().
|
inline |
Definition at line 152 of file multiplayer_lobby.hpp.
References selected_.
Referenced by mp::lobby::process_event_impl().
|
inline |
Definition at line 146 of file multiplayer_lobby.hpp.
References empty(), games_, mp::SATISFIED, and selected_.
Referenced by mp::lobby::process_event_impl().
|
inline |
Definition at line 148 of file multiplayer_lobby.hpp.
References empty(), games_, and selected_.
Referenced by mp::lobby::process_event_impl().
|
inline |
Definition at line 140 of file multiplayer_lobby.hpp.
References empty(), games_, and selected_.
Referenced by selection_is_joinable().
|
inline |
Definition at line 143 of file multiplayer_lobby.hpp.
References empty(), games_, preferences::is_authenticated(), and selected_.
Referenced by selection_is_observable().
|
inline |
Definition at line 130 of file multiplayer_lobby.hpp.
References selection_in_joinable_state(), selection_needs_addons(), and selection_needs_content().
Referenced by mp::lobby::gamelist_updated(), handle_event(), and mp::lobby::process_event_impl().
|
inline |
Definition at line 132 of file multiplayer_lobby.hpp.
References selection_in_observable_state(), selection_needs_addons(), and selection_needs_content().
Referenced by mp::lobby::gamelist_updated(), handle_event(), and mp::lobby::process_event_impl().
|
inline |
Definition at line 138 of file multiplayer_lobby.hpp.
References empty(), games_, mp::SATISFIED, and selected_.
Referenced by mp::lobby::process_event_impl(), selection_is_joinable(), and selection_is_observable().
|
inline |
Definition at line 134 of file multiplayer_lobby.hpp.
References empty(), games_, and selected_.
Referenced by selection_is_joinable(), and selection_is_observable().
void mp::gamebrowser::set_game_items | ( | const config & | cfg, |
const config & | game_config, | ||
const std::vector< std::string > & | installed_addons | ||
) |
Definition at line 854 of file multiplayer_lobby.cpp.
References config::child(), config::child_range(), preferences::fi_invert(), preferences::filter_lobby(), game_matches_filter(), games_, gui::scrollarea::get_max_position(), gui::scrollarea::get_position(), gui::scrollarea::has_scrollbar(), i, gui::scrollarea::inner_location(), installed_addons(), item_height_, populate_game_item(), row_height(), scroll(), selected_, selected_game(), gui::widget::set_dirty(), gui::scrollarea::set_full_size(), gui::scrollarea::set_position(), gui::scrollarea::set_shown_size(), and visible_range_.
Referenced by mp::lobby::gamelist_updated().
|
virtual |
Implements gui::scrollarea.
Definition at line 94 of file multiplayer_lobby.cpp.
References gui::widget::bg_register(), games_, gui::scrollarea::get_position(), row_height(), scroll(), gui::scrollarea::set_full_size(), and gui::scrollarea::set_shown_size().
|
private |
Definition at line 182 of file multiplayer_lobby.hpp.
Referenced by handle_event(), reset_selection(), and selected().
|
private |
Definition at line 179 of file multiplayer_lobby.hpp.
Referenced by draw_contents(), draw_row(), empty(), handle_event(), populate_game_item_map_info(), scroll(), select_game(), selected_game(), selection_addon_outcome(), selection_addon_requirements(), selection_in_joinable_state(), selection_in_observable_state(), selection_needs_addons(), selection_needs_content(), set_game_items(), and set_inner_location().
|
private |
Definition at line 160 of file multiplayer_lobby.hpp.
Referenced by draw_row().
|
private |
Definition at line 174 of file multiplayer_lobby.hpp.
Referenced by draw_row().
|
private |
Definition at line 175 of file multiplayer_lobby.hpp.
Referenced by draw_row().
|
private |
Definition at line 176 of file multiplayer_lobby.hpp.
|
private |
Definition at line 183 of file multiplayer_lobby.hpp.
Referenced by handle_event().
|
private |
Definition at line 171 of file multiplayer_lobby.hpp.
Referenced by row_height(), and set_game_items().
|
private |
Definition at line 184 of file multiplayer_lobby.hpp.
Referenced by handle_event().
|
private |
Definition at line 169 of file multiplayer_lobby.hpp.
Referenced by populate_game_item_campaign_or_scenario_info().
|
private |
Definition at line 162 of file multiplayer_lobby.hpp.
Referenced by draw_row().
|
private |
Definition at line 172 of file multiplayer_lobby.hpp.
Referenced by draw_contents(), and draw_row().
|
private |
Definition at line 173 of file multiplayer_lobby.hpp.
Referenced by draw_row(), and populate_game_item_map_info().
|
private |
Definition at line 166 of file multiplayer_lobby.hpp.
Referenced by draw_row().
|
private |
Definition at line 165 of file multiplayer_lobby.hpp.
Referenced by draw_row().
|
private |
Definition at line 180 of file multiplayer_lobby.hpp.
|
private |
Definition at line 177 of file multiplayer_lobby.hpp.
Referenced by draw_contents(), handle_event(), select_game(), selected_game(), selection(), selection_addon_outcome(), selection_addon_requirements(), selection_in_joinable_state(), selection_in_observable_state(), selection_needs_addons(), selection_needs_content(), and set_game_items().
|
private |
Definition at line 167 of file multiplayer_lobby.hpp.
Referenced by draw_row().
|
private |
Definition at line 164 of file multiplayer_lobby.hpp.
Referenced by draw_row().
|
private |
Definition at line 178 of file multiplayer_lobby.hpp.
Referenced by draw_contents(), get_item_rect(), handle_event(), scroll(), and set_game_items().
|
private |
Definition at line 163 of file multiplayer_lobby.hpp.
Referenced by draw_row().
|
private |
Definition at line 181 of file multiplayer_lobby.hpp.
|
private |
Definition at line 161 of file multiplayer_lobby.hpp.
Referenced by draw_row().