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

Class that handles highlighting planned actions as you hover over them and determine the right target for contextual execution. More...

#include <highlighter.hpp>

Classes

class  highlight_main_visitor
 
class  highlight_secondary_visitor
 
class  unhighlight_visitor
 

Public Types

typedef std::deque
< weak_action_ptr
secondary_highlights_t
 

Public Member Functions

 highlighter (side_actions_ptr side_actions)
 
virtual ~highlighter ()
 
void set_mouseover_hex (const map_location &hex)
 
const map_locationget_mouseover_hex () const
 
void highlight ()
 
void clear ()
 
action_ptr get_execute_target ()
 
action_ptr get_delete_target ()
 
action_ptr get_bump_target ()
 
unit_ptr get_selection_target ()
 
weak_action_ptr get_main_highlight ()
 
secondary_highlights_t get_secondary_highlights ()
 

Private Member Functions

unit_mapget_unit_map ()
 
void unhighlight ()
 
void find_main_highlight ()
 
void find_secondary_highlights ()
 
void last_action_redraw (move_ptr)
 Redraw the given move action when needed. More...
 

Private Attributes

map_location mouseover_hex_
 
std::set< map_locationexclusive_display_hexes_
 
unit_ptr owner_unit_
 
unit_ptr selection_candidate_
 
weak_action_ptr selected_action_
 
weak_action_ptr main_highlight_
 
secondary_highlights_t secondary_highlights_
 
side_actions_ptr side_actions_
 

Detailed Description

Class that handles highlighting planned actions as you hover over them and determine the right target for contextual execution.

Definition at line 38 of file highlighter.hpp.

Member Typedef Documentation

Definition at line 58 of file highlighter.hpp.

Constructor & Destructor Documentation

wb::highlighter::highlighter ( side_actions_ptr  side_actions)

Definition at line 53 of file highlighter.cpp.

wb::highlighter::~highlighter ( )
virtual

Definition at line 65 of file highlighter.cpp.

References owner_unit_, resources::screen, and unhighlight().

Member Function Documentation

void wb::highlighter::clear ( )
void wb::highlighter::find_main_highlight ( )
private

Definition at line 206 of file highlighter.cpp.

References wb::find_action_at(), main(), main_highlight_, mouseover_hex_, and owner_unit_.

Referenced by highlight().

void wb::highlighter::find_secondary_highlights ( )
private
action_ptr wb::highlighter::get_bump_target ( )

Definition at line 258 of file highlighter.cpp.

References selected_action_.

action_ptr wb::highlighter::get_delete_target ( )

Definition at line 249 of file highlighter.cpp.

References selected_action_, and side_actions_.

action_ptr wb::highlighter::get_execute_target ( )

Definition at line 241 of file highlighter.cpp.

References selected_action_, and side_actions_.

weak_action_ptr wb::highlighter::get_main_highlight ( )
inline
Returns
the action that currently receives the highlight focus

Definition at line 57 of file highlighter.hpp.

References main_highlight_.

const map_location& wb::highlighter::get_mouseover_hex ( ) const
inline

Definition at line 46 of file highlighter.hpp.

References mouseover_hex_.

secondary_highlights_t wb::highlighter::get_secondary_highlights ( )
inline
Returns
the collection of actions that are highlighted but don't have the focus

Definition at line 60 of file highlighter.hpp.

References secondary_highlights_.

unit_ptr wb::highlighter::get_selection_target ( )

Definition at line 263 of file highlighter.cpp.

References owner_unit_, and selection_candidate_.

unit_map & wb::highlighter::get_unit_map ( )
private

Definition at line 352 of file highlighter.cpp.

References resources::units.

Referenced by set_mouseover_hex().

void wb::highlighter::highlight ( )
void wb::highlighter::last_action_redraw ( move_ptr  move)
private
void wb::highlighter::set_mouseover_hex ( const map_location hex)
Todo:
"is_numbering_hex" is not the "correct" criterion by which to select the hightlighted/selected action. It's just convenient for me to use at the moment since it happens to coincide with the "correct" criterion, which is to use find_main_highlight.

Definition at line 74 of file highlighter.cpp.

References schema_validation::at(), clear(), unit_map::find(), unit_map::iterator_base< iter_types >::get_shared_ptr(), get_unit_map(), itor, mouseover_hex_, owner_unit_, selected_action_, selection_candidate_, side_actions_, resources::teams, and map_location::valid().

void wb::highlighter::unhighlight ( )
private

Member Data Documentation

std::set<map_location> wb::highlighter::exclusive_display_hexes_
private
weak_action_ptr wb::highlighter::main_highlight_
private
map_location wb::highlighter::mouseover_hex_
private

Definition at line 80 of file highlighter.hpp.

Referenced by find_main_highlight(), get_mouseover_hex(), and set_mouseover_hex().

unit_ptr wb::highlighter::owner_unit_
private
secondary_highlights_t wb::highlighter::secondary_highlights_
private
weak_action_ptr wb::highlighter::selected_action_
private
unit_ptr wb::highlighter::selection_candidate_
private

Definition at line 83 of file highlighter.hpp.

Referenced by get_selection_target(), and set_mouseover_hex().

side_actions_ptr wb::highlighter::side_actions_
private

Definition at line 89 of file highlighter.hpp.

Referenced by get_delete_target(), get_execute_target(), and set_mouseover_hex().


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