Skip to content

Commit bdf1ab1

Browse files
committed
refactor: Move fix to the task resumption method
1 parent e95478d commit bdf1ab1

4 files changed

Lines changed: 36 additions & 28 deletions

File tree

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,13 +2000,7 @@ void DozerAIUpdate::newTask( DozerTask task, Object *target )
20002000
// multiple dozers/workers to double up on construction efforts
20012001
//
20022002
if( task == DOZER_TASK_BUILD )
2003-
{
2004-
// TheSuperHackers @bugfix Stubbjax 15/06/2026 Ignore the build task if the building is already complete.
2005-
if (target->getConstructionPercent() == CONSTRUCTION_COMPLETE)
2006-
return;
2007-
20082003
target->setBuilder( me );
2009-
}
20102004

20112005
m_dockPoint[ task ][ DOZER_DOCK_POINT_START ].valid = TRUE;
20122006
m_dockPoint[ task ][ DOZER_DOCK_POINT_START ].location = position;
@@ -2072,8 +2066,16 @@ void DozerAIUpdate::setPreviousTask(DozerTask task)
20722066
//-------------------------------------------------------------------------------------------------
20732067
void DozerAIUpdate::resumePreviousTask()
20742068
{
2075-
if (m_previousTask != DOZER_TASK_INVALID)
2069+
if (m_previousTask == DOZER_TASK_INVALID)
2070+
return;
2071+
2072+
// TheSuperHackers @bugfix Stubbjax 15/06/2026 Ignore the build task if the building is already complete.
2073+
if (m_previousTask == DOZER_TASK_BUILD)
20762074
{
2075+
Object* target = TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID);
2076+
if (target && target->getConstructionPercent() == CONSTRUCTION_COMPLETE)
2077+
return;
2078+
20772079
newTask(m_previousTask, TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID));
20782080
m_previousTask = DOZER_TASK_INVALID;
20792081
m_previousTaskInfo = DozerTaskInfo();

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -644,13 +644,7 @@ void WorkerAIUpdate::newTask( DozerTask task, Object* target )
644644
// multiple dozers/workers to double up on construction efforts
645645
//
646646
if( task == DOZER_TASK_BUILD )
647-
{
648-
// TheSuperHackers @bugfix Stubbjax 15/06/2026 Ignore the build task if the building is already complete.
649-
if (target->getConstructionPercent() == CONSTRUCTION_COMPLETE)
650-
return;
651-
652647
target->setBuilder( me );
653-
}
654648

655649
m_dockPoint[ task ][ DOZER_DOCK_POINT_START ].valid = TRUE;
656650
m_dockPoint[ task ][ DOZER_DOCK_POINT_START ].location = position;
@@ -727,8 +721,16 @@ void WorkerAIUpdate::setPreviousTask(DozerTask task)
727721
//-------------------------------------------------------------------------------------------------
728722
void WorkerAIUpdate::resumePreviousTask()
729723
{
730-
if (m_previousTask != DOZER_TASK_INVALID)
724+
if (m_previousTask == DOZER_TASK_INVALID)
725+
return;
726+
727+
// TheSuperHackers @bugfix Stubbjax 15/06/2026 Ignore the build task if the building is already complete.
728+
if (m_previousTask == DOZER_TASK_BUILD)
731729
{
730+
Object* target = TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID);
731+
if (target && target->getConstructionPercent() == CONSTRUCTION_COMPLETE)
732+
return;
733+
732734
newTask(m_previousTask, TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID));
733735
m_previousTask = DOZER_TASK_INVALID;
734736
m_previousTaskInfo = DozerTaskInfo();

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,13 +2005,7 @@ void DozerAIUpdate::newTask( DozerTask task, Object *target )
20052005
// multiple dozers/workers to double up on construction efforts
20062006
//
20072007
if( task == DOZER_TASK_BUILD )
2008-
{
2009-
// TheSuperHackers @bugfix Stubbjax 15/06/2026 Ignore the build task if the building is already complete.
2010-
if (target->getConstructionPercent() == CONSTRUCTION_COMPLETE)
2011-
return;
2012-
20132008
target->setBuilder( me );
2014-
}
20152009

20162010
m_dockPoint[ task ][ DOZER_DOCK_POINT_START ].valid = TRUE;
20172011
m_dockPoint[ task ][ DOZER_DOCK_POINT_START ].location = position;
@@ -2077,8 +2071,16 @@ void DozerAIUpdate::setPreviousTask(DozerTask task)
20772071
//-------------------------------------------------------------------------------------------------
20782072
void DozerAIUpdate::resumePreviousTask()
20792073
{
2080-
if (m_previousTask != DOZER_TASK_INVALID)
2074+
if (m_previousTask == DOZER_TASK_INVALID)
2075+
return;
2076+
2077+
// TheSuperHackers @bugfix Stubbjax 15/06/2026 Ignore the build task if the building is already complete.
2078+
if (m_previousTask == DOZER_TASK_BUILD)
20812079
{
2080+
Object* target = TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID);
2081+
if (target && target->getConstructionPercent() == CONSTRUCTION_COMPLETE)
2082+
return;
2083+
20822084
newTask(m_previousTask, TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID));
20832085
m_previousTask = DOZER_TASK_INVALID;
20842086
m_previousTaskInfo = DozerTaskInfo();

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -644,13 +644,7 @@ void WorkerAIUpdate::newTask( DozerTask task, Object* target )
644644
// multiple dozers/workers to double up on construction efforts
645645
//
646646
if( task == DOZER_TASK_BUILD )
647-
{
648-
// TheSuperHackers @bugfix Stubbjax 15/06/2026 Ignore the build task if the building is already complete.
649-
if (target->getConstructionPercent() == CONSTRUCTION_COMPLETE)
650-
return;
651-
652647
target->setBuilder( me );
653-
}
654648

655649
m_dockPoint[ task ][ DOZER_DOCK_POINT_START ].valid = TRUE;
656650
m_dockPoint[ task ][ DOZER_DOCK_POINT_START ].location = position;
@@ -727,8 +721,16 @@ void WorkerAIUpdate::setPreviousTask(DozerTask task)
727721
//-------------------------------------------------------------------------------------------------
728722
void WorkerAIUpdate::resumePreviousTask()
729723
{
730-
if (m_previousTask != DOZER_TASK_INVALID)
724+
if (m_previousTask == DOZER_TASK_INVALID)
725+
return;
726+
727+
// TheSuperHackers @bugfix Stubbjax 15/06/2026 Ignore the build task if the building is already complete.
728+
if (m_previousTask == DOZER_TASK_BUILD)
731729
{
730+
Object* target = TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID);
731+
if (target && target->getConstructionPercent() == CONSTRUCTION_COMPLETE)
732+
return;
733+
732734
newTask(m_previousTask, TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID));
733735
m_previousTask = DOZER_TASK_INVALID;
734736
m_previousTaskInfo = DozerTaskInfo();

0 commit comments

Comments
 (0)