File tree Expand file tree Collapse file tree
GeneralsMD/Code/GameEngine Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -645,9 +645,6 @@ class Player : public Snapshot
645645 // adds the given AIGroup to the current selection of this player.
646646 void addAIGroupToCurrentSelection (AIGroup *group);
647647
648- // returns false if player has object(s) currently selected
649- Bool isCurrentlySelectedGroupEmpty () const ;
650-
651648 // return the requested hotkey squad
652649 Squad *getHotkeySquad (Int squadNumber);
653650
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ class SelectionTranslator : public GameMessageTranslator
4242 friend Bool killThemKillThemAllWrapper ( Drawable *draw, void *userData );
4343private:
4444
45+ Bool m_pendingDeselection;
4546 Bool m_leftMouseButtonIsDown;
4647 Bool m_dragSelecting;
4748 UnsignedInt m_lastGroupSelTime;
Original file line number Diff line number Diff line change @@ -3819,11 +3819,6 @@ void Player::addAIGroupToCurrentSelection(AIGroup *group) {
38193819 }
38203820}
38213821
3822- Bool Player::isCurrentlySelectedGroupEmpty () const
3823- {
3824- return m_currentSelection->getSizeOfGroup () == 0 ;
3825- }
3826-
38273822// -------------------------------------------------------------------------------------------------
38283823/* * addTypeOfProductionCostChange adds a production change to the typeof list */
38293824// -------------------------------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -3556,7 +3556,7 @@ void InGameUI::deselectDrawable( Drawable *draw )
35563556void InGameUI::deselectAllDrawables ( Bool updateGameLogic )
35573557{
35583558 const DrawableList *selected = getAllSelectedDrawables ();
3559- const Bool emptyDrawableSelection = selected->empty ();
3559+ const Bool emptySelectedDrawables = selected->empty ();
35603560
35613561 // loop through all the selected drawables
35623562 for ( DrawableListCIt it = selected->begin (); it != selected->end (); )
@@ -3579,8 +3579,8 @@ void InGameUI::deselectAllDrawables( Bool updateGameLogic )
35793579
35803580 if (updateGameLogic)
35813581 {
3582- // TheSuperHackers @tweak Avoid sending this message when no objects are currently selected.
3583- if (!emptyDrawableSelection || !ThePlayerList-> getLocalPlayer ()-> isCurrentlySelectedGroupEmpty () )
3582+ // TheSuperHackers @tweak Only send this message when objects are currently selected.
3583+ if (!emptySelectedDrawables )
35843584 {
35853585 // TheSuperHackers @tweak Originally this message had one boolean argument, but it wasn't used for anything.
35863586 TheMessageStream->appendMessage (GameMessage::MSG_DESTROY_SELECTED_GROUP);
Original file line number Diff line number Diff line change @@ -249,6 +249,7 @@ SelectionTranslator *TheSelectionTranslator = nullptr;
249249// -----------------------------------------------------------------------------
250250SelectionTranslator::SelectionTranslator ()
251251{
252+ m_pendingDeselection = FALSE ;
252253 m_leftMouseButtonIsDown = FALSE ;
253254 m_dragSelecting = FALSE ;
254255 m_lastGroupSelTime = 0 ;
@@ -738,6 +739,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
738739 {
739740 if (!addToGroup)
740741 {
742+ m_pendingDeselection = FALSE ;
741743 TheInGameUI->deselectAllDrawables (FALSE );
742744 }
743745
@@ -939,7 +941,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
939941 {
940942 if ( !TheInGameUI->getPreventLeftClickDeselectionInAlternateMouseModeForOneClick () )
941943 {
942- TheInGameUI-> deselectAllDrawables () ;
944+ m_pendingDeselection = TRUE ;
943945 m_lastGroupSelGroup = -1 ;
944946 }
945947 else
@@ -1318,6 +1320,14 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
13181320#endif
13191321 }
13201322
1323+ // TheSuperHackers @tweak Avoid double deselection when selecting a new object with another object selected,
1324+ // triggered by RAW_MOUSE_LEFT_BUTTON_UP and MOUSE_LEFT_CLICK, respectively.
1325+ if (msg->getType () == GameMessage::MSG_MOUSE_LEFT_CLICK && m_pendingDeselection)
1326+ {
1327+ m_pendingDeselection = FALSE ;
1328+ TheInGameUI->deselectAllDrawables ();
1329+ }
1330+
13211331 return disp;
13221332}
13231333
You can’t perform that action at this time.
0 commit comments