Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions GeneralsMD/Code/GameEngine/Include/GameClient/SelectionInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ struct PickDrawableStruct
{
// List to fill with Drawables. This should be provided by the caller.
DrawableList *drawableListToFill;

Bool isPointSelection;
Bool forceAttackMode;

// Note, this is OR'd with the things we are attempting to select.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
DrawableList drawablesThatWillSelect;
PickDrawableStruct pds;
pds.drawableListToFill = &drawablesThatWillSelect;
pds.isPointSelection = isPoint;
TheTacticalView->iterateDrawablesInRegion(&selectionRegion, addDrawableToList, &pds);

if (drawablesThatWillSelect.empty())
Expand Down
18 changes: 10 additions & 8 deletions GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,8 @@ SelectionInfo::SelectionInfo() :
{ }

//-------------------------------------------------------------------------------------------------
PickDrawableStruct::PickDrawableStruct() : drawableListToFill(NULL)
PickDrawableStruct::PickDrawableStruct() : drawableListToFill(NULL), isPointSelection(FALSE)
{
//Added By Sadullah Nader
//Initializations inserted
drawableListToFill = FALSE;
//
forceAttackMode = TheInGameUI->isInForceAttackMode();
UnsignedInt pickType = getPickTypesForContext(forceAttackMode);
translatePickTypesToKindof(pickType, kindofsToMatch);
Expand Down Expand Up @@ -365,7 +361,7 @@ Bool addDrawableToList( Drawable *draw, void *userData )
const Object *obj = draw->getObject();
if ( obj && obj->getContainedBy() )//hmm, interesting... he is not selectable but he is contained
{// What we are after here is to propagate the selection the selection ti the container
// if the cobtainer is non-enclosing... see also selectionxlat, in the left_click case
// if the container is non-enclosing... see also SelectionXlat, in the left_click case

ContainModuleInterface *contain = obj->getContainedBy()->getContain();
Drawable *containDraw = obj->getContainedBy()->getDrawable();
Expand All @@ -382,8 +378,14 @@ Bool addDrawableToList( Drawable *draw, void *userData )
// enemy selection logic to exit early (only 1 enemy unit can be selected at a time). Some players
// exploit this bug to determine if a transport contains passengers and consider this an important
// feature and an advanced skill to pull off, so we must leave the exploit.
if (draw->getObject() && draw->getObject()->getContain() && draw->getObject()->getContain()->getContainCount() > 0)
pds->drawableListToFill->push_back(draw); // Just add the unit twice to prevent enemy selections
if (!pds->isPointSelection)
{
const Object *obj = draw->getObject();
if (obj)
if (obj->getControllingPlayer() != ThePlayerList->getLocalPlayer())
if (obj->getContain() && draw->getObject()->getContain()->getContainCount() > 0)
return FALSE;
}
#endif

pds->drawableListToFill->push_back(draw);
Expand Down
Loading