Skip to content

Commit f5ccc9c

Browse files
authored
bugfix(aiupdate): Invalidate build task of Dozers and Workers if the assigned target scaffold no longer exists (#1868)
1 parent 20927af commit f5ccc9c

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,9 +1594,14 @@ UpdateSleepTime DozerAIUpdate::update( void )
15941594
Bool invalidTask = FALSE;
15951595

15961596
// validate the task and the target
1597+
// TheSuperHackers @bugfix Stubbjax 16/11/2025 Invalidate the task when the build scaffold is destroyed.
15971598
if( currentTask == DOZER_TASK_REPAIR &&
15981599
TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE )
15991600
invalidTask = TRUE;
1601+
#if !RETAIL_COMPATIBLE_CRC
1602+
else if (currentTask == DOZER_TASK_BUILD && targetObject == NULL)
1603+
invalidTask = TRUE;
1604+
#endif
16001605

16011606
// cancel the task if it's now invalid
16021607
if( invalidTask == TRUE )

Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,14 @@ UpdateSleepTime WorkerAIUpdate::update( void )
275275
Bool invalidTask = FALSE;
276276

277277
// validate the task and the target
278+
// TheSuperHackers @bugfix Stubbjax 16/11/2025 Invalidate the task when the build scaffold is destroyed.
278279
if( currentTask == DOZER_TASK_REPAIR &&
279280
TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE )
280281
invalidTask = TRUE;
282+
#if !RETAIL_COMPATIBLE_CRC
283+
else if (currentTask == DOZER_TASK_BUILD && targetObject == NULL)
284+
invalidTask = TRUE;
285+
#endif
281286

282287
// cancel the task if it's now invalid
283288
if( invalidTask == TRUE )

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,9 +1599,14 @@ UpdateSleepTime DozerAIUpdate::update( void )
15991599
Bool invalidTask = FALSE;
16001600

16011601
// validate the task and the target
1602+
// TheSuperHackers @bugfix Stubbjax 16/11/2025 Invalidate the task when the build scaffold is destroyed.
16021603
if( currentTask == DOZER_TASK_REPAIR &&
16031604
TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE )
16041605
invalidTask = TRUE;
1606+
#if !RETAIL_COMPATIBLE_CRC
1607+
else if (currentTask == DOZER_TASK_BUILD && targetObject == NULL)
1608+
invalidTask = TRUE;
1609+
#endif
16051610

16061611
// cancel the task if it's now invalid
16071612
if( invalidTask == TRUE )

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,14 @@ UpdateSleepTime WorkerAIUpdate::update( void )
275275
Bool invalidTask = FALSE;
276276

277277
// validate the task and the target
278+
// TheSuperHackers @bugfix Stubbjax 16/11/2025 Invalidate the task when the build scaffold is destroyed.
278279
if( currentTask == DOZER_TASK_REPAIR &&
279280
TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE )
280281
invalidTask = TRUE;
282+
#if !RETAIL_COMPATIBLE_CRC
283+
else if (currentTask == DOZER_TASK_BUILD && targetObject == NULL)
284+
invalidTask = TRUE;
285+
#endif
281286

282287
// cancel the task if it's now invalid
283288
if( invalidTask == TRUE )

0 commit comments

Comments
 (0)