Skip to content

bugfix(saveload): Transfer the dock approach position bone count - #3151

Draft
bobtista wants to merge 2 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/bugfix/dockupdate-approach-bones-xfer
Draft

bugfix(saveload): Transfer the dock approach position bone count#3151
bobtista wants to merge 2 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/bugfix/dockupdate-approach-bones-xfer

Conversation

@bobtista

Copy link
Copy Markdown

m_numberApproachPositionBones is not written to the save. It starts at -1 and is only assigned inside loadDockPositions(), which every call site guards with if( m_positionsLoaded == FALSE ). Since m_positionsLoaded is saved, the guard is already satisfied on load, the count is never recomputed, and it stays at -1.

computeApproachPosition tests it against 0 to decide whether a structure with no waiting bones should bias its approach point toward the caller. -1 fails that test, so the bias is silently dropped and every docker is routed to the structure centre. That covers structures with no DockWaiting bones, KINDOF_IGNORE_DOCKING_BONES structures, and dynamic approach docks, which are forced to zero bones.

Now the count travels with the flag that suppresses its recomputation, from version 2.

Measured by saving on the frame a dock finishes loading its positions, then reading the count back, with the loaded flag as a control:

version saved loaded
1 bones 0, loaded 1 bones -1, loaded 1
2 bones 0, loaded 1 bones 0, loaded 1

The loaded flag round trips in both rows, so the record is written and read either way; version 1 is byte for byte the old behaviour, which is what keeps existing saves readable.

Todo:

  • A save and load restores the approach position bone count
  • A version 1 save loads exactly as it did before the change
  • Replicate to Generals

@bobtista bobtista self-assigned this Aug 14, 2026
@bobtista bobtista added the Saveload Is Saveload/Xfer related label Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Saveload Is Saveload/Xfer related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Boneless docks lose their caller-directed approach bias after a load

1 participant