The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
game_display Class Reference

#include <game_display.hpp>

Inheritance diagram for game_display:
Inheritance graph

Public Types

enum  tgame_mode { RUNNING, LINGER }
 Sets the linger mode for the display. More...
 
- Public Types inherited from display
enum  SCROLL_TYPE { SCROLL, WARP, ONSCREEN, ONSCREEN_WARP }
 
enum  tdrawing_layer {
  LAYER_TERRAIN_BG, LAYER_GRID_TOP, LAYER_MOUSEOVER_OVERLAY, LAYER_FOOTSTEPS,
  LAYER_MOUSEOVER_TOP, LAYER_UNIT_FIRST, LAYER_UNIT_BG = LAYER_UNIT_FIRST+10, LAYER_UNIT_DEFAULT =LAYER_UNIT_FIRST+40,
  LAYER_TERRAIN_FG = LAYER_UNIT_FIRST+50, LAYER_GRID_BOTTOM, LAYER_UNIT_MOVE_DEFAULT =LAYER_UNIT_FIRST+60, LAYER_UNIT_FG = LAYER_UNIT_FIRST+80,
  LAYER_UNIT_MISSILE_DEFAULT = LAYER_UNIT_FIRST+90, LAYER_UNIT_LAST =LAYER_UNIT_FIRST+100, LAYER_REACHMAP, LAYER_MOUSEOVER_BOTTOM,
  LAYER_FOG_SHROUD, LAYER_ARROWS, LAYER_ACTIONS_NUMBERING, LAYER_SELECTED_HEX,
  LAYER_ATTACK_INDICATOR, LAYER_UNIT_BAR, LAYER_MOVE_INFO, LAYER_LINGER_OVERLAY,
  LAYER_BORDER, LAYER_LAST_LAYER
}
 The layers to render something on. More...
 

Public Member Functions

 game_display (game_board &board, CVideo &video, boost::weak_ptr< wb::manager > wb, reports &reports_object, const tod_manager &tod_manager, const config &theme_cfg, const config &level, bool dummy=false)
 
 ~game_display ()
 
void new_turn ()
 Update lighting settings. More...
 
const std::set< std::string > & observers () const
 
void scroll_to_leader (int side, SCROLL_TYPE scroll_type=ONSCREEN, bool force=true)
 Scrolls to the leader of a certain side. More...
 
virtual void select_hex (map_location hex)
 Function to display a location as selected. More...
 
virtual void highlight_hex (map_location hex)
 Function to highlight a location. More...
 
void display_unit_hex (map_location hex)
 Change the unit to be displayed in the sidebar. More...
 
void highlight_reach (const pathfind::paths &paths_list)
 Sets the paths that are currently displayed as available for the unit to move along. More...
 
void highlight_another_reach (const pathfind::paths &paths_list)
 Add more paths to highlight. More...
 
void unhighlight_reach ()
 Reset highlighting of paths. More...
 
void set_route (const pathfind::marked_route *route)
 Sets the route along which footsteps are drawn to show movement of a unit. More...
 
void float_label (const map_location &loc, const std::string &text, const SDL_Color &color)
 Function to float a label above a tile. More...
 
void draw_movement_info (const map_location &loc)
 Draws the movement info (turns available) for a given location. More...
 
void invalidate_unit ()
 Function to invalidate that unit status displayed on the sidebar. More...
 
void invalidate_unit_after_move (const map_location &src, const map_location &dst)
 Same as invalidate_unit() if moving the displayed unit. More...
 
const time_of_dayget_time_of_day (const map_location &loc) const
 
bool has_time_area () const
 
const tod_managerget_tod_man () const
 Allows this class to properly implement filter context, used for animations. More...
 
void set_attack_indicator (const map_location &src, const map_location &dst)
 Set the attack direction indicator. More...
 
void clear_attack_indicator ()
 
std::string attack_indicator_direction () const
 Function to get attack direction suffix. More...
 
t_translation::t_terrain get_terrain_on (int palx, int paly, int x, int y)
 
void set_playing_team (size_t team)
 Sets the team controlled by the player using the computer. More...
 
const map_locationdisplayed_unit_hex () const
 Virtual functions shadowed in game_display. More...
 
int playing_side () const
 The playing team is the team whose turn it is. More...
 
std::string current_team_name () const
 
display_chat_managerget_chat_manager ()
 
void begin_game ()
 
virtual bool in_game () const
 
void set_game_mode (const tgame_mode game_mode)
 
void needs_rebuild (bool b)
 Sets whether the screen (map visuals) needs to be rebuilt. This is typically after the map has been changed by wml. More...
 
