#include <game_display.hpp>
Public Types | |
enum | MESSAGE_TYPE { MESSAGE_PUBLIC, MESSAGE_PRIVATE } |
enum | tgame_mode { RUNNING, LINGER_SP, LINGER_MP } |
Sets the linger mode for the display. More... | |
Public Member Functions | |
game_display (unit_map &units, CVideo &video, const gamemap &map, const gamestatus &status, const std::vector< team > &t, const config &theme_cfg, const config &cfg, const config &level) | |
~game_display () | |
void | new_turn () |
Update lighting settings. | |
void | adjust_colours (int r, int g, int b) |
Add r,g,b to the colours for all images displayed on the map. | |
void | scroll_to_leader (unit_map &units, int side, SCROLL_TYPE scroll_type=ONSCREEN) |
Scrolls to the leader of a certain side. | |
void | draw (bool update=true, bool force=false) |
Draw for the game display has to know about units. | |
virtual void | select_hex (gamemap::location hex) |
Function to display a location as selected. | |
virtual void | highlight_hex (gamemap::location hex) |
Function to highlight a location. | |
void | display_unit_hex (gamemap::location hex) |
Change the unit to be displayed in the sidebar. | |
void | highlight_reach (const paths &paths_list) |
Sets the paths that are currently displayed as available for the unit to move along. | |
void | highlight_another_reach (const paths &paths_list) |
Add more paths to highlight. | |
void | unhighlight_reach () |
Reset highlighting of paths. | |
void | set_route (const paths::route *route) |
Sets the route along which footsteps are drawn to show movement of a unit. | |
void | float_label (const gamemap::location &loc, const std::string &text, int red, int green, int blue) |
Function to float a label above a tile. | |
std::vector< surface > | footsteps_images (const gamemap::location &loc) |
Function to return 2 half-hex footsteps images for the given location. | |
void | draw_movement_info (const gamemap::location &loc) |
Draws the movement info (turns available) for a given location. | |
void | invalidate (const gamemap::location &loc) |
Function to invalidate a specific tile for redrawing. | |
const gamestatus & | get_game_status () |
void | draw_report (reports::TYPE report_num) |
void | invalidate_unit () |
Function to invalidate that unit status displayed on the sidebar. | |
void | invalidate_unit_after_move (const gamemap::location &src, const gamemap::location &dst) |
Same as invalidate_unit() if moving the displayed unit. | |
void | place_temporary_unit (unit &u, const gamemap::location &loc) |
Temporarily place a unit on map (moving: can overlap others). | |
void | remove_temporary_unit () |
void | set_attack_indicator (const gamemap::location &src, const gamemap::location &dst) |
Set the attack direction indicator. | |
void | clear_attack_indicator () |
const std::string | attack_indicator_direction () const |
Function to get attack direction suffix. | |
void | add_overlay (const gamemap::location &loc, const std::string &image, const std::string &halo="") |
Functions to add and remove overlays from locations. | |
void | remove_overlay (const gamemap::location &loc) |
remove_overlay will remove all overlays on a tile. | |
void | remove_single_overlay (const gamemap::location &loc, const std::string &toDelete) |
remove_single_overlay will remove a single overlay from a tile | |
void | write_overlays (config &cfg) const |
Function to serialize overlay data. | |
t_translation::t_terrain | get_terrain_on (int palx, int paly, int x, int y) |
void | set_team (size_t team, bool observe=false) |
Sets the team controlled by the player using the computer. | |
void | set_playing_team (size_t team) |
size_t | get_playing_team () const |
const std::vector< team > & | get_teams () |
unit_map & | get_units () |
const unit_map & | get_const_units () const |
size_t | viewing_team () const |
The viewing team is the team currently viewing the game. | |
size_t | playing_team () const |
The playing team is the team whose turn it is. | |
bool | team_valid () const |
const std::string | current_team_name () const |
void | add_observer (const std::string &name) |
void | remove_observer (const std::string &name) |
const std::set< std::string > & | observers () const |
void | add_chat_message (const time_t &time, const std::string &speaker, int side, const std::string &msg, MESSAGE_TYPE type, bool bell) |
void | clear_chat_messages () |
void | begin_game () |
virtual bool | in_game () const |
void | draw_bar (const std::string &image, int xpos, int ypos, const int drawing_order, size_t height, double filled, const SDL_Color &col, fixed_t alpha) |
void | set_game_mode (const tgame_mode game_mode) |
Static Public Member Functions | |
static game_display * | get_singleton () |
static void | debug_highlight (const gamemap::location &loc, fixed_t amount) |
Draws a cross on a tile to emphasize something there. | |
static void | clear_debug_highlights () |
Private Types | |
typedef std::multimap < gamemap::location, overlay > | overlay_map |
typedef std::map < gamemap::location, unsigned int > | reach_map |
Private Member Functions | |
void | invalidate_animations () |
Function to invalidate animated terrains which may have changed. | |
virtual void | draw_minimap_units () |
game_display (const game_display &) | |
void | operator= (const game_display &) |
void | draw_sidebar () |
void | draw_game_status () |
surface | get_flag (const gamemap::location &loc) |
const SDL_Rect & | calculate_energy_bar (surface surf) |
Finds the start and end rows on the energy bar image. | |
void | invalidate_route () |
void | prune_chat_messages (bool remove_all=false) |
void | process_reachmap_changes () |
Private Attributes | |
unit_map & | units_ |
unit * | temp_unit_ |
gamemap::location | temp_unit_loc_ |
gamemap::location | attack_indicator_src_ |
gamemap::location | attack_indicator_dst_ |
std::map< surface, SDL_Rect > | energy_bar_rects_ |
paths::route | route_ |
const gamestatus & | status_ |
const std::vector< team > & | teams_ |
const config & | level_ |
bool | invalidateUnit_ |
gamemap::location | displayedUnitHex_ |
overlay_map | overlays_ |
size_t | currentTeam_ |
size_t | activeTeam_ |
double | sidebarScaling_ |
bool | first_turn_ |
bool | in_game_ |
std::set< std::string > | observers_ |
std::vector< chat_message > | chat_messages_ |
surface | tod_hex_mask1 |
surface | tod_hex_mask2 |
reach_map | reach_map_ |
reach_map | reach_map_old_ |
bool | reach_map_changed_ |
tgame_mode | game_mode_ |
std::vector< animated < image::locator > > | flags_ |
Animated flags for each team. | |
Static Private Attributes | |
static std::map < gamemap::location, fixed_t > | debugHighlights_ |
static game_display * | singleton_ = NULL |
Classes | |
struct | chat_message |
struct | overlay |
Definition at line 41 of file game_display.hpp.
typedef std::multimap<gamemap::location,overlay> game_display::overlay_map [private] |
Definition at line 257 of file game_display.hpp.
typedef std::map<gamemap::location,unsigned int> game_display::reach_map [private] |
Definition at line 288 of file game_display.hpp.
Sets the linger mode for the display.
There have been some discussions on what to do with fog and shroud the extra variables make it easier to modify the behaviour. There might even be a split between victory and defeat.
RUNNING | no linger overlay, show fog and shroud |
LINGER_SP | linger overlay, show fog and shroud |
LINGER_MP |
Definition at line 204 of file game_display.hpp.
game_display::game_display | ( | unit_map & | units, | |
CVideo & | video, | |||
const gamemap & | map, | |||
const gamestatus & | status, | |||
const std::vector< team > & | t, | |||
const config & | theme_cfg, | |||
const config & | cfg, | |||
const config & | level | |||
) |
Definition at line 57 of file game_display.cpp.
References animated< T, T_void_value >::add_frame(), preferences::disp, game_config::flag_image, game_config::flag_rgb, flags_, team::get_side_colour_index(), CVideo::getSurface(), lg::info, LOG_STREAM, display::screen_, display::screen_area(), image::set_team_colors(), singleton_, utils::split(), and teams_.
game_display::~game_display | ( | ) |
game_display::game_display | ( | const game_display & | ) | [private] |
static game_display* game_display::get_singleton | ( | ) | [inline, static] |
Definition at line 49 of file game_display.hpp.
References singleton_.
Referenced by unit_animator::add_animation(), unit_frame::invalidate(), unit_display::move_unit(), move_unit_between(), unit::overlaps(), unit_frame::redraw(), unit::redraw_unit(), unit_animator::replace_anim_if_invalid(), unit::set_standing(), unit::start_animation(), teleport_unit_between(), unit_display::unit_attack(), unit_display::unit_die(), unit_display::unit_healing(), unit_display::unit_recruited(), unit_display::unit_visible_on_path(), unit_animation::update_last_draw_time(), unit_animator::wait_for_end(), and unit_animator::wait_until().
void game_display::new_turn | ( | ) |
Update lighting settings.
Should be called on every new turn,
Definition at line 151 of file game_display.cpp.
References adjust_surface_alpha(), surface::assign(), time_of_day::blue, draw(), first_turn_, ftofxp, fxpdiv, image::get_image(), gamestatus::get_previous_time_of_day(), gamestatus::get_time_of_day(), time_of_day::green, time_of_day::image_mask, display::invalidate_all(), time_of_day::red, image::set_colour_adjustment(), image::set_image_mask(), status_, tod_hex_mask1, tod_hex_mask2, display::turbo_speed(), and image::UNMASKED.
Referenced by replay_controller::play_turn(), playsingle_controller::play_turn(), and replay_controller::reset_replay().
void game_display::adjust_colours | ( | int | r, | |
int | g, | |||
int | b | |||
) |
Add r,g,b to the colours for all images displayed on the map.
Used for special effects like flashes.
Definition at line 203 of file game_display.cpp.
References time_of_day::blue, gamestatus::get_time_of_day(), time_of_day::green, time_of_day::red, image::set_colour_adjustment(), and status_.
Referenced by play_controller::init_gui().
void game_display::scroll_to_leader | ( | unit_map & | units, | |
int | side, | |||
SCROLL_TYPE | scroll_type = ONSCREEN | |||
) |
Scrolls to the leader of a certain side.
This will normally be the playing team.
Definition at line 258 of file game_display.cpp.
References unit_map::end(), find_leader(), display::scroll_to_tile(), and units_.
Referenced by replay_controller::init_gui(), play_controller::init_side(), replay_controller::replay_next_side(), replay_controller::replay_next_turn(), events::menu_handler::scenario_settings_table(), and events::menu_handler::status_table().
void game_display::draw | ( | bool | update = true , |
|
bool | force = false | |||
) | [virtual] |
Draw for the game display has to know about units.
Implements display.
Definition at line 272 of file game_display.cpp.
References display::ADJACENT_BACKGROUND, display::ADJACENT_FOGSHROUD, display::ADJACENT_FOREGROUND, attack_indicator_direction(), attack_indicator_dst_, attack_indicator_src_, image::BRIGHTENED, game_config::cross_image, currentTeam_, game_config::debug, debugHighlights_, display::draw_border(), display::draw_init(), draw_movement_info(), draw_sidebar(), display::draw_wrap(), display::drawing_buffer_add(), display::drawing_buffer_commit(), gamemap::empty(), unit_map::end(), unit_map::find(), find_visible_unit(), display::fogged(), t_translation::FOGGED, footsteps_images(), game_mode_, gamemap::get_drawing_order(), get_flag(), image::get_image(), display::get_location_x(), display::get_location_y(), display::get_screen_surface(), gamemap::get_terrain(), display::get_terrain_images(), gamemap::get_terrain_info(), gamestatus::get_time_of_day(), display::grid_, game_config::grid_image, display::hex_overlay_, time_of_day::id, time_of_day::image_mask, invalidate_animations(), display::invalidated_, is_shrouded(), display::LAYER_LINGER_OVERLAY, display::LAYER_TERRAIN_BG, display::LAYER_TERRAIN_FG, display::LAYER_TERRAIN_TMP_BG, display::LAYER_TERRAIN_TMP_FG, game_config::linger_image, display::map_, display::map_area(), terrain_type::minimap_image(), display::mouseover_hex_overlay_, display::mouseoverHex_, t_translation::OFF_MAP_USER, gamemap::on_board(), overlays_, process_reachmap_changes(), prune_chat_messages(), reach_map_, rects_overlap(), unit::redraw_unit(), halo::render(), RUNNING, image::SCALED_TO_HEX, screen, display::screen_, display::selected_hex_overlay_, display::selectedHex_, display::shrouded(), status_, display::tblit::surf, teams_, temp_unit_, temp_unit_loc_, timeofday_at(), tod_hex_mask1, tod_hex_mask2, units_, image::UNMASKED, game_config::unreachable_image, halo::unrender(), CVideo::update_locked(), t_translation::VOID_TERRAIN, and display::zoom_.
Referenced by dialogs::animate_unit_advancement(), apply_shroud_changes(), attack::attack(), events::mouse_handler::attack_enemy_(), playsingle_controller::before_human_turn(), do_replay_handle(), events::menu_handler::end_unit_turn(), attack::fire_event(), playsingle_controller::handle_generic_event(), playsingle_controller::init_gui(), events::mouse_handler::left_click(), playsingle_controller::linger(), playmp_controller::linger(), events::mouse_handler::mouse_press(), unit_display::move_unit(), move_unit(), ai_interface::move_unit_partial(), new_turn(), playsingle_controller::play_ai_turn(), playsingle_controller::play_human_turn(), playmp_controller::play_human_turn(), playmp_controller::play_network_turn(), playsingle_controller::play_side(), playmp_controller::play_side(), play_controller::play_slice(), events::menu_handler::recall(), events::menu_handler::recruit(), events::menu_handler::redo(), events::menu_handler::undo(), events::menu_handler::unit_hold_position(), unit_display::unit_recruited(), unit_animator::wait_for_end(), and unit_animator::wait_until().
void game_display::select_hex | ( | gamemap::location | hex | ) | [virtual] |
Function to display a location as selected.
If a unit is in the location, and there is no unit in the currently highlighted hex, the unit will be displayed in the sidebar.
Reimplemented from display.
Definition at line 209 of file game_display.cpp.
References display_unit_hex(), display::fogged(), display::select_hex(), and gamemap::location::valid().
Referenced by events::mouse_handler::left_click(), events::mouse_handler::move_unit_along_current_route(), events::mouse_handler::select_hex(), unit_display::unit_attack(), and events::menu_handler::unit_list().
void game_display::highlight_hex | ( | gamemap::location | hex | ) | [virtual] |
Function to highlight a location.
If a unit is in the location, it will be displayed in the sidebar. Selection is used when a unit has been clicked on, while highlighting is used when a location has been moused over.
Reimplemented from display.
Definition at line 219 of file game_display.cpp.
References unit_map::count(), displayedUnitHex_, unit_map::end(), find_visible_unit(), display::highlight_hex(), display::invalidate_game_status(), invalidate_unit(), display::map_, display::mouseoverHex_, display::selectedHex_, teams_, units_, and viewing_team().
Referenced by events::mouse_handler::attack_enemy_(), and events::menu_handler::do_search().
void game_display::display_unit_hex | ( | gamemap::location | hex | ) |
Change the unit to be displayed in the sidebar.
This is used when selecting or highlighting is not wanted.
Definition at line 241 of file game_display.cpp.
References displayedUnitHex_, unit_map::end(), find_visible_unit(), invalidate_unit(), display::map_, teams_, units_, and viewing_team().
Referenced by ai_interface::move_unit_partial(), select_hex(), and unit_display::unit_healing().
void game_display::highlight_reach | ( | const paths & | paths_list | ) |
Sets the paths that are currently displayed as available for the unit to move along.
All other paths will be greyed out.
Definition at line 848 of file game_display.cpp.
References highlight_another_reach(), and unhighlight_reach().
Referenced by play_controller::handle_event(), events::mouse_handler::left_click(), events::mouse_handler::mouse_motion(), and events::mouse_handler::select_hex().
void game_display::highlight_another_reach | ( | const paths & | paths_list | ) |
Add more paths to highlight.
Print numbers where they overlap. Used only by Show Enemy Moves.
Definition at line 854 of file game_display.cpp.
References r, reach_map_, reach_map_changed_, and paths::routes.
Referenced by highlight_reach(), and events::menu_handler::show_enemy_moves().
void game_display::unhighlight_reach | ( | ) |
Reset highlighting of paths.
Definition at line 865 of file game_display.cpp.
References reach_map_, and reach_map_changed_.
Referenced by playsingle_controller::after_human_turn(), events::mouse_handler::attack_enemy_(), highlight_reach(), events::mouse_handler::left_click(), events::mouse_handler::mouse_motion(), events::mouse_handler::select_hex(), events::mouse_handler::set_current_paths(), and events::menu_handler::show_enemy_moves().
void game_display::set_route | ( | const paths::route * | route | ) |
Sets the route along which footsteps are drawn to show movement of a unit.
If NULL, no route is displayed. route does not have to remain valid after being set.
Definition at line 923 of file game_display.cpp.
References invalidate_route(), route_, paths::route::steps, and paths::route::waypoints.
Referenced by playsingle_controller::after_human_turn(), playsingle_controller::before_human_turn(), events::mouse_handler::mouse_motion(), events::mouse_handler::move_unit_along_current_route(), events::menu_handler::move_unit_to_loc(), events::mouse_handler::select_hex(), and events::mouse_handler::set_current_paths().
void game_display::float_label | ( | const gamemap::location & | loc, | |
const std::string & | text, | |||
int | red, | |||
int | green, | |||
int | blue | |||
) |
Function to float a label above a tile.
Definition at line 937 of file game_display.cpp.
References font::add_floating_label(), font::ANCHOR_LABEL_MAP, font::CENTER_ALIGN, display::fogged(), display::get_location_x(), display::get_location_y(), display::screen_area(), preferences::show_floating_labels(), font::SIZE_XLARGE, display::turbo_speed(), and display::zoom_.
Referenced by unit_frame::redraw(), and unit::redraw_unit().
std::vector< surface > game_display::footsteps_images | ( | const gamemap::location & | loc | ) |
Function to return 2 half-hex footsteps images for the given location.
Only loc is on the current route set by set_route.
Definition at line 758 of file game_display.cpp.
References unit_map::end(), unit_map::find(), game_config::foot_speed_prefix, game_config::foot_teleport_enter, game_config::foot_teleport_exit, image::get_image(), gamemap::get_terrain(), display::h(), display::map_, route_, gamemap::location::SOUTH_EAST, paths::route::steps, tiles_adjacent(), units_, and image::UNMASKED.
Referenced by draw().
void game_display::draw_movement_info | ( | const gamemap::location & | loc | ) |
Draws the movement info (turns available) for a given location.
Definition at line 698 of file game_display.cpp.
References game_config::defense_color_scale, display::draw_text_in_hex(), display::drawing_buffer_add(), unit_map::end(), unit_map::find(), gamemap::get_drawing_order(), image::get_image(), display::get_location_x(), display::get_location_y(), gamemap::get_terrain(), int_to_color(), display::LAYER_TERRAIN_TMP_BG, lexical_cast(), display::map_, font::NORMAL_COLOUR, reach_map_, route_, paths::route::steps, units_, image::UNMASKED, display::w(), paths::route::waypoints, and font::YELLOW_COLOUR.
Referenced by draw().
void game_display::invalidate | ( | const gamemap::location & | loc | ) | [virtual] |
Function to invalidate a specific tile for redrawing.
Reimplemented from display.
Definition at line 993 of file game_display.cpp.
References unit_map::end(), unit_map::find(), get_adjacent_tiles(), display::invalidateAll_, display::invalidated_, unit::overlaps(), temp_unit_, temp_unit_loc_, and units_.
Referenced by dialogs::animate_unit_advancement(), attack::attack(), events::menu_handler::create_unit(), events::console_handler::do_buff(), events::console_handler::do_create(), do_replay_handle(), events::console_handler::do_unbuff(), events::console_handler::do_unit(), events::menu_handler::end_unit_turn(), get_village(), unit_frame::invalidate(), invalidate_animations(), invalidate_route(), move_unit_between(), ai_interface::move_unit_partial(), place_temporary_unit(), process_reachmap_changes(), events::menu_handler::redo(), remove_temporary_unit(), set_attack_indicator(), unit::set_standing(), events::menu_handler::undo(), and events::menu_handler::unit_hold_position().
const gamestatus& game_display::get_game_status | ( | ) | [inline] |
void game_display::draw_report | ( | reports::TYPE | report_num | ) |
Definition at line 520 of file game_display.cpp.
References activeTeam_, time_of_day::bonus_modified, currentTeam_, displayedUnitHex_, display::fogged(), reports::generate_report(), gamestatus::get_time_of_day(), level_, display::map_, display::mouseoverHex_, observers_, display::refresh_report(), display::report_, display::selectedHex_, display::shrouded(), status_, team_valid(), teams_, reports::TIME_OF_DAY, timeofday_at(), units_, and viewing_team().
Referenced by draw_game_status(), and draw_sidebar().
void game_display::invalidate_unit | ( | ) | [inline] |
Function to invalidate that unit status displayed on the sidebar.
Definition at line 116 of file game_display.hpp.
References invalidateUnit_.
Referenced by dialogs::animate_unit_advancement(), apply_shroud_changes(), attack::attack(), calculate_healing(), events::menu_handler::create_unit(), display_unit_hex(), events::console_handler::do_buff(), events::console_handler::do_create(), events::console_handler::do_unbuff(), events::console_handler::do_unit(), highlight_hex(), invalidate_unit_after_move(), playsingle_controller::play_ai_turn(), events::menu_handler::redo(), events::menu_handler::rename_unit(), events::menu_handler::undo(), and unit_display::unit_recruited().
void game_display::invalidate_unit_after_move | ( | const gamemap::location & | src, | |
const gamemap::location & | dst | |||
) |
Same as invalidate_unit() if moving the displayed unit.
Definition at line 250 of file game_display.cpp.
References displayedUnitHex_, and invalidate_unit().
Referenced by unit_display::move_unit().
void game_display::invalidate_animations | ( | ) | [private] |
Function to invalidate animated terrains which may have changed.
Definition at line 1034 of file game_display.cpp.
References preferences::animate_map(), unit_map::begin(), display::builder_, currentTeam_, unit_map::end(), flags_, display::fogged(), unit::get_animation(), display::get_visible_hex_bounds(), invalidate(), gamemap::is_village(), loc, display::map_, unit_animation::need_update(), new_animation_frame(), unit::refresh(), display::shrouded(), teams_, temp_unit_, temp_unit_loc_, units_, terrain_builder::update_animation(), player_teams::village_owner(), gamemap::location::x, and gamemap::location::y.
Referenced by draw().
void game_display::draw_minimap_units | ( | ) | [private, virtual] |
Reimplemented from display.
Definition at line 592 of file game_display.cpp.
References unit_map::begin(), currentTeam_, unit_map::end(), display::fogged(), team::get_minimap_colour(), gamemap::h(), is_odd(), display::map_, display::minimap_location_, r, round_double(), teams_, units_, display::video(), and gamemap::w().
void game_display::place_temporary_unit | ( | unit & | u, | |
const gamemap::location & | loc | |||
) |
Temporarily place a unit on map (moving: can overlap others).
Definition at line 1078 of file game_display.cpp.
References invalidate(), temp_unit_, and temp_unit_loc_.
Referenced by unit_display::move_unit(), move_unit_between(), and teleport_unit_between().
void game_display::remove_temporary_unit | ( | ) |
Definition at line 1085 of file game_display.cpp.
References unit::clear_haloes(), invalidate(), temp_unit_, and temp_unit_loc_.
Referenced by unit_display::move_unit().
void game_display::set_attack_indicator | ( | const gamemap::location & | src, | |
const gamemap::location & | dst | |||
) |
Set the attack direction indicator.
Definition at line 1095 of file game_display.cpp.
References attack_indicator_dst_, attack_indicator_src_, and invalidate().
Referenced by clear_attack_indicator(), and events::mouse_handler::mouse_motion().
void game_display::clear_attack_indicator | ( | ) |
Definition at line 1109 of file game_display.cpp.
References gamemap::location::null_location, and set_attack_indicator().
Referenced by events::mouse_handler::attack_enemy_(), events::mouse_handler::mouse_motion(), and events::mouse_handler::select_hex().
const std::string game_display::attack_indicator_direction | ( | ) | const [inline] |
Function to get attack direction suffix.
Definition at line 136 of file game_display.hpp.
References attack_indicator_dst_, attack_indicator_src_, gamemap::location::get_relative_dir(), and gamemap::location::write_direction().
Referenced by draw().
void game_display::add_overlay | ( | const gamemap::location & | loc, | |
const std::string & | image, | |||
const std::string & | halo = "" | |||
) |
Functions to add and remove overlays from locations.
An overlay is an image that is displayed on top of the tile. One tile may have multiple overlays.
Definition at line 1114 of file game_display.cpp.
References halo::add(), display::get_location_x(), display::get_location_y(), display::hex_size(), and overlays_.
Referenced by playsingle_controller::play_scenario().
void game_display::remove_overlay | ( | const gamemap::location & | loc | ) |
remove_overlay will remove all overlays on a tile.
Definition at line 1123 of file game_display.cpp.
References overlays_, and halo::remove().
void game_display::remove_single_overlay | ( | const gamemap::location & | loc, | |
const std::string & | toDelete | |||
) |
remove_single_overlay will remove a single overlay from a tile
Definition at line 1135 of file game_display.cpp.
References overlays_, and halo::remove().
void game_display::write_overlays | ( | config & | cfg | ) | const |
Function to serialize overlay data.
Definition at line 1155 of file game_display.cpp.
References config::add_child(), and overlays_.
Referenced by game_events::write_events().
t_translation::t_terrain game_display::get_terrain_on | ( | int | palx, | |
int | paly, | |||
int | x, | |||
int | y | |||
) |
void game_display::set_team | ( | size_t | team, | |
bool | observe = false | |||
) |
Sets the team controlled by the player using the computer.
Data from this team will be displayed in the game status. set_playing_team sets the team whose turn it currently is
Definition at line 1174 of file game_display.cpp.
References currentTeam_, display::labels(), map_labels::recalculate_labels(), map_labels::set_team(), teams_, and display::viewpoint_.
Referenced by playsingle_controller::before_human_turn(), play_controller::init(), replay_controller::init_gui(), play_controller::init_side(), playmp_controller::linger(), playsingle_controller::play_side(), playmp_controller::play_side(), turn_info::process_network_data(), replay_controller::replay_show_team1(), and replay_controller::update_teams().
void game_display::set_playing_team | ( | size_t | team | ) |
Definition at line 1191 of file game_display.cpp.
References activeTeam_, display::invalidate_game_status(), and teams_.
Referenced by play_controller::init_side(), and replay_controller::update_teams().
size_t game_display::get_playing_team | ( | ) | const [inline] |
Definition at line 163 of file game_display.hpp.
References activeTeam_.
Referenced by playmp_controller::play_human_turn(), playmp_controller::play_side(), and turn_info::process_network_data().
const std::vector<team>& game_display::get_teams | ( | ) | [inline] |
Definition at line 164 of file game_display.hpp.
References teams_.
Referenced by unit::overlaps(), and unit::redraw_unit().
unit_map& game_display::get_units | ( | ) | [inline] |
Definition at line 166 of file game_display.hpp.
References units_.
Referenced by unit_display::move_unit(), unit::overlaps(), unit::redraw_unit(), unit_display::unit_attack(), and unit_display::unit_recruited().
const unit_map& game_display::get_const_units | ( | ) | const [inline] |
Definition at line 167 of file game_display.hpp.
References units_.
Referenced by unit_animation::matches().
void game_display::debug_highlight | ( | const gamemap::location & | loc, | |
fixed_t | amount | |||
) | [static] |
Draws a cross on a tile to emphasize something there.
It is used in debug mode, typically to show AI plans.
Definition at line 1072 of file game_display.cpp.
References game_config::debug, and debugHighlights_.
static void game_display::clear_debug_highlights | ( | ) | [inline, static] |
Definition at line 172 of file game_display.hpp.
References debugHighlights_.
Referenced by playsingle_controller::play_side().
size_t game_display::viewing_team | ( | ) | const [inline] |
The viewing team is the team currently viewing the game.
Definition at line 175 of file game_display.hpp.
References currentTeam_.
Referenced by calculate_healing(), play_controller::can_execute_command(), events::menu_handler::current_unit(), display_unit_hex(), do_replay_handle(), events::menu_handler::do_search(), draw_report(), draw_sidebar(), play_controller::handle_event(), events::menu_handler::has_friends(), events::menu_handler::has_team(), highlight_hex(), events::menu_handler::label_terrain(), unit_display::move_unit(), unit::redraw_unit(), events::menu_handler::rename_unit(), events::menu_handler::scenario_settings_table(), events::mouse_handler::select_hex(), events::menu_handler::send_chat_message(), events::menu_handler::show_chat_log(), events::menu_handler::show_enemy_moves(), play_controller::show_menu(), play_controller::show_statistics(), events::menu_handler::status_table(), events::mouse_handler::unit_in_cycle(), events::menu_handler::unit_list(), and unit_display::unit_visible_on_path().
size_t game_display::playing_team | ( | ) | const [inline] |
The playing team is the team whose turn it is.
Definition at line 177 of file game_display.hpp.
References activeTeam_.
Referenced by unit::redraw_unit(), play_controller::show_menu(), replay_controller::show_statistics(), and events::menu_handler::write_game_snapshot().
bool game_display::team_valid | ( | ) | const [inline] |
Definition at line 179 of file game_display.hpp.
References currentTeam_, and teams_.
Referenced by events::menu_handler::clear_labels(), current_team_name(), draw_report(), and unit::redraw_unit().
const std::string game_display::current_team_name | ( | ) | const |
Definition at line 1165 of file game_display.cpp.
References currentTeam_, team_valid(), and teams_.
Referenced by events::menu_handler::clear_labels().
void game_display::add_observer | ( | const std::string & | name | ) | [inline] |
Definition at line 182 of file game_display.hpp.
References observers_.
Referenced by turn_info::process_network_data().
void game_display::remove_observer | ( | const std::string & | name | ) | [inline] |
Definition at line 183 of file game_display.hpp.
References observers_.
Referenced by turn_info::process_network_data().
const std::set<std::string>& game_display::observers | ( | ) | const [inline] |
Definition at line 184 of file game_display.hpp.
References observers_.
Referenced by events::menu_handler::has_friends(), turn_info::process_network_data(), and gui::floating_textbox::tab().
void game_display::add_chat_message | ( | const time_t & | time, | |
const std::string & | speaker, | |||
int | side, | |||
const std::string & | msg, | |||
game_display::MESSAGE_TYPE | type, | |||
bool | bell | |||
) |
Definition at line 1213 of file game_display.cpp.
References font::add_floating_label(), chat_message_bg, chat_message_border, chat_message_colour, chat_message_x, chat_messages_, lg::engine, lg::err, preferences::get_chat_timestamp(), font::get_floating_label_rect(), team::get_side_color_range(), int_to_color(), preferences::is_friend(), preferences::is_ignored(), is_observer(), font::LEFT_ALIGN, LOG_STREAM, preferences::login(), display::map_outside_area(), MESSAGE_PRIVATE, MESSAGE_PUBLIC, sound::play_UI_sound(), prune_chat_messages(), game_config::sounds::receive_message, game_config::sounds::receive_message_friend, game_config::sounds::receive_message_highlight, game_config::sounds::receive_message_server, rect, preferences::show_lobby_join(), font::SIZE_SMALL, display::w(), utils::word_match(), and font::word_wrap_text().
Referenced by events::menu_handler::add_chat_message(), check_checksums(), do_replay_handle(), ai_interface::log_message(), turn_info::process_network_data(), show_wml_errors(), and gui::floating_textbox::tab().
void game_display::clear_chat_messages | ( | ) | [inline] |
Definition at line 189 of file game_display.hpp.
References prune_chat_messages().
Referenced by events::menu_handler::clear_messages(), events::console_handler::do_clear(), and replay_controller::reset_replay().
void game_display::begin_game | ( | ) |
Definition at line 1198 of file game_display.cpp.
References display::create_buttons(), in_game_, and display::invalidate_all().
Referenced by play_controller::init_gui().
virtual bool game_display::in_game | ( | ) | const [inline, virtual] |
void game_display::draw_bar | ( | const std::string & | image, | |
int | xpos, | |||
int | ypos, | |||
const int | drawing_order, | |||
size_t | height, | |||
double | filled, | |||
const SDL_Color & | col, | |||
fixed_t | alpha | |||
) |
Definition at line 622 of file game_display.cpp.
References calculate_energy_bar(), create_compatible_surface(), display::drawing_buffer_add(), ftofxp, fxpdiv, fxpmult, fxptoi, image::get_image(), display::get_zoom_factor(), display::h(), display::LAYER_UNIT_BAR, image::UNMASKED, and display::w().
Referenced by unit::redraw_unit().
void game_display::set_game_mode | ( | const tgame_mode | game_mode | ) |
Definition at line 690 of file game_display.cpp.
References game_mode_, and display::invalidate_all().
Referenced by playsingle_controller::linger(), playmp_controller::linger(), and playmp_controller::reset_end_scenario_button().
void game_display::operator= | ( | const game_display & | ) | [private] |
void game_display::draw_sidebar | ( | ) | [private] |
Definition at line 560 of file game_display.cpp.
References displayedUnitHex_, draw_game_status(), draw_report(), unit_map::end(), find_visible_unit(), display::invalidateGameStatus_, invalidateUnit_, display::map_, r, reports::REPORT_CLOCK, reports::REPORT_COUNTDOWN, teams_, reports::UNIT_REPORTS_BEGIN, reports::UNIT_REPORTS_END, units_, and viewing_team().
Referenced by draw().
void game_display::draw_game_status | ( | ) | [private] |
Definition at line 549 of file game_display.cpp.
References draw_report(), r, reports::STATUS_REPORTS_BEGIN, reports::STATUS_REPORTS_END, and teams_.
Referenced by draw_sidebar().
surface game_display::get_flag | ( | const gamemap::location & | loc | ) | [private] |
Definition at line 826 of file game_display.cpp.
References preferences::animate_map(), currentTeam_, flags_, display::fogged(), image::get_image(), gamemap::get_terrain(), gamemap::is_village(), display::map_, image::SCALED_TO_HEX, and teams_.
Referenced by draw().
const SDL_Rect & game_display::calculate_energy_bar | ( | surface | surf | ) | [private] |
Finds the start and end rows on the energy bar image.
White pixels are substituted for the colour of the energy
Definition at line 957 of file game_display.cpp.
References boost::foreach_detail_::begin(), energy_bar_rects_, make_neutral_surface(), and surface_lock::pixels().
Referenced by draw_bar().
void game_display::invalidate_route | ( | ) | [private] |
Definition at line 915 of file game_display.cpp.
References invalidate(), route_, and paths::route::steps.
Referenced by set_route().
void game_display::prune_chat_messages | ( | bool | remove_all = false |
) | [private] |
Definition at line 1309 of file game_display.cpp.
References preferences::chat_lines(), chat_messages_, font::get_floating_label_rect(), display::h(), font::move_floating_label(), and font::remove_floating_label().
Referenced by add_chat_message(), clear_chat_messages(), draw(), and ~game_display().
void game_display::process_reachmap_changes | ( | ) | [private] |
Definition at line 871 of file game_display.cpp.
References display::get_visible_hex_bounds(), invalidate(), loc, reach_map_, reach_map_changed_, reach_map_old_, gamemap::location::x, and gamemap::location::y.
Referenced by draw().
unit_map& game_display::units_ [private] |
Definition at line 221 of file game_display.hpp.
Referenced by display_unit_hex(), draw(), draw_minimap_units(), draw_movement_info(), draw_report(), draw_sidebar(), footsteps_images(), get_const_units(), get_units(), highlight_hex(), invalidate(), invalidate_animations(), and scroll_to_leader().
unit* game_display::temp_unit_ [private] |
Definition at line 223 of file game_display.hpp.
Referenced by draw(), invalidate(), invalidate_animations(), place_temporary_unit(), and remove_temporary_unit().
Definition at line 224 of file game_display.hpp.
Referenced by draw(), invalidate(), invalidate_animations(), place_temporary_unit(), and remove_temporary_unit().
Definition at line 227 of file game_display.hpp.
Referenced by attack_indicator_direction(), draw(), and set_attack_indicator().
Definition at line 228 of file game_display.hpp.
Referenced by attack_indicator_direction(), draw(), and set_attack_indicator().
std::map<surface,SDL_Rect> game_display::energy_bar_rects_ [private] |
paths::route game_display::route_ [private] |
Definition at line 235 of file game_display.hpp.
Referenced by draw_movement_info(), footsteps_images(), invalidate_route(), and set_route().
const gamestatus& game_display::status_ [private] |
Definition at line 237 of file game_display.hpp.
Referenced by adjust_colours(), draw(), draw_report(), get_game_status(), and new_turn().
const std::vector<team>& game_display::teams_ [private] |
Definition at line 239 of file game_display.hpp.
Referenced by current_team_name(), display_unit_hex(), draw(), draw_game_status(), draw_minimap_units(), draw_report(), draw_sidebar(), game_display(), get_flag(), get_teams(), highlight_hex(), invalidate_animations(), set_playing_team(), set_team(), and team_valid().
const config& game_display::level_ [private] |
bool game_display::invalidateUnit_ [private] |
Definition at line 245 of file game_display.hpp.
Referenced by draw_sidebar(), and invalidate_unit().
Definition at line 246 of file game_display.hpp.
Referenced by display_unit_hex(), draw_report(), draw_sidebar(), highlight_hex(), and invalidate_unit_after_move().
overlay_map game_display::overlays_ [private] |
Definition at line 259 of file game_display.hpp.
Referenced by add_overlay(), draw(), remove_overlay(), remove_single_overlay(), and write_overlays().
size_t game_display::currentTeam_ [private] |
Definition at line 261 of file game_display.hpp.
Referenced by current_team_name(), draw(), draw_minimap_units(), draw_report(), get_flag(), invalidate_animations(), set_team(), team_valid(), and viewing_team().
size_t game_display::activeTeam_ [private] |
Definition at line 261 of file game_display.hpp.
Referenced by draw_report(), get_playing_team(), playing_team(), and set_playing_team().
double game_display::sidebarScaling_ [private] |
Definition at line 263 of file game_display.hpp.
bool game_display::first_turn_ [private] |
bool game_display::in_game_ [private] |
std::set<std::string> game_display::observers_ [private] |
Definition at line 267 of file game_display.hpp.
Referenced by add_observer(), draw_report(), observers(), and remove_observer().
std::vector<chat_message> game_display::chat_messages_ [private] |
Definition at line 281 of file game_display.hpp.
Referenced by add_chat_message(), and prune_chat_messages().
surface game_display::tod_hex_mask1 [private] |
surface game_display::tod_hex_mask2 [private] |
reach_map game_display::reach_map_ [private] |
Definition at line 289 of file game_display.hpp.
Referenced by draw(), draw_movement_info(), highlight_another_reach(), process_reachmap_changes(), and unhighlight_reach().
reach_map game_display::reach_map_old_ [private] |
bool game_display::reach_map_changed_ [private] |
Definition at line 291 of file game_display.hpp.
Referenced by highlight_another_reach(), process_reachmap_changes(), and unhighlight_reach().
tgame_mode game_display::game_mode_ [private] |
std::map< gamemap::location, fixed_t > game_display::debugHighlights_ [static, private] |
Definition at line 297 of file game_display.hpp.
Referenced by clear_debug_highlights(), debug_highlight(), and draw().
std::vector<animated<image::locator> > game_display::flags_ [private] |
Animated flags for each team.
Definition at line 300 of file game_display.hpp.
Referenced by game_display(), get_flag(), and invalidate_animations().
game_display * game_display::singleton_ = NULL [static, private] |
Definition at line 302 of file game_display.hpp.
Referenced by game_display(), get_singleton(), and ~game_display().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |