#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 |
std::vector< std::string > & | hidden_label_categories_ref () |
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 |
bool | unit_can_move (const unit &u) const |
Will return true iff the unit u has any possible moves it can do (including attacking etc). More... | |
int | village_owner (const map_location &loc) const |
Given the location of a village, will return the 0-based index of the team that currently owns it, and -1 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 |
team_data | calculate_team_data (const class team &tm, int side) const |
bool | is_observer () const |
Check if we are an observer in this game. More... | |
virtual | ~display_context () |
Definition at line 52 of file display_context.hpp.
|
inlinevirtual |
Definition at line 104 of file display_context.hpp.
Definition at line 157 of file display_context.cpp.
References team_data::expenses, team_data::gold, team::gold(), team_data::net_income, side_units(), side_upkeep(), team::support(), team_data::teamname, team::total_income(), team_data::units, team_data::upkeep, team::user_team_name(), team_data::villages, and team::villages().
Referenced by events::menu_handler::status_table().
const unit * display_context::get_visible_unit | ( | const map_location & | loc, |
const team & | current_team, | ||
bool | see_all = false |
||
) | const |
Definition at line 53 of file display_context.cpp.
References unit_map::find(), map(), units(), and unit_map::iterator_base< iter_types >::valid().
Referenced by get_selected_unit(), and get_visible_unit().
|
pure virtual |
Implemented in editor::map_context, game_board, pathfind::ignore_units_display_context, and editor::dummy_editor_display_context.
Referenced by terrain_label::hidden(), hidden_label_categories_ref(), and gui2::tlabel_settings::tlabel_settings().
std::vector< std::string > & display_context::hidden_label_categories_ref | ( | ) |
Definition at line 23 of file display_context.cpp.
References hidden_label_categories().
Referenced by gui2::tlabel_settings::execute(), and game_state::init().
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 118 of file display_context.cpp.
References teams().
Referenced by display_chat_manager::add_chat_message(), events::menu_handler::clear_labels(), play_controller::is_observer(), events::menu_handler::send_chat_message(), and terrain_label::viewable().
|
pure virtual |
Implemented in editor::map_context, game_board, pathfind::ignore_units_display_context, and editor::dummy_editor_display_context.
Referenced by display::change_display_context(), terrain_filterimpl::filter_special_loc(), terrain_filterimpl::filter_xy(), footsteps_images(), terrain_filter::get_locations(), display::get_map(), get_visible_unit(), basic_unit_filter_impl::internal_matches_filter(), help::load_terrain_types_data(), reports::context::map(), terrain_filter::match(), terrain_filter::match_internal(), and unit_can_move().
Returns the number of units of the side side_num.
Static info getters previously declared at global scope in unit.?pp.
Definition at line 130 of file display_context.cpp.
References units().
Referenced by calculate_team_data(), and ai_testing::log_turn().
Returns the total cost of units of side side_num.
Definition at line 139 of file display_context.cpp.
References units().
Referenced by ai_testing::log_turn().
Definition at line 148 of file display_context.cpp.
References units().
Referenced by calculate_team_data(), play_controller::do_init_side(), and ai::default_recruitment::recruitment::get_estimated_income().
|
pure virtual |
Implemented in editor::map_context, game_board, pathfind::ignore_units_display_context, and editor::dummy_editor_display_context.
Referenced by unit::ability_active(), game_display::current_team_name(), game_display::display_unit_hex(), game_display::draw_hex(), display::draw_hex(), display::draw_minimap(), display::draw_minimap_units(), game_display::draw_movement_info(), editor::editor_display::draw_sidebar(), display::fogged(), display::get_flag(), side_filter::get_teams(), display::get_teams(), game_display::highlight_hex(), display::init_flags(), display::init_flags_for_side_internal(), basic_unit_filter_impl::internal_matches_filter(), display::invalidate_animations_location(), is_observer(), side_filter::match(), side_filter::match_internal(), terrain_filter::match_internal(), display::parse_team_overlays(), gui2::tlabel_settings::pre_show(), display::reinit_flags_for_side(), display::set_team(), gui2::unit_mode_controller::show_stuff_list(), display::shrouded(), attack_type::special_active(), display::team_valid(), reports::context::teams(), gui2::tlabel_settings::tlabel_settings(), unit_can_move(), terrain_label::viewable(), village_owner(), and would_be_discovered().
bool display_context::unit_can_move | ( | const unit & | u | ) | const |
Will return true iff the unit u has any possible moves it can do (including attacking etc).
Definition at line 68 of file display_context.cpp.
References unit::attacks_left(), unit_map::find(), get_adjacent_tiles(), unit::get_location(), unit::has_goto(), unit::has_moved(), i, team::is_enemy(), map(), unit::movement_cost(), unit::movement_left(), gamemap::on_board(), unit::side(), teams(), units(), and unit_map::iterator_base< iter_types >::valid().
Referenced by unit_drawer::redraw_unit(), and events::mouse_handler::unit_in_cycle().
|
pure virtual |
Implemented in editor::map_context, game_board, pathfind::ignore_units_display_context, and editor::dummy_editor_display_context.
Referenced by null_unit_filter_impl::all_matches_on_map(), basic_unit_filter_impl::all_matches_on_map(), display::draw_invalidated(), display::draw_minimap_units(), game_display::draw_movement_info(), null_unit_filter_impl::first_match_on_map(), basic_unit_filter_impl::first_match_on_map(), footsteps_images(), display::get_units(), get_visible_unit(), game_display::highlight_hex(), basic_unit_filter_impl::internal_matches_filter(), display::invalidate_animations(), side_filter::match_internal(), terrain_filter::match_internal(), basic_unit_filter_impl::matches(), game_display::scroll_to_leader(), side_units(), side_units_cost(), side_upkeep(), unit_can_move(), reports::context::units(), and would_be_discovered().
int display_context::village_owner | ( | const map_location & | loc | ) | const |
Given the location of a village, will return the 0-based index of the team that currently owns it, and -1 if it is unowned.
Definition at line 105 of file display_context.cpp.
Referenced by events::menu_handler::change_side(), game_board::change_terrain(), image::getMinimap(), game_lua_kernel::intf_get_village_owner(), game_lua_kernel::intf_set_village_owner(), display::invalidate_animations_location(), terrain_filter::match_internal(), 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 27 of file display_context.cpp.
References unit_map::find(), get_adjacent_tiles(), unit::incapacitated(), unit::invisible(), unit::side(), teams(), units(), and unit_map::iterator_base< iter_types >::valid().
Referenced by unit::invisible().