#include <display_context.hpp>
Public Member Functions | |
virtual const std::vector< team > & | teams () const =0 |
virtual const gamemap & | map () const =0 |
virtual const unit_map & | units () const =0 |
virtual const std::vector< std::string > & | hidden_label_categories () const =0 |
virtual std::vector< std::string > & | hidden_label_categories ()=0 |
const team & | get_team (int side) const |
template<typename T = void> | |
bool | has_team (int side) const |
bool | would_be_discovered (const map_location &loc, int side_num, bool see_all=true) |
Given a location and a side number, indicates whether an invisible unit of that side at that location would be revealed (perhaps ambushed), based on what team side_num can see. More... | |
const unit * | get_visible_unit (const map_location &loc, const team ¤t_team, bool see_all=false) const |
unit_const_ptr | get_visible_unit_shared_ptr (const map_location &loc, const team ¤t_team, bool see_all=false) const |
bool | unit_can_move (const unit &u) const |
True if, and only if, at least one of the following is true: More... | |
orb_status | unit_orb_status (const unit &u) const |
Returns an enumurated summary of whether this unit can move and/or attack. More... | |
int | village_owner (const map_location &loc) const |
Given the location of a village, will return the 1-based number of the team that currently owns it, and 0 if it is unowned. More... | |
int | side_units (int side_num) const |
Returns the number of units of the side side_num. More... | |
int | side_units_cost (int side_num) const |
Returns the total cost of units of side side_num. More... | |
int | side_upkeep (int side_num) const |
bool | is_observer () const |
Check if we are an observer in this game. More... | |
virtual | ~display_context () |
Definition at line 36 of file display_context.hpp.
|
inlinevirtual |
Definition at line 112 of file display_context.hpp.
const team & display_context::get_team | ( | int | side | ) | const |
Definition at line 23 of file display_context.cpp.
References teams().
Referenced by unit::ability_active(), gui2::dialogs::add_unit_entry(), attack_info(), gui2::dialogs::gamestate_inspector::controller::build_stuff_list(), unit_filter::first_match_on_map(), display::get_flag(), events::menu_handler::goto_leader(), side_filter::match(), side_filter::match_internal(), display::parse_team_overlays(), game_display::scroll_to_leader(), gui2::dialogs::team_mode_controller::show_list(), gui2::dialogs::team_mode_controller::show_recall(), gui2::dialogs::team_mode_controller::show_recall_unit(), attack_type::special_active_impl(), game_board::teams(), unit_can_move(), unit_display::unit_recruited(), unit_side(), and would_be_discovered().
const unit * display_context::get_visible_unit | ( | const map_location & | loc, |
const team & | current_team, | ||
bool | see_all = false |
||
) | const |
Definition at line 50 of file display_context.cpp.
References unit_map::find(), map(), units(), and unit_map::iterator_base< iter_types >::valid().
Referenced by get_selected_unit(), get_visible_unit(), and has_team().
unit_const_ptr display_context::get_visible_unit_shared_ptr | ( | const map_location & | loc, |
const team & | current_team, | ||
bool | see_all = false |
||
) | const |
Definition at line 60 of file display_context.cpp.
References unit_map::find(), unit_map::iterator_base< iter_types >::get_shared_ptr(), map(), units(), and unit_map::iterator_base< iter_types >::valid().
Referenced by get_selected_unit_ptr(), and has_team().
|
inline |
Definition at line 48 of file display_context.hpp.
References get_visible_unit(), get_visible_unit_shared_ptr(), is_observer(), side_units(), side_units_cost(), side_upkeep(), teams(), unit_can_move(), unit_orb_status(), village_owner(), and would_be_discovered().
|
pure virtual |
Implemented in editor::map_context, game_board, and pathfind::ignore_units_display_context.
Referenced by terrain_label::hidden(), and gui2::dialogs::label_settings::post_show().
|
pure virtual |
Implemented in editor::map_context, game_board, and pathfind::ignore_units_display_context.
bool display_context::is_observer | ( | ) | const |
Check if we are an observer in this game.
Determine if we are an observer, by checking if every team is not locally controlled.
Definition at line 126 of file display_context.cpp.
Referenced by display_chat_manager::add_chat_message(), events::menu_handler::clear_labels(), has_team(), events::menu_handler::send_chat_message(), and terrain_label::viewable().
|
pure virtual |
Implemented in editor::map_context, game_board, and pathfind::ignore_units_display_context.
Referenced by display::change_display_context(), unit_filter::first_match_on_map(), footsteps_images(), editor::map_context::get_labels(), get_visible_unit(), get_visible_unit_shared_ptr(), help::load_terrain_types_data(), gui2::dialogs::game_stats::pre_show(), and unit_can_move().
int display_context::side_units | ( | int | side_num | ) | const |
Returns the number of units of the side side_num.
Definition at line 138 of file display_context.cpp.
References units().
Referenced by has_team(), and ai_testing::log_turn().
int display_context::side_units_cost | ( | int | side_num | ) | const |
Returns the total cost of units of side side_num.
Definition at line 147 of file display_context.cpp.
References units().
Referenced by has_team(), and ai_testing::log_turn().
int display_context::side_upkeep | ( | int | side_num | ) | const |
Definition at line 156 of file display_context.cpp.
References units().
Referenced by play_controller::do_init_side(), ai::default_recruitment::recruitment::get_estimated_income(), and has_team().
|
pure virtual |
Implemented in editor::map_context, game_board, and pathfind::ignore_units_display_context.
Referenced by gui2::dialogs::gamestate_inspector::controller::build_stuff_list(), game_display::current_team_name(), game_display::display_unit_hex(), game_display::draw_hex(), display::draw_invalidated(), display::draw_minimap(), display::draw_minimap_units(), game_display::draw_movement_info(), editor::editor_display::draw_sidebar(), display::fogged(), display::get_flag(), editor::map_context::get_labels(), get_team(), side_filter::get_teams(), has_team(), game_display::highlight_hex(), display::init_flags(), display::init_flags_for_side_internal(), display::invalidate_animations_location(), is_observer(), display::parse_team_overlays(), gui2::dialogs::label_settings::pre_show(), gui2::dialogs::game_stats::pre_show(), display::set_team(), display::shrouded(), display::team_valid(), and village_owner().
bool display_context::unit_can_move | ( | const unit & | u | ) | const |
True if, and only if, at least one of the following is true:
(a) the unit can move to another hex, taking account of ZoC and terrain costs vs current movement points.
(b) the unit can make an attack from the hex that it's currently on, requires attack points and a non-petrified enemy in an adjacent hex.
This does not check which player's turn is currently active, the result is calculated assuming that the unit's owner is currently active.
Definition at line 70 of file display_context.cpp.
References unit::attacks_left(), unit_map::find(), get_adjacent_tiles(), unit::get_location(), get_team(), unit::has_goto(), unit::has_moved(), i, team::is_enemy(), map(), unit::movement_cost(), unit::movement_left(), gamemap::on_board(), unit::side(), units(), and unit_map::iterator_base< iter_types >::valid().
Referenced by has_team(), events::mouse_handler::unit_in_cycle(), unit_orb_status(), and events::menu_handler::update_shroud_now().
orb_status display_context::unit_orb_status | ( | const unit & | u | ) | const |
Returns an enumurated summary of whether this unit can move and/or attack.
This does not check which player's turn is currently active, the result is calculated assuming that the unit's owner is currently active. For this reason this never returns orb_status::enemy nor orb_status::allied.
Definition at line 102 of file display_context.cpp.
References unit::attacks_left(), unit::max_attacks(), moved, unit::movement_left(), partial, unit::total_movement(), unit_can_move(), unmoved, and unit::user_end_turn().
Referenced by display::draw_minimap_units(), has_team(), and unit_drawer::redraw_unit().
|
pure virtual |
Implemented in editor::map_context, game_board, and pathfind::ignore_units_display_context.
Referenced by unit_filter::all_matches_on_map(), display::draw_invalidated(), display::draw_minimap_units(), game_display::draw_movement_info(), unit_filter::first_match_on_map(), footsteps_images(), editor::map_context::get_labels(), gui2::dialogs::game_stats::get_leader(), get_visible_unit(), get_visible_unit_shared_ptr(), game_display::highlight_hex(), display::invalidate_animations(), side_filter::match_internal(), unit_filter_impl::unit_filter_compound::matches(), display::reset_standing_animations(), game_display::scroll_to_leader(), gui2::dialogs::unit_mode_controller::show_list(), gui2::dialogs::unit_mode_controller::show_unit(), gui2::dialogs::team_mode_controller::show_units(), side_units(), side_units_cost(), side_upkeep(), unit_can_move(), and would_be_discovered().
int display_context::village_owner | ( | const map_location & | loc | ) | const |
Given the location of a village, will return the 1-based number of the team that currently owns it, and 0 if it is unowned.
Definition at line 113 of file display_context.cpp.
Referenced by events::menu_handler::change_side(), game_board::change_terrain(), image::getMinimap(), has_team(), display::invalidate_animations_location(), ai::ai_default_rca::aspect_attacks_base::rate_terrain(), ai::default_ai_context_impl::rate_terrain(), and game_board::replace_map().
bool display_context::would_be_discovered | ( | const map_location & | loc, |
int | side_num, | ||
bool | see_all = true |
||
) |
Given a location and a side number, indicates whether an invisible unit of that side at that location would be revealed (perhaps ambushed), based on what team side_num can see.
If see_all is true then the calculation ignores fog, and enemy ambushers.
Definition at line 28 of file display_context.cpp.
References unit_map::find(), team::fogged(), get_adjacent_tiles(), get_team(), unit::incapacitated(), unit::invisible(), team::is_enemy(), unit::side(), units(), and unit_map::iterator_base< iter_types >::valid().
Referenced by has_team(), and unit::invisible().