The Battle for Wesnoth  1.19.0-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>


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 46 of file highlighter.cpp.

◆ ~highlighter()

wb::highlighter::~highlighter ( )

Definition at line 58 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 ( )

Definition at line 200 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 ( )

◆ get_bump_target()

action_ptr wb::highlighter::get_bump_target ( )

Definition at line 252 of file highlighter.cpp.

References selected_action_.

◆ get_delete_target()

action_ptr wb::highlighter::get_delete_target ( )

Definition at line 243 of file highlighter.cpp.

References selected_action_, and side_actions_.

◆ get_execute_target()

action_ptr wb::highlighter::get_execute_target ( )

Definition at line 235 of file highlighter.cpp.

References selected_action_, and side_actions_.

◆ get_main_highlight()

weak_action_ptr wb::highlighter::get_main_highlight ( )
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

Definition at line 46 of file highlighter.hpp.

References mouseover_hex_.

◆ get_secondary_highlights()

secondary_highlights_t wb::highlighter::get_secondary_highlights ( )
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 257 of file highlighter.cpp.

References owner_unit_, and selection_candidate_.

◆ get_unit_map()

unit_map & wb::highlighter::get_unit_map ( )

Definition at line 346 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)

◆ set_mouseover_hex()

void wb::highlighter::set_mouseover_hex ( const map_location hex)
"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 67 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)

Definition at line 62 of file highlighter.hpp.

References selection_candidate_.

◆ unhighlight()

void wb::highlighter::unhighlight ( )

Member Data Documentation

◆ exclusive_display_hexes_

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

◆ main_highlight_

weak_action_ptr wb::highlighter::main_highlight_

◆ mouseover_hex_

map_location wb::highlighter::mouseover_hex_

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_

◆ secondary_highlights_

secondary_highlights_t wb::highlighter::secondary_highlights_

◆ selected_action_

weak_action_ptr wb::highlighter::selected_action_

◆ selection_candidate_

unit_ptr wb::highlighter::selection_candidate_

◆ side_actions_

side_actions_ptr wb::highlighter::side_actions_

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: