From b958d867d38053377c9f5c798661a134993b1bae Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Sun, 16 Nov 2025 22:12:07 +1100 Subject: [PATCH 1/2] bugfix: Invalidate current dozer build task if the target scaffold no longer exists --- .../Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp | 4 ++++ .../GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp | 4 ++++ .../Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp | 4 ++++ .../GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index d5371bd9a3..0617dec83c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -1599,6 +1599,10 @@ UpdateSleepTime DozerAIUpdate::update( void ) if( currentTask == DOZER_TASK_REPAIR && TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE ) invalidTask = TRUE; +#if !RETAIL_COMPATIBLE_CRC + else if (currentTask == DOZER_TASK_BUILD && targetObject == NULL) + invalidTask = TRUE; +#endif // cancel the task if it's now invalid if( invalidTask == TRUE ) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp index 7b2dfd9eec..44d11ad4ad 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp @@ -283,6 +283,10 @@ UpdateSleepTime WorkerAIUpdate::update( void ) if( currentTask == DOZER_TASK_REPAIR && TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE ) invalidTask = TRUE; +#if !RETAIL_COMPATIBLE_CRC + else if (currentTask == DOZER_TASK_BUILD && targetObject == NULL) + invalidTask = TRUE; +#endif // cancel the task if it's now invalid if( invalidTask == TRUE ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index ea9d64c9a2..651202dd6b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -1604,6 +1604,10 @@ UpdateSleepTime DozerAIUpdate::update( void ) if( currentTask == DOZER_TASK_REPAIR && TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE ) invalidTask = TRUE; +#if !RETAIL_COMPATIBLE_CRC + else if (currentTask == DOZER_TASK_BUILD && targetObject == NULL) + invalidTask = TRUE; +#endif // cancel the task if it's now invalid if( invalidTask == TRUE ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp index a3bdd0628a..15e1af6b76 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp @@ -283,6 +283,10 @@ UpdateSleepTime WorkerAIUpdate::update( void ) if( currentTask == DOZER_TASK_REPAIR && TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE ) invalidTask = TRUE; +#if !RETAIL_COMPATIBLE_CRC + else if (currentTask == DOZER_TASK_BUILD && targetObject == NULL) + invalidTask = TRUE; +#endif // cancel the task if it's now invalid if( invalidTask == TRUE ) From 7e9268651ff2ac316559c3de7b1a70a37de0ce52 Mon Sep 17 00:00:00 2001 From: Stubbjax Date: Mon, 22 Dec 2025 08:34:42 +1100 Subject: [PATCH 2/2] docs: Add comments --- .../Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp | 1 + .../Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index 0617dec83c..315a62c1db 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -1596,6 +1596,7 @@ UpdateSleepTime DozerAIUpdate::update( void ) Bool invalidTask = FALSE; // validate the task and the target + // TheSuperHackers @bugfix Stubbjax 16/11/2025 Invalidate the task when the build scaffold is destroyed. if( currentTask == DOZER_TASK_REPAIR && TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE ) invalidTask = TRUE; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp index 651202dd6b..4065a2ba3b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DozerAIUpdate.cpp @@ -1601,6 +1601,7 @@ UpdateSleepTime DozerAIUpdate::update( void ) Bool invalidTask = FALSE; // validate the task and the target + // TheSuperHackers @bugfix Stubbjax 16/11/2025 Invalidate the task when the build scaffold is destroyed. if( currentTask == DOZER_TASK_REPAIR && TheActionManager->canRepairObject( getObject(), targetObject, getLastCommandSource() ) == FALSE ) invalidTask = TRUE;