Skip to content

Commit 27583db

Browse files
committed
chore: Check all squad members when determining reselection
1 parent 98b78c0 commit 27583db

File tree

6 files changed

+34
-2
lines changed

6 files changed

+34
-2
lines changed

Generals/Code/GameEngine/Include/GameClient/InGameUI.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ friend class Drawable; // for selection/deselection transactions
440440
virtual Drawable *getFirstSelectedDrawable( void ); ///< get the first selected drawable (if any)
441441
virtual DrawableID getSoloNexusSelectedDrawableID( void ) { return m_soloNexusSelectedDrawableID; } ///< Return the one drawable of the nexus if only 1 angry mob is selected
442442
virtual Bool isDrawableSelected( DrawableID idToCheck ) const; ///< Return true if the selected ID is in the drawable list
443+
virtual Bool areAllObjectsSelected(std::vector<Object*> objectsToCheck) const; ///< Return true if all of the selected objects are in the drawable list
443444
virtual Bool isAnySelectedKindOf( KindOfType kindOf ) const; ///< is any selected object a kind of
444445
virtual Bool isAllSelectedKindOf( KindOfType kindOf ) const; ///< are all selected objects a kind of
445446

Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3335,6 +3335,21 @@ Bool InGameUI::isDrawableSelected( DrawableID idToCheck ) const
33353335

33363336
} // end isDrawableSelected
33373337

3338+
//-------------------------------------------------------------------------------------------------
3339+
/** Return true if all of the selected objects are in the drawable list */
3340+
//-------------------------------------------------------------------------------------------------
3341+
Bool InGameUI::areAllObjectsSelected(std::vector<Object*> objectsToCheck) const
3342+
{
3343+
for (DrawableListCIt it = m_selectedDrawables.begin(); it != m_selectedDrawables.end(); ++it)
3344+
{
3345+
if (std::find(objectsToCheck.begin(), objectsToCheck.end(), (*it)->getObject()) == objectsToCheck.end())
3346+
return FALSE;
3347+
}
3348+
3349+
return TRUE;
3350+
3351+
} // end areAllObjectsSelected
3352+
33383353
// ------------------------------------------------------------------------------------------------
33393354
// ------------------------------------------------------------------------------------------------
33403355
Bool InGameUI::isAnySelectedKindOf( KindOfType kindOf ) const

Generals/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
10451045
// if theres someone in the group, center the camera on them.
10461046
Drawable* drawable = objlist[numObjs - 1]->getDrawable();
10471047
TheTacticalView->lookAt( drawable->getPosition() );
1048-
performSelection = !TheInGameUI->isDrawableSelected( drawable->getID() );
1048+
performSelection = !TheInGameUI->areAllObjectsSelected( objlist );
10491049
}
10501050
}
10511051
}

GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ friend class Drawable; // for selection/deselection transactions
455455
virtual Drawable *getFirstSelectedDrawable( void ); ///< get the first selected drawable (if any)
456456
virtual DrawableID getSoloNexusSelectedDrawableID( void ) { return m_soloNexusSelectedDrawableID; } ///< Return the one drawable of the nexus if only 1 angry mob is selected
457457
virtual Bool isDrawableSelected( DrawableID idToCheck ) const; ///< Return true if the selected ID is in the drawable list
458+
virtual Bool areAllObjectsSelected(std::vector<Object*> objectsToCheck) const; ///< Return true if all of the selected objects are in the drawable list
458459
virtual Bool isAnySelectedKindOf( KindOfType kindOf ) const; ///< is any selected object a kind of
459460
virtual Bool isAllSelectedKindOf( KindOfType kindOf ) const; ///< are all selected objects a kind of
460461

GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3425,6 +3425,21 @@ Bool InGameUI::isDrawableSelected( DrawableID idToCheck ) const
34253425

34263426
} // end isDrawableSelected
34273427

3428+
//-------------------------------------------------------------------------------------------------
3429+
/** Return true if all of the selected objects are in the drawable list */
3430+
//-------------------------------------------------------------------------------------------------
3431+
Bool InGameUI::areAllObjectsSelected(std::vector<Object*> objectsToCheck) const
3432+
{
3433+
for (DrawableListCIt it = m_selectedDrawables.begin(); it != m_selectedDrawables.end(); ++it)
3434+
{
3435+
if (std::find(objectsToCheck.begin(), objectsToCheck.end(), (*it)->getObject()) == objectsToCheck.end())
3436+
return FALSE;
3437+
}
3438+
3439+
return TRUE;
3440+
3441+
} // end areAllObjectsSelected
3442+
34283443
// ------------------------------------------------------------------------------------------------
34293444
// ------------------------------------------------------------------------------------------------
34303445
Bool InGameUI::isAnySelectedKindOf( KindOfType kindOf ) const

GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
11201120
// if theres someone in the group, center the camera on them.
11211121
Drawable* drawable = objlist[numObjs - 1]->getDrawable();
11221122
TheTacticalView->lookAt( drawable->getPosition() );
1123-
performSelection = !TheInGameUI->isDrawableSelected( drawable->getID() );
1123+
performSelection = !TheInGameUI->areAllObjectsSelected( objlist );
11241124
}
11251125
}
11261126
}

0 commit comments

Comments
 (0)