Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement units cycling #2474

Merged
merged 7 commits into from
Jan 4, 2025
Merged

Conversation

blabber
Copy link
Collaborator

@blabber blabber commented Dec 28, 2024

Since the new Units Report was introduced in 3.1, there was no longer a way to cycle all units of a given unit type on the map.

With this commit scrolling the mouse wheel on the selected unit icon in the "Unit Controls" widget, cycles through idle or sentried units of the same unit type.

Since the new Units Report was introduced in 3.1, there was no longer
a way to cycle all units of a given unit type on the map.

With this commit scrolling the mouse wheel on the selected unit icon
in the "Unit Controls" widget, cycles through idle or sentried units
of the same unit type.
@blabber
Copy link
Collaborator Author

blabber commented Dec 28, 2024

This is something I was missing in Sim06. To be honest the UX is obscure, but it is similar to the way it worked in the units report pre-3.1. And it is easier than working with the advanced unit selection for this use case.

@blabber
Copy link
Collaborator Author

blabber commented Dec 28, 2024

CodeFactor is not happy, although I don't think the method it is complaining about is overly complex. Will check later.

@jwrober
Copy link
Collaborator

jwrober commented Dec 30, 2024

I had an idea to change the units view to allow for expanding the table to show rows for each unit type and you could double-click to got to the specific unit. This is a nice side idea too. I'll have a look for review.

@jwrober jwrober self-requested a review December 30, 2024 15:51
@jwrober
Copy link
Collaborator

jwrober commented Dec 30, 2024

I can't seem to get this to work. If I select a unit on the map, hover my mouse over it and scroll the wheel, the map moves up/down.

@jwrober
Copy link
Collaborator

jwrober commented Dec 30, 2024

Screencast_20241230_102942.mp4

@blabber
Copy link
Collaborator Author

blabber commented Dec 30, 2024

This is a misunderstanding. Try the icon in the units control widget.

20241230_17h42m20s_grim

The new function names share the prefix `cycle_units`. This is an
effort to reduce complexity and pet CodeFactor.
@blabber
Copy link
Collaborator Author

blabber commented Jan 1, 2025

Fixed the CodeFactor warning.

client/hudwidget.cpp Outdated Show resolved Hide resolved
client/hudwidget.cpp Show resolved Hide resolved
docs/Manuals/Game/unit-controls.rst Outdated Show resolved Hide resolved
client/hudwidget.cpp Outdated Show resolved Hide resolved
As requested by code review. No functional changes.
As requested by code review. No functional changes.
Reported by clangd.
This check is used in the logic to find the nearest unit in
`view_units.cpp` and the code to cycle units in `hudwidget.cpp`.
Copy link
Contributor

@lmoureaux lmoureaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll let @jwrober check that it works but I'm happy from the code perspective :)

@jwrober jwrober merged commit c817804 into longturn:master Jan 4, 2025
21 checks passed
@blabber blabber deleted the feature/units_cycling branch January 4, 2025 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants