@@ -349,6 +349,14 @@ Bool addDrawableToList( Drawable *draw, void *userData )
349349 if (!pds->drawableListToFill )
350350 return FALSE ;
351351
352+ #if !RTS_GENERALS || !RETAIL_COMPATIBLE_BUG
353+ if (draw->getFullyObscuredByShroud ())
354+ return FALSE ;
355+
356+ if (draw->isDrawableEffectivelyHidden ())
357+ return FALSE ;
358+ #endif
359+
352360 if (!draw->getTemplate ()->isAnyKindOf (pds->kindofsToMatch ))
353361 return FALSE ;
354362
@@ -368,28 +376,15 @@ Bool addDrawableToList( Drawable *draw, void *userData )
368376 return FALSE ;
369377 }
370378
371- // Kris: Aug 9, 2003!!! Wow, this bug has been around a LONG time!!
372- // Basically, it was possible to drag select a single enemy/neutral unit even if you couldn't see it
373- // including stealthed units.
374- const Object *obj = draw->getObject ();
375- if ( obj )
376- {
377- const Player *player = ThePlayerList->getLocalPlayer ();
378- Relationship rel = player->getRelationship ( obj->getTeam () );
379- if ( rel == NEUTRAL || rel == ENEMIES )
380- {
381- if ( obj->getShroudedStatus ( player->getPlayerIndex () ) >= OBJECTSHROUD_FOGGED )
382- {
383- return FALSE ;
384- }
385-
386- // If stealthed, no way!
387- if ( obj->testStatus ( OBJECT_STATUS_STEALTHED ) && !obj->testStatus ( OBJECT_STATUS_DETECTED ) )
388- {
389- return FALSE ;
390- }
391- }
392- }
379+ #if !RTS_GENERALS && RETAIL_COMPATIBLE_BUG
380+ // TheSuperHackers @info
381+ // In retail, hidden objects such as passengers are included here when drag-selected, which causes
382+ // enemy selection logic to exit early (only 1 enemy unit can be selected at a time). Some players
383+ // exploit this bug to determine if a transport contains passengers and consider this an important
384+ // feature and an advanced skill to pull off, so we must leave the exploit.
385+ if (draw->getObject () && draw->getObject ()->getContain () && draw->getObject ()->getContain ()->getContainCount () > 0 )
386+ pds->drawableListToFill ->push_back (draw); // Just add the unit twice to prevent enemy selections
387+ #endif
393388
394389 pds->drawableListToFill ->push_back (draw);
395390 return TRUE ;
0 commit comments