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(gameclient): let an open dropdown take clicks past its panel

Olcay Seygan18f729cc95af
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d58a36674..cccbff4a3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -546,6 +546,7 @@ found and fixed — EA's own, not port damage.**
- The game speed slider stops at 60. Its last notch used to read "--" and started the match at a thousand game frames a second, which no machine can play and every machine tried to. A speed saved on that notch comes back as 60.
- A Unit Limit box on the settings page caps the match at 840 units, shared out evenly: two players get 420 each, four get 210, eight get 105. Units standing and units waiting in a queue both count against your share, buildings do not, and the build buttons grey out when you reach it. A transport that rolls out full is charged for its riders while it is still in the queue, so a Troop Crawler costs nine and cannot slip eight Red Guards past the limit, and a pair of Red Guards costs two. A shift or control batch near the wall queues as many as still fit and stops there, and a button whose next order would not fit greys out. Your own count and your share sit in the top right corner next to the frame rate, so you can see the wall coming. The host ticks it; everybody else sees it ticked.
- Superweapons are a dropdown instead of a tick box. Allow Superweapons is the game as it plays without a rule. Limit Superweapons leaves each player one Particle Cannon, one Nuclear Missile or one Scud Storm at a time. No Superweapons bars them.
+- No Superweapons can be picked. The dropdown sits low on the settings page, and its last row hung past the bottom edge of the panel: it drew, but a click on it went to nobody and the list stayed on whatever it said before. Any dropdown row past the edge of its panel takes the click now.
- The USA Superweapon General is the exception to both, because the rule that reads as a handicap to everyone else reads as a deletion to him: three superweapons of his own are what he pays for weaker tanks, weaker infantry and a worse air force with. Under Limit he keeps four of each of his. Under No he keeps one. Play him against a lobby that has banned superweapons and you are playing the army you paid for, not an empty base.
- The tick box was one number for everybody, which is why it could only ever say yes or no. A ticked box in a settings file from an older build reads back as No Superweapons.
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp
index 8babdaf08..1f13e6834 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp
@@ -839,6 +839,8 @@ WinInputReturnCode GameWindowManager::winProcessKey( UnsignedByte key,
//-------------------------------------------------------------------------------------------------
/** Process a single mouse event through the window system */
//-------------------------------------------------------------------------------------------------
+Bool OpenWindowOwnsPoint( Bool isOpen, Int originX, Int originY, Int width, Int height, Int x, Int y );
+
WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage msg,
ICoord2D *mousePos,
void *data )
@@ -1014,11 +1016,22 @@ WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage ms
else
{
- if( m_modalHead && m_modalHead->window )
+ // the rows of an open dropdown that hang past its panel; see OpenWindowOwnsPoint
+ if( m_loneWindow )
+ {
+ ICoord2D origin, size;
+ m_loneWindow->winGetScreenPosition( &origin.x, &origin.y );
+ m_loneWindow->winGetSize( &size.x, &size.y );
+ if( OpenWindowOwnsPoint( !m_loneWindow->winIsHidden(), origin.x, origin.y,
+ size.x, size.y, mousePos->x, mousePos->y ) )
+ window = m_loneWindow->winPointInChild( mousePos->x, mousePos->y, FALSE, FALSE, allowDisabledCancel );
+ }
+
+ if( window == NULL && m_modalHead && m_modalHead->window )
{
window = m_modalHead->window->winPointInChild( mousePos->x, mousePos->y, FALSE, FALSE, allowDisabledCancel );
}
- else
+ else if( window == NULL )
{
/**@todo Colin, there are 3 cases here that are nearly identical code,