Skip to content

Commit de2f3f1

Browse files
committed
refactor: Move fix to the task resumption method
1 parent a0fbee6 commit de2f3f1

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;
@@ -2069,8 +2063,16 @@ void DozerAIUpdate::setPreviousTask(DozerTask task)
20692063
//-------------------------------------------------------------------------------------------------
20702064
void DozerAIUpdate::resumePreviousTask()
20712065
{
2072-
if (m_previousTask != DOZER_TASK_INVALID)
2066+
if (m_previousTask == DOZER_TASK_INVALID)
2067+
return;
2068+
2069+
// TheSuperHackers @bugfix Stubbjax 15/06/2026 Ignore the build task if the building is already complete.
2070+
if (m_previousTask == DOZER_TASK_BUILD)
20732071
{
2072+
Object* target = TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID);
2073+
if (target && target->getConstructionPercent() == CONSTRUCTION_COMPLETE)
2074+
return;
2075+
20742076
newTask(m_previousTask, TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID));
20752077
m_previousTask = DOZER_TASK_INVALID;
20762078
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;
@@ -724,8 +718,16 @@ void WorkerAIUpdate::setPreviousTask(DozerTask task)
724718
//-------------------------------------------------------------------------------------------------
725719
void WorkerAIUpdate::resumePreviousTask()
726720
{
727-
if (m_previousTask != DOZER_TASK_INVALID)
721+
if (m_previousTask == DOZER_TASK_INVALID)
722+
return;
723+
724+
// TheSuperHackers @bugfix Stubbjax 15/06/2026 Ignore the build task if the building is already complete.
725+
if (m_previousTask == DOZER_TASK_BUILD)
728726
{
727+
Object* target = TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID);
728+
if (target && target->getConstructionPercent() == CONSTRUCTION_COMPLETE)
729+
return;
730+
729731
newTask(m_previousTask, TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID));
730732
m_previousTask = DOZER_TASK_INVALID;
731733
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;
@@ -2074,8 +2068,16 @@ void DozerAIUpdate::setPreviousTask(DozerTask task)
20742068
//-------------------------------------------------------------------------------------------------
20752069
void DozerAIUpdate::resumePreviousTask()
20762070
{
2077-
if (m_previousTask != DOZER_TASK_INVALID)
2071+
if (m_previousTask == DOZER_TASK_INVALID)
2072+
return;
2073+
2074+
// TheSuperHackers @bugfix Stubbjax 15/06/2026 Ignore the build task if the building is already complete.
2075+
if (m_previousTask == DOZER_TASK_BUILD)
20782076
{
2077+
Object* target = TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID);
2078+
if (target && target->getConstructionPercent() == CONSTRUCTION_COMPLETE)
2079+
return;
2080+
20792081
newTask(m_previousTask, TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID));
20802082
m_previousTask = DOZER_TASK_INVALID;
20812083
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;
@@ -724,8 +718,16 @@ void WorkerAIUpdate::setPreviousTask(DozerTask task)
724718
//-------------------------------------------------------------------------------------------------
725719
void WorkerAIUpdate::resumePreviousTask()
726720
{
727-
if (m_previousTask != DOZER_TASK_INVALID)
721+
if (m_previousTask == DOZER_TASK_INVALID)
722+
return;
723+
724+
// TheSuperHackers @bugfix Stubbjax 15/06/2026 Ignore the build task if the building is already complete.
725+
if (m_previousTask == DOZER_TASK_BUILD)
728726
{
727+
Object* target = TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID);
728+
if (target && target->getConstructionPercent() == CONSTRUCTION_COMPLETE)
729+
return;
730+
729731
newTask(m_previousTask, TheGameLogic->findObjectByID(m_previousTaskInfo.m_targetObjectID));
730732
m_previousTask = DOZER_TASK_INVALID;
731733
m_previousTaskInfo = DozerTaskInfo();

0 commit comments

Comments
 (0)