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): take the placement range ring down when placement ends

Olcay Seygan65b5bb792185
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
index d443f1317..3bc797737 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
@@ -752,6 +752,8 @@ protected:
SuperweaponMap m_superweapons[MAX_PLAYER_COUNT];
void drawHudOverlay( void ); ///< one-line fps / clock / income overlay (ShowHudOverlay)
+ Bool m_placementRangeRingUp; ///< we put a radius cursor up for a pending structure, so we owe a clear
+
DisplayString * m_hudDisplayString; ///< the ShowHudOverlay line (fps / clock / income)
UnsignedInt m_hudLastSampleFrame; ///< client frame the fps sample was last refreshed on
Real m_hudFps; ///< smoothed render rate
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index f66e42dd1..8605b8dde 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -1001,6 +1001,7 @@ InGameUI::InGameUI()
m_replayWindow = NULL;
m_messagesOn = TRUE;
+ m_placementRangeRingUp = FALSE;
m_hudDisplayString = NULL;
m_hudLastSampleFrame = 0;
m_hudFps = 0.0f;
@@ -1467,6 +1468,7 @@ void InGameUI::handleBuildPlacements( void )
}
}
setRadiusCursorForRadius( placeRange );
+ m_placementRangeRingUp = ( placeRange > 0.0f );
}
// update the angle of the icon to match any placement angle and pick the
@@ -3077,6 +3079,15 @@ void InGameUI::placeBuildAvailable( const ThingTemplate *build, Drawable *buildD
{
// if building something, no radius cursor, thankew
setRadiusCursorNone();
+ m_placementRangeRingUp = FALSE;
+ }
+ else if (m_placementRangeRingUp)
+ {
+ // placement is over - cancelled, or the structure went down. Take our own range ring with
+ // it; nothing else was going to, so it used to sit on the map until the next radius cursor
+ // happened to replace it.
+ setRadiusCursorNone();
+ m_placementRangeRingUp = FALSE;
}
//