From a8495cd9080d54781a29a83ee817df32ad9f8c01 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Fri, 5 Sep 2025 23:37:41 +1000 Subject: [PATCH 1/6] bugfix: Invalid placement indicator no longer shows for shrouded objects --- .../Source/Common/System/BuildAssistant.cpp | 12 +++++++++--- .../Source/Common/System/BuildAssistant.cpp | 13 ++++++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index cd13b50a308..df2e1a7daea 100644 --- a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -674,6 +674,8 @@ Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos, MemoryPoolObjectHolder hold(iter); 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 ) @@ -803,22 +805,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; } } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 72704ed607b..0be30047329 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -676,6 +676,9 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos { Bool feedbackWithFailure = TRUE; + if (them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud()) + return LBC_SHROUD; + Relationship rel = builderObject ? builderObject->getRelationship( them ) : NEUTRAL; //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 // 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 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)) { - TheTerrainVisual->addFactionBib(them, true); + if (!shrouded) + 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)) { - TheTerrainVisual->addFactionBib(them, true); + if (!shrouded) + TheTerrainVisual->addFactionBib(them, true); return LBC_OBJECTS_IN_THE_WAY; } } From db7f4d4acd29254da6da7220808c55e1f857f314 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Mon, 8 Sep 2025 13:40:57 +1000 Subject: [PATCH 2/6] refactor: Move feedbackWithFailure declaration position --- .../Code/GameEngine/Source/Common/System/BuildAssistant.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 0be30047329..bde33f10f08 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -674,11 +674,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; + 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. From 1559334b35f91df3c4b8ae50e568f66b6c9bb623 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Mon, 8 Sep 2025 19:37:39 +1000 Subject: [PATCH 3/6] tweak: Return shrouded status for shrouded exit extents --- .../Source/Common/System/BuildAssistant.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index bde33f10f08..013a4012c7c 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -873,26 +873,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) - TheTerrainVisual->addFactionBib(them, true); + if (them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud()) + 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) - TheTerrainVisual->addFactionBib(them, true); + if (them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud()) + 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) - TheTerrainVisual->addFactionBib(them, true); + if (them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud()) + return LBC_SHROUD; + + TheTerrainVisual->addFactionBib(them, true); return LBC_OBJECTS_IN_THE_WAY; } } From e87f5d25443e18f76b35cf4cbafbc5d9343cd20f Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 24 Sep 2025 13:05:54 +1000 Subject: [PATCH 4/6] docs: Add comments --- .../Code/GameEngine/Source/Common/System/BuildAssistant.cpp | 3 ++- .../Code/GameEngine/Source/Common/System/BuildAssistant.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index df2e1a7daea..c9db1a58110 100644 --- a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -656,7 +656,8 @@ 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. */ //------------------------------------------------------------------------------------------------- Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos, const ThingTemplate *build, diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 013a4012c7c..e151a5a98b5 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -656,7 +656,8 @@ 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. */ //------------------------------------------------------------------------------------------------- LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos, const ThingTemplate *build, From f73273a936fad46fc36e572a7f9c1cf9ff1b9c67 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 24 Sep 2025 18:06:40 +1000 Subject: [PATCH 5/6] docs: Update comments --- .../Code/GameEngine/Source/Common/System/BuildAssistant.cpp | 3 ++- .../Code/GameEngine/Source/Common/System/BuildAssistant.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index c9db1a58110..81188ae2f90 100644 --- a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -657,7 +657,8 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build, //------------------------------------------------------------------------------------------------- /** Check for objects preventing building at this location. - * TheSuperHackers @tweak Stubbjax 05/09/2025 Return LBC_SHROUD for shrouded objects. */ + * 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, diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index e151a5a98b5..8acd77934e4 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -657,7 +657,8 @@ void BuildAssistant::iterateFootprint( const ThingTemplate *build, //------------------------------------------------------------------------------------------------- /** Check for objects preventing building at this location. - * TheSuperHackers @tweak Stubbjax 05/09/2025 Return LBC_SHROUD for shrouded objects. */ + * 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, From 71b2335466a9a0667d733306f6f778d6293a2e85 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Wed, 24 Sep 2025 18:10:31 +1000 Subject: [PATCH 6/6] refactor: Standardise shroud condition logic --- .../GameEngine/Source/Common/System/BuildAssistant.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 8acd77934e4..7bd79a3f112 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -875,10 +875,11 @@ 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 (them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud()) + if (shrouded) return LBC_SHROUD; TheTerrainVisual->addFactionBib(them, true); @@ -887,7 +888,7 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos // Check for overlap of his exit rectangle with my geom info if (checkHisExit && ThePartitionManager->geomCollidesWithGeom(&hisExitPos, hisGeom, them->getOrientation(), worldPos, myBounds, angle)) { - if (them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud()) + if (shrouded) return LBC_SHROUD; TheTerrainVisual->addFactionBib(them, true); @@ -896,7 +897,7 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos // Check both exit rectangles together. if (checkMyExit&&checkHisExit&&ThePartitionManager->geomCollidesWithGeom(&hisExitPos, hisGeom, them->getOrientation(), &myExitPos, myGeom, angle)) { - if (them->getDrawable() && them->getDrawable()->getFullyObscuredByShroud()) + if (shrouded) return LBC_SHROUD; TheTerrainVisual->addFactionBib(them, true);