Skip to content

[GEN][ZH] Fix reselection of group not always working #1334

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

Closed
wants to merge 1 commit into from

Conversation

roossienb
Copy link

@roossienb roossienb commented Jul 22, 2025

From the issue:

When selecting a group via the 0 - 9 group hotkeys, the initial press selects the group. Double-pressing the respective group hotkey centers the camera on the group. However, the single-press vs double-press logic are two separate blocks, and the double-press logic does not (re)select the group.

Double pressing logic always assumed the group already is selected.
Rewrote the logic by breaking the if / else, now always (re)selecting the group - even on double press

Due to the re-arrangement of code, Github is not showing the changes very well. It is better to use compare next to each other.

@roossienb roossienb added this to the Code foundation build up milestone Jul 22, 2025
@roossienb roossienb self-assigned this Jul 22, 2025
@roossienb roossienb added Minor Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour Fix Is fixing something, but is not user facing labels Jul 22, 2025
@Mauller
Copy link

Mauller commented Jul 22, 2025

That bit of code you posted was backported from zero hour in selectionxlat to begin with, maybe it's just in a different place to where you were looking. #1305

@roossienb
Copy link
Author

roossienb commented Jul 22, 2025

That bit of code you posted was backported from zero hour in selectionxlat to begin with, maybe it's just in a different place to where you were looking. #1305

It was backported in ADD_TEAM.
In generals it is also present in SELECT_TEAM

Not sure if it is needed. If not, than no point in backporting it to ZH.
Edit: yes it is exploitable by putting a building in a team, then select units and using SHIFT to add the team (building) to the units. So it does need to be backported to ZH.

Never mind, as @xezon remarked, I fixed the wrong section in Generals 😵.

But it seems like the exploit is still possible. Will still make a full PR for that.

@Mauller
Copy link

Mauller commented Jul 22, 2025

Not sure if it is needed. If not, than no point in backporting it to ZH. Edit: yes it is exploitable by putting a building in a team, then select units and using SHIFT to add the team (building) to the units. So it does need to be backported to ZH.

Never mind, as @xezon remarked, I fixed the wrong section in Generals 😵.

But it seems like the exploit is still possible. Will still make a full PR for that.

Yeah, preventing the building being added using shift to a new team will prevent the normal way of scud bugging.

@Stubbjax
Copy link

My apologies @roossienb! I actually already have a working solution here. I was just wanted to create the issue and have it triaged first before opening a PR.

@roossienb
Copy link
Author

My apologies @roossienb! I actually already have a working solution here. I was just wanted to create the issue and have it triaged first before opening a PR.

Looks like you have a different solution to the issue. My suggestion would be to create a PR as an alternative to this one (and link it) and let the reviewers decide which implementation they like best. I don't mind either way.

@xezon
Copy link

xezon commented Jul 23, 2025

What about the GameMessage::MSG_META_ADD_TEAM ? Shouldn't that be treated equally or similarly?

@roossienb
Copy link
Author

What about the GameMessage::MSG_META_ADD_TEAM ? Shouldn't that be treated equally or similarly?

I'm not sure how that would work.

  • select a group of units
  • keep pressing shift + 1 to add the team to the selection
  • deselect all units
  • keep double tapping shift + 1
  • ....
  • what is the expected behaviour here? The original group of units cannot be selected anymore. Just select the group? Why would anyone keep tapping shift + 1?

@Mauller
Copy link

Mauller commented Aug 3, 2025

I think the stubjax version got merged for this in the end, so this could be closed.

@xezon xezon closed this Aug 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Is fixing something, but is not user facing Gen Relates to Generals Minor Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Centering the camera on a group does not (re)select the group
4 participants