Skip to content

Commit 71b2335

Browse files
committed
refactor: Standardise shroud condition logic
1 parent f73273a commit 71b2335

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -875,10 +875,11 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos
875875

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

884885
TheTerrainVisual->addFactionBib(them, true);
@@ -887,7 +888,7 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos
887888
// Check for overlap of his exit rectangle with my geom info
888889
if (checkHisExit && ThePartitionManager->geomCollidesWithGeom(&hisExitPos, hisGeom, them->getOrientation(),
889890
worldPos, myBounds, angle)) {
890-
if (them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud())
891+
if (shrouded)
891892
return LBC_SHROUD;
892893

893894
TheTerrainVisual->addFactionBib(them, true);
@@ -896,7 +897,7 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos
896897
// Check both exit rectangles together.
897898
if (checkMyExit&&checkHisExit&&ThePartitionManager->geomCollidesWithGeom(&hisExitPos, hisGeom, them->getOrientation(),
898899
&myExitPos, myGeom, angle)) {
899-
if (them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud())
900+
if (shrouded)
900901
return LBC_SHROUD;
901902

902903
TheTerrainVisual->addFactionBib(them, true);

0 commit comments

Comments
 (0)