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
16 changes: 12 additions & 4 deletions Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,9 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build,


//-------------------------------------------------------------------------------------------------
/** Check for objects preventing building at this location. */
/** Check for objects preventing building at this location.
* TheSuperHackers @tweak Stubbjax 05/09/2025 Return LBC_SHROUD for shrouded objects near the
* edge of the shroud so that players cannot use this info to determine whether they exist. */
//-------------------------------------------------------------------------------------------------
Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos,
const ThingTemplate *build,
Expand All @@ -674,6 +676,8 @@ Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos,
MemoryPoolObjectHolder hold(iter);
Comment thread
xezon marked this conversation as resolved.
for( them = iter->first(); them; them = iter->next() )
{
if (them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud())
return false;

// ignore any kind of class of objects that we will "remove" for building
if( isRemovableForConstruction( them ) == TRUE )
Expand Down Expand Up @@ -803,22 +807,26 @@ Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos,

// an immobile object will obstruct our building no matter what team it's on
if ( them->isKindOf( KINDOF_IMMOBILE ) ) {
Bool shrouded = them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud();
/* Check for overlap of my exit rectangle to his geom info. */
if (checkMyExit && ThePartitionManager->geomCollidesWithGeom(them->getPosition(), hisBounds, them->getOrientation(),
&myExitPos, myGeom, angle)) {
TheTerrainVisual->addFactionBib(them, true);
if (!shrouded)
TheTerrainVisual->addFactionBib(them, true);
return false;
}
// Check for overlap of his exit rectangle with my geom info
if (checkHisExit && ThePartitionManager->geomCollidesWithGeom(&hisExitPos, hisGeom, them->getOrientation(),
worldPos, myBounds, angle)) {
TheTerrainVisual->addFactionBib(them, true);
if (!shrouded)
TheTerrainVisual->addFactionBib(them, true);
return false;
}
// Check both exit rectangles together.
if (checkMyExit&&checkHisExit&&ThePartitionManager->geomCollidesWithGeom(&hisExitPos, hisGeom, them->getOrientation(),
&myExitPos, myGeom, angle)) {
TheTerrainVisual->addFactionBib(them, true);
if (!shrouded)
TheTerrainVisual->addFactionBib(them, true);
return false;
}
}
Expand Down
18 changes: 16 additions & 2 deletions GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,9 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build,


//-------------------------------------------------------------------------------------------------
/** Check for objects preventing building at this location. */
/** Check for objects preventing building at this location.
* TheSuperHackers @tweak Stubbjax 05/09/2025 Return LBC_SHROUD for shrouded objects near the
* edge of the shroud so that players cannot use this info to determine whether they exist. */
//-------------------------------------------------------------------------------------------------
LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos,
const ThingTemplate *build,
Expand All @@ -674,8 +676,10 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos
MemoryPoolObjectHolder hold(iter);
for( them = iter->first(); them; them = iter->next() )
{
Bool feedbackWithFailure = TRUE;
if (them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud())
return LBC_SHROUD;
Comment thread
xezon marked this conversation as resolved.

Bool feedbackWithFailure = TRUE;
Relationship rel = builderObject ? builderObject->getRelationship( them ) : NEUTRAL;

//Kris: If the object is stealthed and we can't see it, pretend we can build there.
Expand Down Expand Up @@ -871,21 +875,31 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos

// an immobile object will obstruct our building no matter what team it's on
if ( them->isKindOf( KINDOF_IMMOBILE ) ) {
Bool shrouded = them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud();
/* Check for overlap of my exit rectangle to his geom info. */
if (checkMyExit && ThePartitionManager->geomCollidesWithGeom(them->getPosition(), hisBounds, them->getOrientation(),
&myExitPos, myGeom, angle)) {
if (shrouded)
return LBC_SHROUD;

TheTerrainVisual->addFactionBib(them, true);
return LBC_OBJECTS_IN_THE_WAY;
}
// Check for overlap of his exit rectangle with my geom info
if (checkHisExit && ThePartitionManager->geomCollidesWithGeom(&hisExitPos, hisGeom, them->getOrientation(),
worldPos, myBounds, angle)) {
if (shrouded)
return LBC_SHROUD;

TheTerrainVisual->addFactionBib(them, true);
return LBC_OBJECTS_IN_THE_WAY;
}
// Check both exit rectangles together.
if (checkMyExit&&checkHisExit&&ThePartitionManager->geomCollidesWithGeom(&hisExitPos, hisGeom, them->getOrientation(),
&myExitPos, myGeom, angle)) {
if (shrouded)
return LBC_SHROUD;

TheTerrainVisual->addFactionBib(them, true);
return LBC_OBJECTS_IN_THE_WAY;
}
Expand Down
Loading