Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ friend class Drawable; // for selection/deselection transactions
Bool m_placeAnchorInProgress; ///< is place angle interface for placement active
ICoord2D m_placeAnchorStart; ///< place angle anchor start
ICoord2D m_placeAnchorEnd; ///< place angle anchor end
Real m_placeAnchorOrientation; ///< latest building orientation from placement anchoring
Int m_selectCount; ///< Number of objects currently "selected"
Int m_maxSelectCount; ///< Max number of objects to select
UnsignedInt m_frameSelectionChanged; ///< Frame when the selection last changed.
Expand Down
7 changes: 6 additions & 1 deletion GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,7 @@ InGameUI::InGameUI()
m_placeAnchorStart.x = m_placeAnchorStart.y = 0;
m_placeAnchorEnd.x = m_placeAnchorEnd.y = 0;
m_placeAnchorInProgress = FALSE;
m_placeAnchorOrientation = 0.0f;

m_videoStream = nullptr;
m_videoBuffer = nullptr;
Expand Down Expand Up @@ -1615,7 +1616,9 @@ void InGameUI::handleBuildPlacements( void )
{
ICoord2D loc;
Coord3D world;
Real angle = m_placeIcon[ 0 ]->getOrientation();

// TheSuperHackers @tweak Caball009 09/02/2026 Use force attack to get the latest building orientation from placement anchoring for convenience.
Real angle = isInForceAttackMode() ? m_placeAnchorOrientation : m_placeIcon[ 0 ]->getOrientation();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wrong modifier state used

This change keys off isInForceAttackMode(), but the PR description says this behavior should be enabled by holding CTRL during placement. In this codebase isInForceAttackMode() is a broader UI state (used in selection/command translation), and it can be true outside of the “holding CTRL while placing” scenario. That means building placement orientation can be overridden unexpectedly whenever force-attack mode is active.

If the intent is “only while CTRL is held during placement”, use the same input source that sets/reflects the CTRL modifier state for placement (or explicitly check the modifier key in handleBuildPlacements).

Prompt To Fix With AI
This is a comment left during a code review.
Path: GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
Line: 1620:1622

Comment:
**Wrong modifier state used**

This change keys off `isInForceAttackMode()`, but the PR description says this behavior should be enabled by holding `CTRL` during placement. In this codebase `isInForceAttackMode()` is a broader UI state (used in selection/command translation), and it can be true outside of the “holding CTRL while placing” scenario. That means building placement orientation can be overridden unexpectedly whenever force-attack mode is active.

If the intent is “only while CTRL is held during placement”, use the same input source that sets/reflects the CTRL modifier state for placement (or explicitly check the modifier key in `handleBuildPlacements`).

How can I resolve this? If you propose a fix, please make it concise.

// update the angle of the icon to match any placement angle and pick the
// location the icon will be at (anchored is the start, otherwise it's the mouse)
Expand Down Expand Up @@ -1650,6 +1653,8 @@ void InGameUI::handleBuildPlacements( void )
const Real snapRadians = DEG_TO_RADF(45);
angle = WWMath::Round(angle / snapRadians) * snapRadians;
}

m_placeAnchorOrientation = angle;
}

}
Expand Down
Loading