Skip to content

bugfix(saveload): Restore dock approach position reached flags on load - #3117

Draft
bobtista wants to merge 1 commit into
TheSuperHackers:mainfrom
bobtista:bobtista/bugfix/dockupdate-approach-position-reached
Draft

bugfix(saveload): Restore dock approach position reached flags on load#3117
bobtista wants to merge 1 commit into
TheSuperHackers:mainfrom
bobtista:bobtista/bugfix/dockupdate-approach-position-reached

Conversation

@bobtista

Copy link
Copy Markdown

DockUpdate::xfer reads each m_approachPositionReached entry into a local Bool and passes its address to xferBool. BoolVector is std::vector<bool>, whose operator[] returns a proxy rather than a reference, so on load the value is written into the local and discarded and the vector keeps the false entries left by resize(). m_approachPositionOwners is restored correctly, so after loading the dock still holds its approach slots while every reached flag reads false. isClearToAdvance never returns true and DockUpdate::update never finds a position to promote to m_activeDocker, and the flags are only set by onApproachReached, which fires from AIDockApproachState::onExit and will not fire again for a unit that is already waiting.

Now the unpacked value is written back into the vector after the xfer, so the reached flags survive a save and load and the queue keeps running. This does not change the save layout, so existing saves still load.

Todo:

  • Verify in skirmish: save with a worker docked and another queued, load, confirm the queued worker docks
  • Replicate to Generals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Units queued at a dock never dock again after loading a save

1 participant