Skip to content

Commit 0d24baa

Browse files
committed
bugfix: Move shrouded check below ignored conditions to resolve desync issues and stuck AI
1 parent fa83ef7 commit 0d24baa

File tree

2 files changed

+16
-20
lines changed

2 files changed

+16
-20
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -670,11 +670,6 @@ Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos,
670670
MemoryPoolObjectHolder hold(iter);
671671
for( them = iter->first(); them; them = iter->next() )
672672
{
673-
#if !RETAIL_COMPATIBLE_CRC
674-
if (builderObject && them->getShroudedStatus(builderObject->getControllingPlayer()->getPlayerIndex()) >= OBJECTSHROUD_FOGGED)
675-
return false;
676-
#endif
677-
678673
// ignore any kind of class of objects that we will "remove" for building
679674
if( isRemovableForConstruction( them ) == TRUE )
680675
continue;
@@ -688,6 +683,9 @@ Bool BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos,
688683
if (them->isKindOf(KINDOF_INERT))
689684
continue;
690685

686+
if (builderObject && them->getShroudedStatus(builderObject->getControllingPlayer()->getPlayerIndex()) >= OBJECTSHROUD_FOGGED)
687+
return LBC_SHROUD;
688+
691689
// an immobile object may obstruct our building depending on flags.
692690
if( them->isKindOf( KINDOF_IMMOBILE ) ) {
693691
if (onlyCheckEnemies && builderObject && builderObject->getRelationship( them ) != ENEMIES ) {

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

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -670,11 +670,6 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos
670670
MemoryPoolObjectHolder hold(iter);
671671
for( them = iter->first(); them; them = iter->next() )
672672
{
673-
#if !RETAIL_COMPATIBLE_CRC
674-
if (builderObject && them->getShroudedStatus(builderObject->getControllingPlayer()->getPlayerIndex()) >= OBJECTSHROUD_FOGGED)
675-
return LBC_SHROUD;
676-
#endif
677-
678673
Bool feedbackWithFailure = TRUE;
679674
Relationship rel = builderObject ? builderObject->getRelationship( them ) : NEUTRAL;
680675

@@ -697,16 +692,6 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos
697692
}
698693
}
699694

700-
//Kris: Patch 1.01 - November 5, 2003
701-
//Prevent busy units (black lotus hacking from being moved by trying to place a building -- exploit).
702-
if( rel == ALLIES )
703-
{
704-
if( them->testStatus( OBJECT_STATUS_IS_USING_ABILITY ) || them->getAI() && them->getAI()->isBusy() )
705-
{
706-
return LBC_OBJECTS_IN_THE_WAY;
707-
}
708-
}
709-
710695
// ignore any kind of class of objects that we will "remove" for building
711696
if( isRemovableForConstruction( them ) == TRUE )
712697
continue;
@@ -720,6 +705,19 @@ LegalBuildCode BuildAssistant::isLocationClearOfObjects( const Coord3D *worldPos
720705
if (them->isKindOf(KINDOF_INERT))
721706
continue;
722707

708+
if (builderObject && them->getShroudedStatus(builderObject->getControllingPlayer()->getPlayerIndex()) >= OBJECTSHROUD_FOGGED)
709+
return LBC_SHROUD;
710+
711+
//Kris: Patch 1.01 - November 5, 2003
712+
//Prevent busy units (black lotus hacking from being moved by trying to place a building -- exploit).
713+
if (rel == ALLIES)
714+
{
715+
if (them->testStatus(OBJECT_STATUS_IS_USING_ABILITY) || them->getAI() && them->getAI()->isBusy())
716+
{
717+
return LBC_OBJECTS_IN_THE_WAY;
718+
}
719+
}
720+
723721
// an immobile object may obstruct our building depending on flags.
724722
if( them->isKindOf( KINDOF_IMMOBILE ) )
725723
{

0 commit comments

Comments
 (0)