bugfix: Fix cases where supply units return to collect supplies after receiving player-issued commands - #3170
Conversation
… receiving player-issued commands
PR Summary by QodoHonor Player Commands by Clearing Forced Supply Collection
AI Description
Diagram
High-Level Assessment
Files changed (8)
|
Code Review by Qodo
1. Repair commands retain supply latch
|
| #if !RETAIL_COMPATIBLE_CRC | ||
| setForceWantingState(FALSE); | ||
| #endif |
There was a problem hiding this comment.
1. Repair commands retain supply latch 🐞 Bug ≡ Correctness
WorkerAIUpdate clears m_forcePending only in aiDoCommand's default case, so player AICMD_REPAIR and AICMD_RESUME_CONSTRUCTION commands skip the reset while a newly produced worker remains AS_DOZER. Their newTask reset only runs when already AS_SUPPLY_TRUCK, allowing the production latch to switch the worker into supply mode and override the accepted task on the next update.
Agent Prompt
## Issue description
Player repair and resume-construction commands bypass the newly added supply-latch reset because they have dedicated `aiDoCommand` switch cases. Clear the force-wanting latch for every accepted player command, including these special cases, in both game variants.
## Issue Context
Production exit sets the force-wanting latch after issuing its exit path. A worker can therefore still be in `AS_DOZER` when a player command arrives; the reset in `newTask` is insufficient because it is conditional on the worker already being in `AS_SUPPLY_TRUCK`.
## Fix Focus Areas
- Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp[1002-1051]
- Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp[665-681]
- GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp[1002-1051]
- GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp[665-681]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Closes: #225 |
This change fixes an issue where supply units would remain in a collection state if given a command during their initial path out from the Supply Center/Stash. This would cause them to either outright ignore commands (such as a construct or repair command) or resume collection after going idle (such as after completing a move command).
The issue is exacerbated if the supply unit is following a rally point.
Note
Supply Workers ignoring Stop commands is a separate issue not covered by this change.
Before
BEFORE.mp4
After
AFTER.mp4