The Battle for Wesnoth  1.19.5+dev
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_ptrsecondary_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 38 of file highlighter.hpp.

Member Typedef Documentation

◆ secondary_highlights_t

Definition at line 58 of file highlighter.hpp.

Constructor & Destructor Documentation

◆ highlighter()

wb::highlighter::highlighter ( side_actions_ptr  side_actions)

Definition at line 47 of file highlighter.cpp.

◆ ~highlighter()

wb::highlighter::~highlighter ( )
virtual

Definition at line 59 of file highlighter.cpp.

References game_display::get_singleton(), owner_unit_, and unhighlight().

Member Function Documentation

◆ clear()

void wb::highlighter::clear ( )

◆ find_main_highlight()

void wb::highlighter::find_main_highlight ( )
private

Definition at line 201 of file highlighter.cpp.

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

Referenced by highlight().

◆ find_secondary_highlights()

void wb::highlighter::find_secondary_highlights ( )
private

◆ get_bump_target()

action_ptr wb::highlighter::get_bump_target ( )

Definition at line 253 of file highlighter.cpp.

References selected_action_.

◆ get_delete_target()

action_ptr wb::highlighter::get_delete_target ( )

Definition at line 244 of file highlighter.cpp.

References selected_action_, and side_actions_.

◆ get_execute_target()

action_ptr wb::highlighter::get_execute_target ( )

Definition at line 236 of file highlighter.cpp.

References selected_action_, and side_actions_.

◆ get_main_highlight()

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_.

◆ get_mouseover_hex()

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

Definition at line 46 of file highlighter.hpp.

References mouseover_hex_.

◆ get_secondary_highlights()

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_.

◆ get_selection_target()

unit_ptr wb::highlighter::get_selection_target ( )

Definition at line 258 of file highlighter.cpp.

References owner_unit_, and selection_candidate_.

◆ get_unit_map()

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

Definition at line 347 of file highlighter.cpp.

References resources::gameboard, and game_board::units().

Referenced by set_mouseover_hex().

◆ highlight()

void wb::highlighter::highlight ( )

◆ last_action_redraw()

void wb::highlighter::last_action_redraw ( move_ptr  move)
private

◆ set_mouseover_hex()

void wb::highlighter::set_mouseover_hex ( const map_location hex)
Todo:
"is_numbering_hex" is not the "correct" criterion by which to select the highlighted/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 68 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_, utils::reversed_view(), selected_action_, selection_candidate_, side_actions_, and map_location::valid().

◆ set_selection_candidate()

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

Definition at line 62 of file highlighter.hpp.

References selection_candidate_.

◆ unhighlight()

void wb::highlighter::unhighlight ( )
private

Member Data Documentation

◆ exclusive_display_hexes_

std::set<map_location> wb::highlighter::exclusive_display_hexes_
private

◆ main_highlight_

weak_action_ptr wb::highlighter::main_highlight_
private

◆ mouseover_hex_

map_location wb::highlighter::mouseover_hex_
private

Definition at line 82 of file highlighter.hpp.

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

◆ owner_unit_

unit_ptr wb::highlighter::owner_unit_
private

◆ secondary_highlights_

secondary_highlights_t wb::highlighter::secondary_highlights_
private

◆ selected_action_

weak_action_ptr wb::highlighter::selected_action_
private

◆ selection_candidate_

unit_ptr wb::highlighter::selection_candidate_
private

◆ side_actions_

side_actions_ptr wb::highlighter::side_actions_
private

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