The Battle for Wesnoth  1.13.10+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 ()
 
void set_selection_candidate (unit_ptr candidate)
 

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 37 of file highlighter.hpp.

Member Typedef Documentation

Definition at line 57 of file highlighter.hpp.

Constructor & Destructor Documentation

wb::highlighter::highlighter ( side_actions_ptr  side_actions)

Definition at line 52 of file highlighter.cpp.

wb::highlighter::~highlighter ( )
virtual

Definition at line 64 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 221 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 273 of file highlighter.cpp.

References selected_action_.

action_ptr wb::highlighter::get_delete_target ( )

Definition at line 264 of file highlighter.cpp.

References selected_action_, and side_actions_.

action_ptr wb::highlighter::get_execute_target ( )

Definition at line 256 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 56 of file highlighter.hpp.

References main_highlight_.

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

Definition at line 45 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 59 of file highlighter.hpp.

References secondary_highlights_.

unit_ptr wb::highlighter::get_selection_target ( )

Definition at line 278 of file highlighter.cpp.

References owner_unit_, and selection_candidate_.

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

Definition at line 367 of file highlighter.cpp.

References resources::gameboard, and game_board::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 73 of file highlighter.cpp.

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

void wb::highlighter::set_selection_candidate ( unit_ptr  candidate)
inline

Definition at line 61 of file highlighter.hpp.

References selection_candidate_.

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 81 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
side_actions_ptr wb::highlighter::side_actions_
private

Definition at line 90 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: