Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gameengine): anchor placement on the second click of a fast pair

Olcay Seygane21e75daa900
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 101bf86fe..b0b4d3cb2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -185,6 +185,7 @@ found and fixed — EA's own, not port damage.**
- The placement grid is drawn on the ground and follows the slope.
- Unbuildable ground is a soft red wash, crossed out square by square.
- Running out of money no longer strands the ghost on the map.
+- Holding shift and clicking out a row of buildings no longer stops halfway and selects one.
- A building you point at blocked ground slides to the nearest spot it fits, and lands there.
- The pointer keeps its build cursor while you place, even passing over your own buildings.
- GLA defences get a range ring while you site them.
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp
index 97542ec7f..b93e98a30 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp
@@ -116,7 +116,16 @@ GameMessageDisposition PlaceEventTranslator::translateGameMessage(const GameMess
{
//---------------------------------------------------------------------------------------------
+ //
+ // Windows sends the second press of a quick pair as WM_LBUTTONDBLCLK, not WM_LBUTTONDOWN,
+ // so it reaches the stream as a double click (see Mouse::createStreamMessages). Placing a
+ // row of structures with shift held is exactly that: a fast series of clicks. Without this
+ // label the second one set no placement anchor, the click that followed found none and was
+ // left for the selection translator, and a run of buildings ended with the placement gone
+ // and whatever was under the cursor selected instead.
+ //
case GameMessage::MSG_RAW_MOUSE_LEFT_BUTTON_DOWN:
+ case GameMessage::MSG_RAW_MOUSE_LEFT_DOUBLE_CLICK:
{
//
// The global production strip lies over the world rather than inside a window, so