bool maybe_rebuild ()
 Rebuilds the screen if needs_rebuild(true) was previously called, and resets the flag. More...
 
void reset_tod_manager (const tod_manager &tod_manager)
 
- Public Member Functions inherited from display
 display (const display_context *dc, CVideo &video, boost::weak_ptr< wb::manager > wb, reports &reports_object, const config &theme_cfg, const config &level, bool auto_join=true)
 
virtual ~display ()
 
bool show_everything () const
 
const gamemapget_map () const
 
const std::vector< team > & get_teams () const
 
size_t playing_team () const
 The playing team is the team whose turn it is. More...
 
bool team_valid () const
 
size_t viewing_team () const
 The viewing team is the team currently viewing the game. More...
 
int viewing_side () const
 
void set_team (size_t team, bool observe=false)
 Sets the team controlled by the player using the computer. More...
 
void set_playing_team (size_t team)
 set_playing_team sets the team whose turn it currently is More...
 
void clear_exclusive_draws ()
 Cancels all the exclusive draw requests. More...
 
const unit_mapget_units () const
 
bool add_exclusive_draw (const map_location &loc, unit &unit)
 Allows a unit to request to be the only one drawn in its hex. More...
 
std::string remove_exclusive_draw (const map_location &loc)
 Cancels an exclusive draw request. More...
 
void parse_team_overlays ()
 Check the overlay_map for proper team-specific overlays to be displayed/hidden. More...
 
void add_overlay (const map_location &loc, const std::string &image, const std::string &halo="", const std::string &team_name="", const std::string &item_id="", bool visible_under_fog=true)
 Functions to add and remove overlays from locations. More...
 
void remove_overlay (const map_location &loc)
 remove_overlay will remove all overlays on a tile. More...
 
void remove_single_overlay (const map_location &loc, const std::string &toDelete)
 remove_single_overlay will remove a single overlay from a tile More...
 
void reload_map ()
 Updates internals that cache map size. More...
 
void change_display_context (const display_context *dc)
 
const display_contextget_disp_context () const
 
virtual const game_dataget_game_data () const
 
