#include <mouse_events.hpp>
Public Member Functions | |
mouse_handler (game_display *gui, play_controller &pc) | |
~mouse_handler () | |
void | set_side (int side_number) |
void | cycle_units (const bool browse, const bool reverse=false) |
void | cycle_back_units (const bool browse) |
int | get_path_turns () const |
map_location | current_unit_attacks_from (const map_location &loc) const |
const pathfind::paths & | current_paths () const |
const map_location & | get_last_hex () const |
map_location | get_selected_hex () const |
void | set_path_turns (const int path_turns) |
void | set_current_paths (const pathfind::paths &new_paths) |
void | deselect_hex () |
void | invalidate_reachmap () |
void | set_gui (game_display *gui) |
unit_map::iterator | selected_unit () |
pathfind::marked_route | get_route (const unit *un, map_location go_to, const team &team) const |
const pathfind::marked_route & | get_current_route () const |
std::set< map_location > | get_adj_enemies (const map_location &loc, int side) const |
int | show_attack_dialog (const map_location &attacker_loc, const map_location &defender_loc) |
void | attack_enemy (const map_location &attacker_loc, const map_location &defender_loc, int choice) |
std::size_t | move_unit_along_route (const std::vector< map_location > &steps, bool &interrupted) |
Moves a unit across the board for a player. More... | |
void | select_hex (const map_location &hex, const bool browse, const bool highlight=true, const bool fire_event=true) |
void | move_action (bool browse) override |
Overridden in derived class. More... | |
void | teleport_action () |
void | touch_action (const map_location hex, bool browse) override |
void | select_or_action (bool browse) |
void | select_teleport () |
const map_location | hovered_hex () const |
Uses SDL and game_display::hex_clicked_on to fetch the hex the mouse is hovering, if applicable. More... | |
bool | hex_hosts_unit (const map_location &hex) const |
Unit exists on the hex, no matter if friend or foe. More... | |
void | disable_units_highlight () |
Use this to disable hovering an unit from highlighting its movement range. More... | |
void | enable_units_highlight () |
When unit highlighting is disabled, call this when the mouse no longer hovers any unit to enable highlighting again. More... | |
Public Member Functions inherited from events::mouse_handler_base | |
mouse_handler_base () | |
virtual | ~mouse_handler_base () |
bool | dragging_started () const |
If mouse/finger has moved far enough to consider it move/swipe, and not a click/touch. More... | |
bool | is_dragging () const |
void | mouse_motion_event (const SDL_MouseMotionEvent &event, const bool browse) |
void | touch_motion_event (const SDL_TouchFingerEvent &event, const bool browse) |
void | mouse_update (const bool browse, map_location loc) |
Update the mouse with a fake mouse motion. More... | |
bool | get_show_menu () const |
bool | mouse_motion_default (int x, int y, bool update) |
This handles minimap scrolling and click-drag. More... | |
virtual void | mouse_press (const SDL_MouseButtonEvent &event, const bool browse) |
bool | is_left_click (const SDL_MouseButtonEvent &event) const |
bool | is_middle_click (const SDL_MouseButtonEvent &event) const |
bool | is_right_click (const SDL_MouseButtonEvent &event) const |
bool | is_touch_click (const SDL_MouseButtonEvent &event) const |
virtual void | mouse_wheel (int xscroll, int yscroll, bool browse) |
Called when scrolling with the mouse wheel. More... | |
virtual bool | allow_mouse_wheel_scroll (int, int) |
Derived classes can override this to disable mousewheel scrolling under some circumstances, e.g. More... | |
virtual bool | left_click (int x, int y, const bool browse) |
Overridden in derived classes, called on a left click (mousedown). More... | |
virtual void | left_drag_end (int, int, const bool) |
Called whenever the left mouse drag has "ended". More... | |
virtual void | left_mouse_up (int, int, const bool) |
Called when the left mouse button is up. More... | |
virtual bool | right_click (int x, int y, const bool browse) |
Overridden in derived classes, called on a right click (mousedown). More... | |
virtual void | right_drag_end (int, int, const bool) |
Called whenever the right mouse drag has "ended". More... | |
virtual void | right_mouse_up (int, int, const bool) |
Called when the right mouse button is up. More... | |
virtual void | mouse_wheel_up (int, int, const bool) |
Called when the mouse wheel is scrolled up. More... | |
virtual void | mouse_wheel_down (int, int, const bool) |
Called when the mouse wheel is scrolled down. More... | |
virtual void | mouse_wheel_left (int, int, const bool) |
Called when the mouse wheel is scrolled left. More... | |
virtual void | mouse_wheel_right (int, int, const bool) |
Called when the mouse wheel is scrolled right. More... | |
void | set_scroll_start (int x, int y) |
Called when the middle click scrolling. More... | |
const SDL_Point | get_scroll_start () const |
bool | scroll_started () const |
Static Public Member Functions | |
static mouse_handler * | get_singleton () |
Protected Member Functions | |
game_display & | gui () override |
Due to the way this class is constructed we can assume that the display* gui_ member actually points to a game_display (derived class) More... | |
const game_display & | gui () const override |
Const version. More... | |
int | drag_threshold () const override |
Minimum dragging distance to fire the drag&drop. More... | |
void | mouse_motion (int x, int y, const bool browse, bool update=false, map_location loc=map_location::null_location()) override |
Use update to force an update of the mouse state. More... | |
bool | mouse_button_event (const SDL_MouseButtonEvent &event, uint8_t button, map_location loc, bool click=false) override |
bool | right_click_show_menu (int x, int y, const bool browse) override |
Called in the default right_click when the context menu is about to be shown, can be used for preprocessing and preventing the menu from being displayed without rewriting the right click function. More... | |
bool | move_unit_along_current_route () |
Moves a unit along the currently cached route. More... | |
void | touch_motion (int x, int y, const bool browse, bool update=false, map_location loc=map_location::null_location()) override |
void | save_whiteboard_attack (const map_location &attacker_loc, const map_location &defender_loc, int weapon_choice) |
int | fill_weapon_choices (std::vector< battle_context > &bc_vector, unit_map::iterator attacker, unit_map::iterator defender) |
void | attack_enemy_ (const map_location &attacker_loc, const map_location &defender_loc, int choice) |
void | show_attack_options (const unit_map::const_iterator &u) |
Causes attackable hexes to be highlighted. More... | |
unit_map::const_iterator | find_unit (const map_location &hex) const |
unit_map::iterator | find_unit (const map_location &hex) |
unit * | find_unit_nonowning (const map_location &hex) |
const unit * | find_unit_nonowning (const map_location &hex) const |
bool | unit_in_cycle (unit_map::const_iterator it) |
Protected Member Functions inherited from events::mouse_handler_base | |
void | cancel_dragging () |
void | clear_dragging (const SDL_MouseButtonEvent &event, bool browse) |
void | clear_drag_from_hex () |
void | init_dragging (bool &dragging_flag) |
Private Member Functions | |
team & | current_team () |
void | show_reach_for_unit (const unit_ptr &un) |
Highlight the hexes that a unit can move to. More... | |
Private Attributes | |
game_display * | gui_ |
play_controller & | pc_ |
map_location | previous_hex_ |
map_location | previous_free_hex_ |
map_location | selected_hex_ |
map_location | next_unit_ |
pathfind::marked_route | current_route_ |
pathfind::paths | current_paths_ |
If non-empty, current_paths_.destinations contains a cache of highlighted hexes, likely the movement range or attack range of a unit. More... | |
bool | unselected_paths_ |
bool | unselected_reach_ |
int | path_turns_ |
int | side_num_ |
bool | over_route_ |
bool | reachmap_invalid_ |
bool | show_partial_move_ |
bool | teleport_selected_ |
bool | preventing_units_highlight_ |
Static Private Attributes | |
static mouse_handler * | singleton_ = nullptr |
Additional Inherited Members | |
Protected Attributes inherited from events::mouse_handler_base | |
bool | simple_warp_ |
MMB click (on game map) state flag. More... | |
bool | minimap_scrolling_ |
minimap scrolling (scroll-drag) state flag More... | |
bool | dragging_left_ |
LMB drag init flag. More... | |
bool | dragging_touch_ |
Finger drag init flag. More... | |
bool | dragging_started_ |
Actual drag flag. More... | |
bool | dragging_right_ |
RMB drag init flag. More... | |
int | drag_from_x_ |
Drag start position x. More... | |
int | drag_from_y_ |
Drag start position y. More... | |
map_location | drag_from_hex_ |
Drag start or mouse-down map location. More... | |
map_location | last_hex_ |
last highlighted hex More... | |
bool | show_menu_ |
Show context menu flag. More... | |
int | scroll_start_x_ |
Relative to middle click scrolling. More... | |
int | scroll_start_y_ |
bool | scroll_started_ |
Definition at line 36 of file mouse_events.hpp.
events::mouse_handler::mouse_handler | ( | game_display * | gui, |
play_controller & | pc | ||
) |
Definition at line 59 of file mouse_events.cpp.
References singleton_.
events::mouse_handler::~mouse_handler | ( | ) |
Definition at line 82 of file mouse_events.cpp.
References singleton_.
void events::mouse_handler::attack_enemy | ( | const map_location & | attacker_loc, |
const map_location & | defender_loc, | ||
int | choice | ||
) |
Definition at line 1372 of file mouse_events.cpp.
References attack_enemy_(), ERR_WML, and lg::log_to_chat().
Referenced by wb::attack::execute(), and move_action().
|
protected |
Definition at line 1382 of file mouse_events.cpp.
References battle_context_unit_stats::attack_num, game_display::clear_attack_indicator(), current_paths_, current_team(), game_display::display_unit_hex(), fill_weapon_choices(), find_unit(), replay_helper::get_attack(), tod_manager::get_time_of_day(), play_controller::get_tod_manager(), gui(), game_display::highlight_hex(), battle_context_unit_stats::level, pc_, synced_context::run_and_throw(), game_display::select_hex(), team::set_action_bonus_count(), unit::set_goto(), side_num_, tod_manager::turn(), unit::type_id(), and game_display::unhighlight_reach().
Referenced by attack_enemy().
|
inline |
Definition at line 52 of file mouse_events.hpp.
References current_paths_.
Referenced by play_controller::process_keyup_event().
|
private |
Definition at line 1583 of file mouse_events.cpp.
References play_controller::get_teams(), pc_, and side_num_.
Referenced by attack_enemy_(), show_attack_options(), show_reach_for_unit(), and unit_in_cycle().
map_location events::mouse_handler::current_unit_attacks_from | ( | const map_location & | loc | ) | const |
loc | the location occupied by the enemy |
Definition at line 689 of file mouse_events.cpp.
References pathfind::paths::dest_vect::contains(), current_paths_, play_controller::current_side(), pathfind::paths::destinations, find_unit(), get_adjacent_tiles(), play_controller::get_map(), map_location::get_relative_dir(), play_controller::get_whiteboard(), gui(), gui_, team::is_enemy(), n, map_location::NDIRECTIONS, gamemap_base::on_board(), pc_, previous_free_hex_, previous_hex_, selected_hex_, team::side(), map_location::valid(), unit_map::iterator_base< iter_types >::valid(), and display::viewing_team().
Referenced by mouse_motion(), move_action(), and touch_motion().
|
inline |
Definition at line 43 of file mouse_events.hpp.
References cycle_units().
Referenced by play_controller::hotkey_handler::cycle_back_units().
void events::mouse_handler::cycle_units | ( | const bool | browse, |
const bool | reverse = false |
||
) |
Definition at line 1532 of file mouse_events.cpp.
References unit_map::begin(), unit_map::end(), find_unit(), play_controller::get_units(), gui(), next_unit_, pc_, display::scroll_to_tile(), select_hex(), unit_in_cycle(), and display::WARP.
Referenced by cycle_back_units(), play_controller::hotkey_handler::cycle_units(), events::menu_handler::end_unit_turn(), and events::menu_handler::unit_hold_position().
void events::mouse_handler::deselect_hex | ( | ) |
Definition at line 1187 of file mouse_events.cpp.
References select_hex().
Referenced by play_controller::hotkey_handler::deselect_hex(), events::menu_handler::end_unit_turn(), play_controller::finish_side_turn_events(), events::menu_handler::move_unit_to_loc(), play_controller::redo(), teleport_action(), touch_action(), and play_controller::undo().
void events::mouse_handler::disable_units_highlight | ( | ) |
Use this to disable hovering an unit from highlighting its movement range.
Definition at line 1590 of file mouse_events.cpp.
References preventing_units_highlight_.
Referenced by events::menu_handler::show_enemy_moves().
|
overrideprotectedvirtual |
Minimum dragging distance to fire the drag&drop.
Reimplemented from events::mouse_handler_base.
Definition at line 92 of file mouse_events.cpp.
References gui2::settings::screen_height, and gui2::settings::screen_width.
Referenced by touch_motion().
void events::mouse_handler::enable_units_highlight | ( | ) |
When unit highlighting is disabled, call this when the mouse no longer hovers any unit to enable highlighting again.
Definition at line 1595 of file mouse_events.cpp.
References preventing_units_highlight_.
Referenced by mouse_motion().
|
protected |
Definition at line 1316 of file mouse_events.cpp.
References battle_context::better_attack(), battle_context_unit_stats::disable, battle_context::get_attacker_stats(), play_controller::get_units(), i, pc_, and utf8::size().
Referenced by attack_enemy_(), and show_attack_dialog().
|
protected |
Definition at line 649 of file mouse_events.cpp.
References game_state::board_, unit_map::end(), game_board::find_visible_unit(), play_controller::gamestate(), play_controller::get_units(), gui(), pc_, and unit_map::iterator_base< iter_types >::valid().
|
protected |
Definition at line 659 of file mouse_events.cpp.
References game_state::board_, game_board::find_visible_unit(), play_controller::gamestate(), gui(), and pc_.
Referenced by attack_enemy_(), current_unit_attacks_from(), cycle_units(), get_adj_enemies(), hex_hosts_unit(), mouse_motion(), select_hex(), select_or_action(), select_teleport(), selected_unit(), touch_action(), and touch_motion().
|
protected |
Definition at line 664 of file mouse_events.cpp.
References game_state::board_, game_board::find_visible_unit(), play_controller::gamestate(), gui(), pc_, and unit_map::iterator_base< iter_types >::valid().
Referenced by move_action().
|
protected |
Definition at line 670 of file mouse_events.cpp.
References game_state::board_, game_board::find_visible_unit(), play_controller::gamestate(), gui(), pc_, and unit_map::iterator_base< iter_types >::valid().
std::set< map_location > events::mouse_handler::get_adj_enemies | ( | const map_location & | loc, |
int | side | ||
) | const |
Definition at line 1453 of file mouse_events.cpp.
References find_unit(), get_adjacent_tiles(), play_controller::get_teams(), i, team::is_enemy(), and pc_.
|
inline |
Definition at line 67 of file mouse_events.hpp.
References current_route_.
Referenced by wb::manager::create_temp_move().
|
inline |
Definition at line 54 of file mouse_events.hpp.
References events::mouse_handler_base::last_hex_.
Referenced by playsingle_controller::hotkey_handler::can_execute_command(), play_controller::hotkey_handler::can_execute_command(), events::menu_handler::change_side(), events::menu_handler::create_unit(), events::menu_handler::current_unit(), events::console_handler::do_create(), play_controller::hotkey_handler::do_execute_command(), events::console_handler::do_layers(), events::console_handler::do_terrain(), play_controller::hotkey_handler::expand_wml_commands(), play_controller::hotkey_handler::in_context_menu(), events::menu_handler::kill_unit(), events::menu_handler::label_terrain(), playsingle_controller::hotkey_handler::recall(), playsingle_controller::hotkey_handler::recruit(), playsingle_controller::hotkey_handler::repeat_recruit(), and events::menu_handler::terrain_description().
|
inline |
Definition at line 45 of file mouse_events.hpp.
References path_turns_.
Referenced by play_controller::process_keyup_event().
pathfind::marked_route events::mouse_handler::get_route | ( | const unit * | un, |
map_location | go_to, | ||
const team & | team | ||
) | const |
Definition at line 798 of file mouse_events.cpp.
References pathfind::a_star_search(), game_state::board_, play_controller::gamestate(), unit::get_location(), pathfind::get_teleport_locations(), gui(), gamemap_base::h(), game_board::map(), pathfind::mark_route(), pc_, game_board::teams(), and gamemap_base::w().
Referenced by events::menu_handler::execute_gotos(), mouse_motion(), events::menu_handler::move_unit_to_loc(), show_reach_for_unit(), and touch_motion().
|
inline |
Definition at line 55 of file mouse_events.hpp.
References selected_hex_.
Referenced by playsingle_controller::hotkey_handler::can_execute_command(), events::menu_handler::continue_move(), events::menu_handler::current_unit(), events::menu_handler::end_unit_turn(), wb::manager::on_mouseover_change(), play_controller::process_keyup_event(), and events::menu_handler::unit_hold_position().
|
inlinestatic |
Definition at line 40 of file mouse_events.hpp.
References singleton_.
Referenced by unit_display::unit_mover::finish(), and unit_display::unit_die().
|
inlineoverrideprotectedvirtual |
Const version.
Implements events::mouse_handler_base.
Definition at line 125 of file mouse_events.hpp.
References gui_.
|
inlineoverrideprotectedvirtual |
Due to the way this class is constructed we can assume that the display* gui_ member actually points to a game_display (derived class)
Implements events::mouse_handler_base.
Definition at line 123 of file mouse_events.hpp.
References gui_.
Referenced by attack_enemy_(), current_unit_attacks_from(), cycle_units(), find_unit(), find_unit_nonowning(), get_route(), mouse_button_event(), mouse_motion(), move_action(), move_unit_along_current_route(), move_unit_along_route(), right_click_show_menu(), save_whiteboard_attack(), select_hex(), select_teleport(), set_current_paths(), set_gui(), show_reach_for_unit(), teleport_action(), touch_motion(), and unit_in_cycle().
bool events::mouse_handler::hex_hosts_unit | ( | const map_location & | hex | ) | const |
Unit exists on the hex, no matter if friend or foe.
Definition at line 684 of file mouse_events.cpp.
References find_unit(), and unit_map::iterator_base< iter_types >::valid().
Referenced by events::menu_handler::show_enemy_moves().
const map_location events::mouse_handler::hovered_hex | ( | ) | const |
Uses SDL and game_display::hex_clicked_on to fetch the hex the mouse is hovering, if applicable.
Definition at line 676 of file mouse_events.cpp.
References sdl::get_mouse_state(), gui_, and display::hex_clicked_on().
Referenced by events::menu_handler::show_enemy_moves().
|
inline |
Definition at line 59 of file mouse_events.hpp.
References reachmap_invalid_.
|
overrideprotectedvirtual |
Reimplemented from events::mouse_handler_base.
Definition at line 605 of file mouse_events.cpp.
References tooltips::click(), events::mouse_handler_base::drag_from_hex_, play_controller::gamestate(), gui(), game_state::lua_kernel_, and pc_.
|
overrideprotectedvirtual |
Use update to force an update of the mouse state.
Implements events::mouse_handler_base.
Definition at line 390 of file mouse_events.cpp.
References cursor::ATTACK, cursor::ATTACK_DRAG, game_display::clear_attack_indicator(), pathfind::paths::dest_vect::contains(), current_paths_, current_route_, current_unit_attacks_from(), pathfind::paths::destinations, events::mouse_handler_base::dragging_started_, enable_units_highlight(), find_unit(), play_controller::gamestate(), cursor::get(), play_controller::get_map(), sdl::get_mouse_state(), get_route(), unit_map::iterator_base< iter_types >::get_shared_ptr(), play_controller::get_whiteboard(), gui(), display::hex_clicked_on(), game_display::highlight_hex(), events::mouse_handler_base::last_hex_, game_state::lua_kernel_, events::mouse_handler_base::mouse_motion_default(), cursor::MOVE, cursor::MOVE_DRAG, cursor::NORMAL, map_location::null_location(), gamemap_base::on_board(), over_route_, pc_, preventing_units_highlight_, previous_free_hex_, previous_hex_, reachmap_invalid_, events::mouse_handler_base::scroll_started_, select_hex(), selected_hex_, selected_unit(), cursor::set(), game_display::set_attack_indicator(), game_display::set_route(), show_partial_move_, show_reach_for_unit(), side_num_, pathfind::marked_route::steps, game_display::unhighlight_reach(), unselected_paths_, draw_manager::update(), map_location::valid(), unit_map::iterator_base< iter_types >::valid(), and cursor::WAIT.
|
overridevirtual |
Overridden in derived class.
Called on drag + drop movements.
Reimplemented from events::mouse_handler_base.
Definition at line 893 of file mouse_events.cpp.
References attack_enemy(), game_display::clear_attack_indicator(), events::commands_disabled, current_paths_, current_route_, current_unit_attacks_from(), pathfind::paths::destinations, pathfind::paths::dest_vect::find(), find_unit_nonowning(), unit::get_location(), play_controller::get_units(), play_controller::get_whiteboard(), gui(), events::mouse_handler_base::last_hex_, move_unit_along_current_route(), pc_, save_whiteboard_attack(), select_hex(), game_display::select_hex(), selected_hex_, unit::set_goto(), game_display::set_route(), show_attack_dialog(), show_partial_move_, unit::side(), side_num_, src, pathfind::marked_route::steps, teleport_action(), teleport_selected_, game_display::unhighlight_reach(), and map_location::valid().
Referenced by play_controller::hotkey_handler::move_action(), and select_or_action().
|
protected |
Moves a unit along the currently cached route.
Definition at line 1199 of file mouse_events.cpp.
References current_paths_, current_route_, gui(), move_unit_along_route(), next_unit_, game_display::select_hex(), selected_hex_, game_display::set_route(), pathfind::marked_route::steps, and game_display::unhighlight_reach().
Referenced by move_action().
std::size_t events::mouse_handler::move_unit_along_route | ( | const std::vector< map_location > & | steps, |
bool & | interrupted | ||
) |
Moves a unit across the board for a player.
This is specifically for movement at the time it is initiated by a player, whether via a mouse click or executing whiteboard actions. Continued moves (including goto execution) can bypass this and call actions::move_unit() directly. This function call may include time for an animation, so make sure the provided route will remain unchanged (the caller should probably make a local copy).
[in] | steps | The route to be traveled. The unit to be moved is at the beginning of this route. |
[out] | interrupted | This is set to true if information was uncovered that warrants interrupting a chain of actions (and set to false otherwise). |
Definition at line 1245 of file mouse_events.cpp.
References _(), unit_map::find(), play_controller::get_map(), play_controller::get_undo_stack(), play_controller::get_units(), play_controller::get_whiteboard(), gui(), display::invalidate_game_status(), gamemap::is_keep(), LOG_NG, actions::move_unit_and_record(), cursor::NORMAL, pc_, select_hex(), cursor::set(), show_partial_move_, and gui2::show_transient_message().
Referenced by wb::move::execute(), and move_unit_along_current_route().
|
overrideprotectedvirtual |
Called in the default right_click when the context menu is about to be shown, can be used for preprocessing and preventing the menu from being displayed without rewriting the right click function.
Reimplemented from events::mouse_handler_base.
Definition at line 815 of file mouse_events.cpp.
References rect::contains(), gui(), display::map_area(), selected_hex_, unselected_reach_, and map_location::valid().
|
protected |
Definition at line 1287 of file mouse_events.cpp.
References game_display::clear_attack_indicator(), current_paths_, current_route_, play_controller::get_whiteboard(), gui(), pc_, game_display::select_hex(), selected_hex_, game_display::set_route(), show_partial_move_, pathfind::marked_route::steps, and game_display::unhighlight_reach().
Referenced by move_action().
void events::mouse_handler::select_hex | ( | const map_location & | hex, |
const bool | browse, | ||
const bool | highlight = true , |
||
const bool | fire_event = true |
||
) |
Definition at line 1099 of file mouse_events.cpp.
References unit::anim_comp(), unit_map::begin(), game_display::clear_attack_indicator(), events::commands_disabled, current_paths_, current_route_, pathfind::paths::destinations, unit_map::end(), unit_map::find(), find_unit(), game_events::wml_event_pump::fire(), gui2::event::implementation::fire_event(), display::fogged(), unit::get_hidden(), unit::get_location(), play_controller::get_units(), play_controller::get_whiteboard(), gui(), gui_, game_display::highlight_another_reach(), game_display::highlight_reach(), pathfind::paths::dest_vect::insert(), events::mouse_handler_base::last_hex_, next_unit_, game_config::path, path_turns_, pc_, sound::play_UI_sound(), play_controller::pump(), game_display::select_hex(), selected_hex_, game_display::set_route(), unit_animation_component::set_selecting(), show_attack_options(), show_partial_move_, unit::side(), pathfind::marked_route::steps, game_display::unhighlight_reach(), unselected_paths_, unselected_reach_, and map_location::valid().
Referenced by cycle_units(), deselect_hex(), game_lua_kernel::intf_select_unit(), mouse_motion(), move_action(), move_unit_along_route(), play_controller::process_keyup_event(), play_controller::hotkey_handler::select_hex(), select_or_action(), teleport_action(), and touch_motion().
void events::mouse_handler::select_or_action | ( | bool | browse | ) |
Definition at line 866 of file mouse_events.cpp.
References tooltips::click(), events::mouse_handler_base::drag_from_x_, events::mouse_handler_base::drag_from_y_, find_unit(), play_controller::gamestate(), play_controller::get_map(), events::mouse_handler_base::last_hex_, game_state::lua_kernel_, move_action(), gamemap_base::on_board(), pc_, select_hex(), selected_hex_, side_num_, and teleport_selected_.
Referenced by play_controller::hotkey_handler::select_and_action(), and touch_action().
void events::mouse_handler::select_teleport | ( | ) |
Definition at line 825 of file mouse_events.cpp.
References find_unit(), play_controller::gamestate(), gui(), events::mouse_handler_base::last_hex_, game_state::lua_kernel_, pc_, game_display::select_hex(), selected_hex_, game_display::set_route(), side_num_, and teleport_selected_.
Referenced by playsingle_controller::hotkey_handler::select_teleport().
unit_map::iterator events::mouse_handler::selected_unit | ( | ) |
Definition at line 639 of file mouse_events.cpp.
References find_unit(), events::mouse_handler_base::last_hex_, and selected_hex_.
Referenced by mouse_motion(), play_controller::process_keyup_event(), and touch_motion().
void events::mouse_handler::set_current_paths | ( | const pathfind::paths & | new_paths | ) |
Definition at line 1571 of file mouse_events.cpp.
References current_paths_, current_route_, play_controller::get_whiteboard(), gui(), pc_, game_display::set_route(), pathfind::marked_route::steps, and game_display::unhighlight_reach().
Referenced by events::menu_handler::end_unit_turn(), play_controller::process_keyup_event(), and events::menu_handler::unit_hold_position().
|
inline |
Definition at line 61 of file mouse_events.hpp.
Referenced by play_controller::init().
|
inline |
Definition at line 56 of file mouse_events.hpp.
References path_turns_.
Referenced by play_controller::process_keyup_event().
void events::mouse_handler::set_side | ( | int | side_number | ) |
Definition at line 87 of file mouse_events.cpp.
References side_num_.
Referenced by play_controller::init_side_begin().
int events::mouse_handler::show_attack_dialog | ( | const map_location & | attacker_loc, |
const map_location & | defender_loc | ||
) |
Definition at line 1342 of file mouse_events.cpp.
References _(), game_state::board_, ERR_NG, fill_weapon_choices(), unit_map::find(), play_controller::gamestate(), gui2::dialogs::unit_attack::get_selected_weapon(), pc_, gui2::dialogs::modal_dialog::show(), gui2::show_transient_message(), and game_board::units().
Referenced by move_action().
|
protected |
Causes attackable hexes to be highlighted.
This checks the hexes that the provided unit can attack. If there is a valid target there, that location is inserted into current_paths_.destinations.
Definition at line 1476 of file mouse_events.cpp.
References current_paths_, current_team(), pathfind::paths::destinations, unit_map::find(), get_adjacent_tiles(), play_controller::get_map(), play_controller::get_teams(), play_controller::get_units(), i, unit::incapacitated(), pathfind::paths::dest_vect::insert(), team::is_enemy(), gamemap_base::on_board(), pc_, and unit::side().
Referenced by select_hex().
|
private |
Highlight the hexes that a unit can move to.
Based on the currently selected hex, selected unit and what's being moused-over, conditionally draw any planned moves for the unit passed as an argument.
Definition at line 345 of file mouse_events.cpp.
References current_paths_, current_team(), pathfind::paths::destinations, play_controller::get_map(), get_route(), play_controller::get_teams(), gui(), game_display::highlight_reach(), gamemap_base::on_board(), over_route_, path_turns_, pc_, selected_hex_, game_display::set_route(), side_num_, unselected_paths_, and map_location::valid().
Referenced by mouse_motion().
void events::mouse_handler::teleport_action | ( | ) |
Definition at line 847 of file mouse_events.cpp.
References game_display::clear_attack_indicator(), current_route_, deselect_hex(), gui(), display::invalidate_all(), display::invalidate_game_status(), events::mouse_handler_base::last_hex_, cursor::NORMAL, select_hex(), selected_hex_, cursor::set(), game_display::set_route(), pathfind::marked_route::steps, teleport_selected_, and actions::teleport_unit_and_record().
Referenced by move_action().
|
overridevirtual |
Reimplemented from events::mouse_handler_base.
Definition at line 1088 of file mouse_events.cpp.
References deselect_hex(), find_unit(), unit::get_hidden(), select_or_action(), and map_location::valid().
Referenced by play_controller::hotkey_handler::touch_hex().
|
overrideprotectedvirtual |
Implements events::mouse_handler_base.
Definition at line 102 of file mouse_events.cpp.
References cursor::ATTACK, cursor::ATTACK_DRAG, game_state::board_, game_display::clear_attack_indicator(), utils::contains(), pathfind::paths::dest_vect::contains(), current_paths_, current_route_, current_unit_attacks_from(), pathfind::paths::destinations, events::mouse_handler_base::drag_from_x_, events::mouse_handler_base::drag_from_y_, drag_threshold(), events::mouse_handler_base::dragging_started_, events::mouse_handler_base::dragging_touch_, find_unit(), play_controller::gamestate(), cursor::get(), play_controller::get_map(), sdl::get_mouse_state(), get_route(), unit_map::iterator_base< iter_types >::get_shared_ptr(), play_controller::get_whiteboard(), gui(), display::hex_clicked_on(), game_display::highlight_hex(), events::mouse_handler_base::is_dragging(), events::mouse_handler_base::last_hex_, game_board::map(), display::minimap_location_on(), events::mouse_handler_base::minimap_scrolling_, cursor::MOVE, cursor::MOVE_DRAG, cursor::NORMAL, map_location::null_location(), gamemap_base::on_board(), over_route_, pc_, previous_free_hex_, previous_hex_, tooltips::process(), reachmap_invalid_, display::scroll(), display::scroll_to_tile(), select_hex(), selected_hex_, selected_unit(), cursor::set(), game_display::set_attack_indicator(), game_display::set_route(), show_partial_move_, side_num_, events::mouse_handler_base::simple_warp_, pathfind::marked_route::steps, game_display::unhighlight_reach(), unselected_paths_, draw_manager::update(), map_location::valid(), unit_map::iterator_base< iter_types >::valid(), cursor::WAIT, and display::WARP.
|
protected |
Definition at line 1509 of file mouse_events.cpp.
References game_state::board_, current_team(), play_controller::gamestate(), gui(), pc_, side_num_, and display_context::unit_can_move().
Referenced by cycle_units().
|
private |
If non-empty, current_paths_.destinations contains a cache of highlighted hexes, likely the movement range or attack range of a unit.
Definition at line 186 of file mouse_events.hpp.
Referenced by attack_enemy_(), current_paths(), current_unit_attacks_from(), mouse_motion(), move_action(), move_unit_along_current_route(), save_whiteboard_attack(), select_hex(), set_current_paths(), show_attack_options(), show_reach_for_unit(), and touch_motion().
|
private |
Definition at line 181 of file mouse_events.hpp.
Referenced by get_current_route(), mouse_motion(), move_action(), move_unit_along_current_route(), save_whiteboard_attack(), select_hex(), set_current_paths(), teleport_action(), and touch_motion().
|
private |
Definition at line 172 of file mouse_events.hpp.
Referenced by current_unit_attacks_from(), gui(), hovered_hex(), select_hex(), and set_gui().
|
private |
Definition at line 180 of file mouse_events.hpp.
Referenced by cycle_units(), move_unit_along_current_route(), and select_hex().
|
private |
Definition at line 192 of file mouse_events.hpp.
Referenced by mouse_motion(), show_reach_for_unit(), and touch_motion().
|
private |
Definition at line 189 of file mouse_events.hpp.
Referenced by get_path_turns(), select_hex(), set_path_turns(), and show_reach_for_unit().
|
private |
Definition at line 173 of file mouse_events.hpp.
Referenced by attack_enemy_(), current_team(), current_unit_attacks_from(), cycle_units(), events::console_handler::do_create(), events::console_handler::do_layers(), events::console_handler::do_terrain(), fill_weapon_choices(), find_unit(), find_unit_nonowning(), get_adj_enemies(), get_route(), mouse_button_event(), mouse_motion(), move_action(), move_unit_along_route(), save_whiteboard_attack(), select_hex(), select_or_action(), select_teleport(), set_current_paths(), show_attack_dialog(), show_attack_options(), show_reach_for_unit(), touch_motion(), and unit_in_cycle().
|
private |
Definition at line 199 of file mouse_events.hpp.
Referenced by disable_units_highlight(), enable_units_highlight(), and mouse_motion().
|
private |
Definition at line 178 of file mouse_events.hpp.
Referenced by current_unit_attacks_from(), mouse_motion(), and touch_motion().
|
private |
Definition at line 177 of file mouse_events.hpp.
Referenced by current_unit_attacks_from(), mouse_motion(), and touch_motion().
|
private |
Definition at line 193 of file mouse_events.hpp.
Referenced by invalidate_reachmap(), mouse_motion(), and touch_motion().
|
private |
Definition at line 179 of file mouse_events.hpp.
Referenced by current_unit_attacks_from(), get_selected_hex(), mouse_motion(), move_action(), move_unit_along_current_route(), right_click_show_menu(), save_whiteboard_attack(), select_hex(), select_or_action(), select_teleport(), selected_unit(), show_reach_for_unit(), teleport_action(), and touch_motion().
|
private |
Definition at line 194 of file mouse_events.hpp.
Referenced by mouse_motion(), move_action(), move_unit_along_route(), save_whiteboard_attack(), select_hex(), and touch_motion().
|
private |
Definition at line 190 of file mouse_events.hpp.
Referenced by attack_enemy_(), current_team(), mouse_motion(), move_action(), select_or_action(), select_teleport(), set_side(), show_reach_for_unit(), touch_motion(), and unit_in_cycle().
|
staticprivate |
Definition at line 197 of file mouse_events.hpp.
Referenced by get_singleton(), mouse_handler(), and ~mouse_handler().
|
private |
Definition at line 195 of file mouse_events.hpp.
Referenced by move_action(), select_or_action(), select_teleport(), and teleport_action().
|
private |
Definition at line 187 of file mouse_events.hpp.
Referenced by mouse_motion(), select_hex(), show_reach_for_unit(), and touch_motion().
|
private |
Definition at line 188 of file mouse_events.hpp.
Referenced by right_click_show_menu(), and select_hex().