Skip to content

Commit a8495cd

Browse files
committed
bugfix: Invalid placement indicator no longer shows for shrouded objects
1 parent 636c40f commit a8495cd

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,8 @@ Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos,
674674
MemoryPoolObjectHolder hold(iter);
675675
for( them = iter->first(); them; them = iter->next() )
676676
{
677+
if (them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud())
678+
return false;
677679

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

804806
// an immobile object will obstruct our building no matter what team it's on
805807
if ( them->isKindOf( KINDOF_IMMOBILE ) ) {
808+
Bool shrouded = them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud();
806809
/* Check for overlap of my exit rectangle to his geom info. */
807810
if (checkMyExit && ThePartitionManager->geomCollidesWithGeom(them->getPosition(), hisBounds, them->getOrientation(),
808811
&myExitPos, myGeom, angle)) {
809-
TheTerrainVisual->addFactionBib(them, true);
812+
if (!shrouded)
813+
TheTerrainVisual->addFactionBib(them, true);
810814
return false;
811815
}
812816
// Check for overlap of his exit rectangle with my geom info
813817
if (checkHisExit && ThePartitionManager->geomCollidesWithGeom(&hisExitPos, hisGeom, them->getOrientation(),
814818
worldPos, myBounds, angle)) {
815-
TheTerrainVisual->addFactionBib(them, true);
819+
if (!shrouded)
820+
TheTerrainVisual->addFactionBib(them, true);
816821
return false;
817822
}
818823
// Check both exit rectangles together.
819824
if (checkMyExit&&checkHisExit&&ThePartitionManager->geomCollidesWithGeom(&hisExitPos, hisGeom, them->getOrientation(),
820825
&myExitPos, myGeom, angle)) {
821-
TheTerrainVisual->addFactionBib(them, true);
826+
if (!shrouded)
827+
TheTerrainVisual->addFactionBib(them, true);
822828
return false;
823829
}
824830
}

GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,9 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos
676676
{
677677
Bool feedbackWithFailure = TRUE;
678678

679+
if (them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud())
680+
return LBC_SHROUD;
681+
679682
Relationship rel = builderObject ? builderObject->getRelationship( them ) : NEUTRAL;
680683

681684
//Kris: If the object is stealthed and we can't see it, pretend we can build there.
@@ -871,22 +874,26 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos
871874

872875
// an immobile object will obstruct our building no matter what team it's on
873876
if ( them->isKindOf( KINDOF_IMMOBILE ) ) {
877+
Bool shrouded = them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud();
874878
/* Check for overlap of my exit rectangle to his geom info. */
875879
if (checkMyExit && ThePartitionManager->geomCollidesWithGeom(them->getPosition(), hisBounds, them->getOrientation(),
876880
&myExitPos, myGeom, angle)) {
877-
TheTerrainVisual->addFactionBib(them, true);
881+
if (!shrouded)
882+
TheTerrainVisual->addFactionBib(them, true);
878883
return LBC_OBJECTS_IN_THE_WAY;
879884
}
880885
// Check for overlap of his exit rectangle with my geom info
881886
if (checkHisExit && ThePartitionManager->geomCollidesWithGeom(&hisExitPos, hisGeom, them->getOrientation(),
882887
worldPos, myBounds, angle)) {
883-
TheTerrainVisual->addFactionBib(them, true);
888+
if (!shrouded)
889+
TheTerrainVisual->addFactionBib(them, true);
884890
return LBC_OBJECTS_IN_THE_WAY;
885891
}
886892
// Check both exit rectangles together.
887893
if (checkMyExit&&checkHisExit&&ThePartitionManager->geomCollidesWithGeom(&hisExitPos, hisGeom, them->getOrientation(),
888894
&myExitPos, myGeom, angle)) {
889-
TheTerrainVisual->addFactionBib(them, true);
895+
if (!shrouded)
896+
TheTerrainVisual->addFactionBib(them, true);
890897
return LBC_OBJECTS_IN_THE_WAY;
891898
}
892899
}

0 commit comments

Comments
 (0)