virtual game_lua_kernelget_lua_kernel () const
 TODO: display should not work as a filter context, this was only done for expedience so that the unit animation code can have a convenient and correct filter context readily available. a more correct solution is most likely to pass it a filter context from unit_animator when it needs to be matched. (it's not possible to store filter contexts with animations, because animations are cached across scenarios.) Note that after these lines which return nullptr, unit filters used in animations will not be able to make use of wml variables or lua scripting (but the latter was a bad idea anyways because it would be slow to constantly recompile the script.) More...
 
void reset_halo_manager ()
 
void reset_halo_manager (halo::manager &hm)
 
halo::managerget_halo_manager ()
 
void update_tod ()
 Add r,g,b from tod_manager to the map. More...
 
void adjust_color_overlay (int r, int g, int b)
 Add r,g,b to the colors for all images displayed on the map. More...
 
CVideovideo ()
 Gets the underlying screen object. More...
 
surfaceget_screen_surface ()
 return the screen surface or the surface used for map_screenshot. More...
 
virtual bool in_editor () const
 
int w () const
 the dimensions of the display. More...
 
int h () const
 height More...
 
const SDL_Rect & minimap_area () const
 
const SDL_Rect & palette_area () const
 
const SDL_Rect & unit_image_area () const
 
SDL_Rect screen_area () const
 
const SDL_Rect & max_map_area () const
 Returns the maximum area used for the map regardless to resolution and view size. More...
 
const SDL_Rect & map_area () const
 Returns the area used for the map. More...
 
const SDL_Rect & map_outside_area () const
 Returns the available area for a map, this may differ from the above. More...
 
bool outside_area (const SDL_Rect &area, const int x, const int y) const
 Check if the bbox of the hex at x,y has pixels outside the area rectangle. More...
 
int hex_width () const
 Function which returns the width of a hex in pixels, up to where the next hex starts. More...
 
int hex_size () const
 Function which returns the size of a hex in pixels (from top tip to bottom tip or left edge to right edge). More...
 
double get_zoom_factor () const
 Returns the current zoom factor. More...
 
const map_location hex_clicked_on (int x, int y) const
 given x,y co-ordinates of an onscreen pixel, will return the location of the hex that this pixel corresponds to. More...
 
const map_location pixel_position_to_hex (int x, int y) const
 given x,y co-ordinates of a pixel on the map, will return the location of the hex that this pixel corresponds to. More...
 
map_location minimap_location_on (int x, int y)
 given x,y co-ordinates of the mouse, will return the location of the hex in the minimap that the mouse is currently over, or an invalid location if the mouse isn't over the minimap. More...
 
const map_locationselected_hex () const
 
const map_locationmouseover_hex () const
 
void invalidate_game_status ()
 Function to invalidate the game status displayed on the sidebar. More...
 
int get_location_x (const map_location &loc) const
 Functions to get the on-screen positions of hexes. More...
 
int get_location_y (const map_location &loc) const
 
const rect_of_hexes hexes_under_rect (const SDL_Rect &r) const
 Return the rectangular area of hexes overlapped by r (r is in screen coordinates) More...
 
const rect_of_hexes get_visible_hexes () const
 Returns the rectangular area of visible hexes. More...
 
bool shrouded (const map_location &loc) const
 Returns true if location (x,y) is covered in shroud. More...
 
bool fogged (const map_location &loc) const
 Returns true if location (x,y) is covered in fog. More...
 
void set_grid (const bool grid)
 Determines whether a grid should be overlayed on the game board. More...
 
bool get_draw_coordinates () const
 Getter for the x,y debug overlay on tiles. More...
 
void set_draw_coordinates (bool value)
 Setter for the x,y debug overlay on tiles. More...
 
bool get_draw_terrain_codes () const
 Getter for the terrain code debug overlay on tiles. More...
 
void set_draw_terrain_codes (bool value)
 Setter for the terrain code debug overlay on tiles. More...
 
bool screenshot (const std::string &filename, bool map_screenshot=false)
 Save a (map-)screenshot and return whether the operation succeeded. More...
 
void redraw_everything ()
 Invalidates entire screen, including all tiles and sidebar. More...
 
void add_redraw_observer (std::function< void(display &)> f)
 Adds a redraw observer, a function object to be called when redraw_everything is used. More...
 
void clear_redraw_observers ()
 Clear the redraw observers. More...
 
themeget_theme ()
 
std::shared_ptr< gui::buttonfind_action_button (const std::string &id)
 Retrieves a pointer to a theme UI button. More...
 
std::shared_ptr< gui::buttonfind_menu_button (const std::string &id)
 
std::shared_ptr< gui::zoom_sliderfind_slider (const std::string &id)
 
gui::button::TYPE string_to_button_type (std::string type)
 
void create_buttons ()
 
void layout_buttons ()
 
void render_buttons ()
 
void invalidate_theme ()
 
void refresh_report (std::string const &report_name, const config *new_cfg=nullptr)
 Redraws the specified report (if anything has changed). More...
 
void draw_minimap_units ()
 
void invalidate_all ()
 Function to invalidate all tiles. More...
 
bool invalidate (const map_location &loc)
 Function to invalidate a specific tile for redrawing. More...
 
bool invalidate (const std::set< map_location > &locs)
 
bool propagate_invalidation (const std::set< map_location > &locs)
 If this set is partially invalidated, invalidate all its hexes. More...
 
bool invalidate_locations_in_rect (const SDL_Rect &rect)
 invalidate all hexes under the rectangle rect (in screen coordinates) More...
 
bool invalidate_visible_locations_in_rect (const SDL_Rect &rect)
 
void invalidate_animations ()
 Function to invalidate animated terrains and units which may have changed. More...
 
void invalidate_animations_location (const map_location &loc)
 Per-location invalidation called by invalidate_animations() Extra game per-location invalidation (village ownership) More...
 
void set_mouseover_hex_overlay (const surface &image)
 mouseover_hex_overlay_ require a prerendered surface and is drawn underneath the mouse's location More...
 
void clear_mouseover_hex_overlay ()
 
terrain_builderget_builder ()
 
void flip ()
 
void update_display ()
 Copy the backbuffer to the framebuffer. More...
 
void rebuild_all ()
 Rebuild all dynamic terrain. More...
 
const theme::actionaction_pressed ()
 
const theme::menumenu_pressed ()
 
void enable_menu (const std::string &item, bool enable)
 Finds the menu which has a given item in it, and enables or disables it. More...
 
void set_diagnostic (const std::string &msg)
 
void set_turbo (const bool turbo)
 Set/Get whether 'turbo' mode is on. More...
 
double turbo_speed () const
 
void set_turbo_speed (const double speed)
 
void set_idle_anim (bool ison)
 control unit idle animations and their frequency More...
 
bool idle_anim () const
 
void set_idle_anim_rate (int rate)
 
double idle_anim_rate () const
 
void bounds_check_position ()
 
void bounds_check_position (int &xpos, int &ypos)
 
bool scroll (int xmov, int ymov, bool force=false)
 Scrolls the display by xmov,ymov pixels. More...
 
bool set_zoom (int amount, bool absolute=false)
 Zooms the display by the specified amount. More...
 
bool zoom_at_max () const
 
bool zoom_at_min () const
 
void set_default_zoom ()
 Sets the zoom amount to the default. More...
 
bool view_locked () const
 
void set_view_locked (bool value)
 Sets whether the map view is locked (e.g. More...
 
void scroll_to_tile (const map_location &loc, SCROLL_TYPE scroll_type=ONSCREEN, bool check_fogged=true, bool force=true)
 Scroll such that location loc is on-screen. More...
 
void scroll_to_tiles (map_location loc1, map_location loc2, SCROLL_TYPE scroll_type=ONSCREEN, bool check_fogged=true, double add_spacing=0.0, bool force=true)
 Scroll such that location loc1 is on-screen. More...
 
void scroll_to_tiles (const std::vector< map_location >::const_iterator &begin, const std::vector< map_location >::const_iterator &end, SCROLL_TYPE scroll_type=ONSCREEN, bool check_fogged=true, bool only_if_possible=false, double add_spacing=0.0, bool force=true)
 Scroll to fit as many locations on-screen as possible, starting with the first. More...
 
void scroll_to_tiles (const std::vector< map_location > &locs, SCROLL_TYPE scroll_type=ONSCREEN, bool check_fogged=true, bool only_if_possible=false, double add_spacing=0.0, bool force=true)
 Scroll to fit as many locations on-screen as possible, starting with the first. More...
 
events::generic_eventscroll_event () const
 Expose the event, so observers can be notified about map scrolling. More...
 
events::generic_eventcomplete_redraw_event ()
 
bool tile_fully_on_screen (const map_location &loc)
 Check if a tile is fully visible on screen. More...
 
bool tile_nearly_on_screen (const map_location &loc) const
 Checks if location loc or one of the adjacent tiles is visible on screen. More...
 
virtual void draw ()
 Draws invalidated items. More...
 
void draw (bool update)
 
void draw (bool update, bool force)
 
map_labelslabels ()
 
const map_labelslabels () const
 
void announce (const std::string &msg, const SDL_Color &color=font::GOOD_COLOR)
 Announce a message prominently. More...
 
void recalculate_minimap ()
 Schedule the minimap for recalculation. More...
 
void redraw_minimap ()
 Schedule the minimap to be redrawn. More...
 
void blindfold (bool flag)
 
bool is_blindfolded () const
 
void write (config &cfg) const
 
virtual void handle_event (const SDL_Event &)
 
virtual void handle_window_event (const SDL_Event &event)
 
void init_flags ()
 Init the flag list and the team colors used by ~TC. More...
 
void reinit_flags_for_side (size_t side)
 Rebuild the flag list (not team colors) for a single side. More...
 
void reset_reports (reports &reports_object)
 
void render_image (int x, int y, const display::tdrawing_layer drawing_layer, const map_location &loc, surface image, bool hreverse=false, bool greyscale=false, fixed_t alpha=ftofxp(1.0), Uint32 blendto=0, double blend_ratio=0, double submerged=0.0, bool vreverse=false)
 Draw an image at a certain location. More...
 
void draw_text_in_hex (const map_location &loc, const tdrawing_layer layer, const std::string &text, size_t font_size, SDL_Color color, double x_in_hex=0.5, double y_in_hex=0.5)
 Draw text on a hex. More...
 
void drawing_buffer_add (const tdrawing_layer layer, const map_location &loc, int x, int y, const surface &surf, const SDL_Rect &clip=SDL_Rect())
 Add an item to the drawing buffer. More...
 
void drawing_buffer_add (const tdrawing_layer layer, const map_location &loc, int x, int y, const std::vector< surface > &surf, const SDL_Rect &clip=SDL_Rect())
 
void add_arrow (arrow &)
 
void remove_arrow (arrow &)
 
void update_arrow (arrow &a)
 Called by arrow objects when they change. More...
 
void replace_overlay_map (overlay_map *overlays)
 
- Public Member Functions inherited from filter_context
virtual ~filter_context ()
 
- Public Member Functions inherited from events::sdl_handler
virtual void process_event ()
 
virtual void volatile_draw ()
 
virtual void volatile_undraw ()
 
virtual bool requires_event_focus (const SDL_Event *=nullptr) const
 
virtual void process_help_string (int, int)
 
virtual void process_tooltip_string (int, int)
 
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 ()
 

Static Public Member Functions

static game_displaycreate_dummy_display (CVideo &video)
 
static game_displayget_singleton ()
 
static intdebug_highlight (const map_location &loc)
 annotate hex with number, useful for debugging or UI prototype More...
 
static void clear_debug_highlights ()
 
- Static Public Member Functions inherited from display
static displayget_singleton ()
 Returns the display object if a display object exists. More...
 
static Uint32 rgb (Uint8 red, Uint8 green, Uint8 blue)
 
static Uint8 red (Uint32 color)
 
static Uint8 green (Uint32 color)
 
static Uint8 blue (Uint32 color)
 
static Uint32 max_rgb (Uint32 first, Uint32 second)
 
static void sunset (const size_t delay=0)
 Debug function to toggle the "sunset" mode. More...
 
static void toggle_benchmark ()
 Toggle to continuously redraw the screen. More...
 
static void toggle_debug_foreground ()
 Toggle to debug foreground terrain. More...
 

Protected Member Functions

void pre_draw ()
 game_display pre_draw does specific things related e.g. More...
 
void post_draw ()
 Calls the whiteboard's post-draw method. More...
 
void draw_invalidated ()
 Only called when there's actual redrawing to do. More...
 
void post_commit ()
 Hook for actions to take right after draw() calls drawing_buffer_commit No action here by default. More...
 
void draw_hex (const map_location &loc)
 Redraws a single gamemap location. More...
 
- Protected Member Functions inherited from display
void clear_screen ()
 Clear the screen contents. More...
 
virtual const SDL_Rect & get_clip_rect ()
 Get the clipping rectangle for drawing. More...
 
virtual image::TYPE get_image_type (const map_location &loc)
 
virtual void draw_border (const map_location &loc, const int xpos, const int ypos)
 Draws the border tile overlay. More...
 
void draw_minimap ()
 
std::vector< surfaceget_terrain_images (const map_location &loc, const std::string &timeid, image::TYPE type, TERRAIN_TYPE terrain_type)
 
std::vector< surfaceget_fog_shroud_images (const map_location &loc, image::TYPE image_type)
 
void draw_image_for_report (surface &img, SDL_Rect &rect)
 
void scroll_to_xy (int screenxpos, int screenypos, SCROLL_TYPE scroll_type, bool force=true)
 
void fill_images_list (const std::string &prefix, std::vector< std::string > &images)
 
const std::stringget_variant (const std::vector< std::string > &variants, const map_location &loc) const
 
void drawing_buffer_commit ()
 Draws the drawing_buffer_ and clears it. More...
 
void drawing_buffer_clear ()
 Clears the drawing buffer. More...
 
void draw_all_panels ()
 redraw all panels associated with the map display More...
 
void draw_init ()
 Initiate a redraw. More...
 
void draw_wrap (bool update, bool force)
 
void process_reachmap_changes ()
 
- Protected Member Functions inherited from video2::draw_layering
 draw_layering (const bool auto_join=true)
 
virtual ~draw_layering ()
 
- 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

 game_display (const game_display &)
 
void operator= (const game_display &)
 
void draw_sidebar ()
 Called near the end of a draw operation, derived classes can use this to render a specific sidebar. More...
 
void invalidate_route ()
 

Private Attributes

overlay_map overlay_map_
 
map_location attack_indicator_src_
 
map_location attack_indicator_dst_
 
pathfind::marked_route route_
 
const tod_managertod_manager_
 
map_location displayedUnitHex_
 
double sidebarScaling_
 
bool first_turn_
 
bool in_game_
 
boost::scoped_ptr
< display_chat_manager
chat_man_
 
tgame_mode game_mode_
 
bool needs_rebuild_
 

Static Private Attributes

static std::map< map_location,
int
debugHighlights_
 

Additional Inherited Members

- Protected Types inherited from display
enum  TERRAIN_TYPE { BACKGROUND, FOREGROUND }
 
typedef std::map< map_location,
std::string
exclusive_unit_draw_requests_t
 
typedef std::list< tblittdrawing_buffer
 
typedef std::map< map_location,
unsigned int
reach_map
 
typedef std::multimap
< map_location, overlay
overlay_map
 
- Protected Attributes inherited from display
const display_contextdc_
 
boost::scoped_ptr< halo::managerhalo_man_
 
boost::weak_ptr< wb::managerwb_
 
exclusive_unit_draw_requests_t exclusive_unit_draw_requests_
 map of hexes where only one unit should be drawn, the one identified by the associated id string More...
 
CVideoscreen_
 
size_t currentTeam_
 
bool dont_show_all_
 
std::map< surface, SDL_Rect > energy_bar_rects_
 
int xpos_
 
int ypos_
 
bool view_locked_
 
theme theme_
 
int zoom_
 
boost::scoped_ptr
< fake_unit_manager
fake_unit_man_
 
boost::scoped_ptr
< terrain_builder
builder_
 
surface minimap_
 
SDL_Rect minimap_location_
 
bool redrawMinimap_
 
bool redraw_background_
 
bool invalidateAll_
 
bool grid_
 
int diagnostic_label_
 
bool panelsDrawn_
 
double turbo_speed_
 
bool turbo_
 
bool invalidateGameStatus_
 
boost::scoped_ptr< map_labelsmap_labels_
 
reportsreports_object_
 
events::generic_event scroll_event_
 Event raised when the map is being scrolled. More...
 
events::generic_event complete_redraw_event_
 notify observers that the screen has been redrawn completely atm this is used for replay_controller to add replay controls to the standard theme More...
 
int nextDraw_
 Holds the tick count for when the next drawing event is scheduled. More...
 
std::map< std::string, SDL_Rect > reportRects_
 
std::map< std::string, surfacereportSurfaces_
 
std::map< std::string, configreports_
 
std::vector< std::shared_ptr
< gui::button > > 
menu_buttons_
 
std::vector< std::shared_ptr
< gui::button > > 
action_buttons_
 
std::vector< std::shared_ptr
< gui::zoom_slider > > 
sliders_
 
std::set< map_locationinvalidated_
 
std::set< map_locationprevious_invalidated_
 
surface mouseover_hex_overlay_
 
surface tod_hex_mask1
 
surface tod_hex_mask2
 
std::vector< std::stringfog_images_
 
std::vector< std::stringshroud_images_
 
map_location selectedHex_
 
map_location mouseoverHex_
 
CKey keys_
 
bool animate_map_
 Local cache for preferences::animate_map, since it is constantly queried. More...
 
bool animate_water_
 Local version of preferences::animate_water, used to detect when it's changed. More...
 
size_t activeTeam_
 
tdrawing_buffer drawing_buffer_
 
bool map_screenshot_
 Used to indicate to drawing functions that we are doing a map screenshot. More...
 
reach_map reach_map_
 
reach_map reach_map_old_
 
bool reach_map_changed_
 
- Static Protected Attributes inherited from display
static int last_zoom_ = SmallZoom
 
static displaysingleton_ = nullptr
 

Detailed Description

Definition at line 38 of file game_display.hpp.

Member Enumeration Documentation

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 behavior. There might even be a split between victory and defeat.

Todo:
if the current implementation is wanted we can change the stuff back to a boolean
Enumerator
RUNNING 

no linger overlay, show fog and shroud.

LINGER 

Definition at line 215 of file game_display.hpp.

Constructor & Destructor Documentation

game_display::game_display ( game_board board,
CVideo video,
boost::weak_ptr< wb::manager wb,
reports reports_object,
const tod_manager tod_manager,
const config theme_cfg,
const config level,
bool  dummy = false 
)
game_display::~game_display ( )

Definition at line 106 of file game_display.cpp.

References chat_man_.

game_display::game_display ( const game_display )
private

Member Function Documentation

std::string game_display::attack_indicator_direction ( ) const
inline

Function to get attack direction suffix.

Definition at line 164 of file game_display.hpp.

References attack_indicator_dst_, attack_indicator_src_, map_location::get_relative_dir(), and map_location::write_direction().

Referenced by draw_hex().

void game_display::begin_game ( )

Definition at line 791 of file game_display.cpp.

References display::create_buttons(), in_game_, and display::invalidate_all().

void game_display::clear_attack_indicator ( )
static void game_display::clear_debug_highlights ( )
inlinestatic

Definition at line 190 of file game_display.hpp.

References debugHighlights_.

game_display * game_display::create_dummy_display ( CVideo video)
static

Definition at line 95 of file game_display.cpp.

References help::dummy_cfg, and game_display().

std::string game_display::current_team_name ( ) const
int & game_display::debug_highlight ( const map_location loc)
static

annotate hex with number, useful for debugging or UI prototype

Definition at line 749 of file game_display.cpp.

References game_config::debug, and debugHighlights_.

void game_display::display_unit_hex ( map_location  hex)
const map_location& game_display::displayed_unit_hex ( ) const
inlinevirtual

Virtual functions shadowed in game_display.

These are needed to generate reports easily, without dynamic casting. Hope to factor out eventually.

Reimplemented from display.

Definition at line 183 of file game_display.hpp.

References displayedUnitHex_.

Referenced by game_lua_kernel::intf_get_displayed_unit().

void game_display::draw_hex ( const map_location loc)
protectedvirtual
void game_display::draw_invalidated ( )
protectedvirtual

Only called when there's actual redrawing to do.

Loops through invalidated locations and redraws them. Derived classes can override this, possibly to insert pre- or post-processing around a call to the base class's function.

Reimplemented from display.

Definition at line 270 of file game_display.cpp.

References display::draw_invalidated(), display::energy_bar_rects_, display::exclusive_unit_draw_requests_, display::fake_unit_man_, display::halo_man_, display::invalidated_, and unit_drawer::redraw_unit().

void game_display::draw_movement_info ( const map_location loc)
void game_display::draw_sidebar ( )
privatevirtual

Called near the end of a draw operation, derived classes can use this to render a specific sidebar.

Very similar to post_commit.

Reimplemented from display.

Definition at line 465 of file game_display.cpp.

References display::invalidateGameStatus_, display::refresh_report(), reports::report_list(), display::reports_object_, and display::team_valid().

void game_display::float_label ( const map_location loc,
const std::string text,
const SDL_Color &  color 
)
display_chat_manager& game_display::get_chat_manager ( )
inline
static game_display* game_display::get_singleton ( )
inlinestatic
t_translation::t_terrain game_display::get_terrain_on ( int  palx,
int  paly,
int  x,
int  y 
)
const time_of_day & game_display::get_time_of_day ( const map_location loc) const
virtual

Reimplemented from display.

Definition at line 455 of file game_display.cpp.

References tod_manager::get_time_of_day(), and tod_manager_.

const tod_manager& game_display::get_tod_man ( ) const
inlinevirtual

Allows this class to properly implement filter context, used for animations.

Reimplemented from display.

Definition at line 135 of file game_display.hpp.

References tod_manager_.

bool game_display::has_time_area ( ) const
virtual

Reimplemented from display.

Definition at line 460 of file game_display.cpp.

References tod_manager::has_time_area(), and tod_manager_.

void game_display::highlight_another_reach ( const pathfind::paths paths_list)

Add more paths to highlight.

Print numbers where they overlap. Used only by Show Enemy Moves.

Definition at line 693 of file game_display.cpp.

References pathfind::paths::step::curr, pathfind::paths::destinations, display::reach_map_, and display::reach_map_changed_.

Referenced by highlight_reach(), events::mouse_handler::select_hex(), and events::menu_handler::show_enemy_moves().

void game_display::highlight_hex ( map_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.

< Lasts for whole method.

Reimplemented from display.

Definition at line 191 of file game_display.cpp.

References unit_map::count(), display::dc_, displayedUnitHex_, display::dont_show_all_, resources::gameboard, game_board::get_visible_unit(), display::highlight_hex(), display::invalidate_game_status(), invalidate_unit(), synced_context::is_synced(), display::mouseoverHex_, display::selectedHex_, display_context::teams(), display_context::units(), and display::viewing_team().

Referenced by events::mouse_handler::attack_enemy_(), events::menu_handler::do_search(), game_lua_kernel::intf_deselect_hex(), game_lua_kernel::intf_highlight_hex(), and events::mouse_handler::mouse_motion().

void game_display::highlight_reach ( const pathfind::paths paths_list)

Sets the paths that are currently displayed as available for the unit to move along.

All other paths will be grayed out.

Definition at line 687 of file game_display.cpp.

References highlight_another_reach(), and unhighlight_reach().

Referenced by events::mouse_handler::mouse_motion(), and events::mouse_handler::select_hex().

virtual bool game_display::in_game ( ) const
inlinevirtual

Reimplemented from display.

Definition at line 203 of file game_display.hpp.

References in_game_.

void game_display::invalidate_route ( )
private

Definition at line 710 of file game_display.cpp.

References i, display::invalidate(), and pathfind::marked_route::steps.

Referenced by set_route().

void game_display::invalidate_unit ( )
inline
void game_display::invalidate_unit_after_move ( const map_location src,
const map_location dst 
)
bool game_display::maybe_rebuild ( )

Rebuilds the screen if needs_rebuild(true) was previously called, and resets the flag.

Definition at line 804 of file game_display.cpp.

References display::invalidate_all(), needs_rebuild_, display::rebuild_all(), and display::recalculate_minimap().

Referenced by game_lua_kernel::intf_redraw(), and game_events::t_pump::process_event().

void game_display::needs_rebuild ( bool  b)

Sets whether the screen (map visuals) needs to be rebuilt. This is typically after the map has been changed by wml.

Definition at line 798 of file game_display.cpp.

References needs_rebuild_.

Referenced by game_lua_kernel::intf_set_terrain(), and game_events::WML_HANDLER_FUNCTION().

void game_display::new_turn ( )
const std::set<std::string>& game_display::observers ( ) const
inlinevirtual

Reimplemented from display.

Definition at line 64 of file game_display.hpp.

References chat_man_.

Referenced by events::menu_handler::has_friends(), and gui2::side_controller::show_nicks_list().

void game_display::operator= ( const game_display )
private
int game_display::playing_side ( ) const
inlinevirtual

The playing team is the team whose turn it is.

Reimplemented from display.

Definition at line 194 of file game_display.hpp.

References display::activeTeam_.

Referenced by turn_info::process_network_data().

void game_display::post_commit ( )
protectedvirtual

Hook for actions to take right after draw() calls drawing_buffer_commit No action here by default.

Reimplemented from display.

Definition at line 286 of file game_display.cpp.

References display::halo_man_.

void game_display::post_draw ( )
protectedvirtual

Calls the whiteboard's post-draw method.

Reimplemented from display.

Definition at line 264 of file game_display.cpp.

References display::wb_.

void game_display::pre_draw ( )
protectedvirtual

game_display pre_draw does specific things related e.g.

to unit rendering and calls the whiteboard pre-draw method.

Todo:
FIXME: must modify changed, but best to do it at the floating_label level

Reimplemented from display.

Definition at line 251 of file game_display.cpp.

References chat_man_, display::process_reachmap_changes(), and display::wb_.

void game_display::reset_tod_manager ( const tod_manager tod_manager)
inline

Definition at line 226 of file game_display.hpp.

References resources::tod_manager, and tod_manager_.

void game_display::scroll_to_leader ( int  side,
SCROLL_TYPE  scroll_type = ONSCREEN,
bool  force = true 
)

Scrolls to the leader of a certain side.

This will normally be the playing team.

Definition at line 237 of file game_display.cpp.

References display::dc_, unit_map::find_leader(), display::scroll_to_tile(), display_context::units(), and unit_map::iterator_base< iter_types >::valid().

Referenced by events::menu_handler::scenario_settings_table(), and events::menu_handler::status_table().

void game_display::select_hex ( map_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 181 of file game_display.cpp.

References display_unit_hex(), display::fogged(), display::select_hex(), and map_location::valid().

Referenced by events::mouse_handler::attack_enemy_(), events::mouse_handler::move_action(), events::mouse_handler::move_unit_along_current_route(), events::mouse_handler::save_whiteboard_attack(), and events::mouse_handler::select_hex().

void game_display::set_attack_indicator ( const map_location src,
const map_location dst 
)

Set the attack direction indicator.

Definition at line 755 of file game_display.cpp.

References attack_indicator_dst_, attack_indicator_src_, and display::invalidate().

Referenced by clear_attack_indicator(), and events::mouse_handler::mouse_motion().

void game_display::set_game_mode ( const tgame_mode  game_mode)

Definition at line 487 of file game_display.cpp.

References game_mode_, and display::invalidate_all().

void game_display::set_playing_team ( size_t  team)

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 784 of file game_display.cpp.

References display::activeTeam_, display::invalidate_game_status(), and teams.

void game_display::set_route ( const pathfind::marked_route route)
void game_display::unhighlight_reach ( )

Member Data Documentation

map_location game_display::attack_indicator_dst_
private

Definition at line 240 of file game_display.hpp.

Referenced by attack_indicator_direction(), draw_hex(), and set_attack_indicator().

map_location game_display::attack_indicator_src_
private

Definition at line 239 of file game_display.hpp.

Referenced by attack_indicator_direction(), draw_hex(), and set_attack_indicator().

boost::scoped_ptr<display_chat_manager> game_display::chat_man_
private

Definition at line 256 of file game_display.hpp.

Referenced by get_chat_manager(), observers(), pre_draw(), and ~game_display().

std::map< map_location, fixed_t > game_display::debugHighlights_
staticprivate

Definition at line 261 of file game_display.hpp.

Referenced by clear_debug_highlights(), debug_highlight(), and draw_hex().

map_location game_display::displayedUnitHex_
private
bool game_display::first_turn_
private

Definition at line 254 of file game_display.hpp.

Referenced by new_turn().

tgame_mode game_display::game_mode_
private

Definition at line 258 of file game_display.hpp.

Referenced by draw_hex(), and set_game_mode().

bool game_display::in_game_
private

Definition at line 254 of file game_display.hpp.

Referenced by begin_game(), and in_game().

bool game_display::needs_rebuild_
private

Definition at line 263 of file game_display.hpp.

Referenced by maybe_rebuild(), and needs_rebuild().

overlay_map game_display::overlay_map_
private

Definition at line 236 of file game_display.hpp.

Referenced by game_display().

pathfind::marked_route game_display::route_
private

Definition at line 244 of file game_display.hpp.

Referenced by draw_hex(), and draw_movement_info().

double game_display::sidebarScaling_
private

Definition at line 252 of file game_display.hpp.

const tod_manager* game_display::tod_manager_
private

The documentation for this class was generated from the following files: