Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Usability improvement, mouse interaction.
When the game is cluttered with units from any side, the probability of 'landing' the mouse cursor on top of a unit after activating the 'show [best possible] enemy moves' facility (via mouse) increases drastically. In that scenario, the slightest mouse move rewinded back enemy units movements highlight. After this rev, if the cursor lands on a unit, an object field gets toggled and it prevents normal single unit movements highlight until mouse stops hovering units. Then it gets switched back to normal interaction. Final form of changes largely credited to review from @CelticMinstrel, @jyrkive and @Vultraz. Abstraction `mouse_handler::hex_hosts_unit` devised by @CelticMinstrel. Abstraction `mouse_handler::hovered_hex` devised by @jyrkive. src/menu_events.cpp: Disable unit movements highlighting when mouse landing on unit after activating 'show [best possible] enemy moves' via mouse. src/mouse_events.cpp: On mouse_handler construction, normal units highlighting is allowed. If the mouse is hovering a unit, do not show unit paths if the toggle for preventing it is active. If the mouse is not on a unit, disable the toggle. src/mouse_events.hpp: Add object field that will be responsible to control prevention of unit paths highlighting when that gets judged as improper. Add new public function for querying if a given hex is occupied by a unit. Add new public function for returning the hex the mouse is hovering, if any.
- Loading branch information
1 parent
756dcfa
commit 5c099e0
Showing
3 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters