Skip to content

Worker unit requires two clicks to become deselected after canceling building placement #1447

@mataktelis

Description

@mataktelis

Prerequisites

  • I have searched for similar issues and confirmed this is not a duplicate

Game Version

  • Command & Conquer Generals
  • Command & Conquer Generals: Zero Hour
  • Other (please specify below)

Bug Description

Seems to be caused by PR #1430
If you select a dozer, cancel a building placement, it takes 2 clicks to deselect the dozer. This happens when Alternative Mouse mode is ON. When it is OFF, the bug doesn't occur.

Found on VS 2022 build (debug and release)

Reproduction Steps

  1. Alternative Mouse mode is ON
  2. Select a worker
  3. choose a building
  4. cancel the building placement with RIGHT CLICK
  5. the building placement is canceled and the worker is not deselected (as intented with the fix)
  6. now LEFT click somewhere to deselect the worker
  7. the worker is not deselected
  8. LEFT click again, and the worker is deselected

Additional Context

This probably is caused here (SelectionXlat.cpp):

//In alternate mouse mode, right click still cancels building placement.
// TheSuperHackers @tweak Stubbjax 08/08/2025 Cancelling building placement no longer deselects the builder.
if (TheInGameUI->getPendingPlaceSourceObjectID() != INVALID_ID)
{
	TheInGameUI->placeBuildAvailable(NULL, NULL);
	disp = DESTROY_MESSAGE;
	TheInGameUI->setScrolling(FALSE);
}

This call: TheInGameUI->placeBuildAvailable(NULL, NULL); sets preventLeftClickDeselectionInAlternateMouseModeForOneClick to TRUE.
A quick fix could be to add TheInGameUI->setPreventLeftClickDeselectionInAlternateMouseModeForOneClick(FALSE); this after the placeBuildAvailable.

Metadata

Metadata

Assignees

Labels

BugSomething is not working right, typically is user facingGenRelates to GeneralsInputMinorSeverity: Minor < Major < Critical < BlockerThisProjectThe issue was introduced by this project, or this task is specific to this projectZHRelates to Zero Hour

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions