Skip to content

bugfix(saveload): Restore dock approach bone count after loading - #3151

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

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

Conversation

@bobtista

@bobtista bobtista commented Aug 14, 2026 •

Copy link
Copy Markdown

Closes #3150. Extracted from #2152.

Loading a save loses the dock approach bone count, but keeps the flag saying the positions are already loaded. Supply docks and buildings can then skip the approach offset toward arriving workers or trucks, slowing gathering across repeated trips.

Now calls loadDockPositions() after loading when the positions were already loaded. This restores the missing count in existing saves without changing the save format. Applied to Generals and Zero Hour.

Saved state Before loading fix After loading fix
bones 0, loaded 1 bones -1, loaded 1 bones 0, loaded 1

Tested on seven Zero Hour saves using the local integration build. All 41 loaded docks, including 13 occupied docks, retained identical docking positions after recomputation and recovered the missing count.

Related: #3117 fixes another missing field writeback in the same function.

@bobtista
bobtista force-pushed the bobtista/bugfix/dockupdate-approach-bones-xfer branch from c6b3c56 to 5d919e8 Compare September 14, 2026 21:07
Comment thread Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp Outdated
@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: a1013cab-1747-48a1-be6b-50397a0d8d0f

📥 Commits

Reviewing files that changed from the base of the PR and between 4d1d84b and bf43c4d.

📒 Files selected for processing (2)
  • Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp
  • GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp
  • GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

DockUpdate::xfer in GeneralsMD selects transfer version 1 for retail-compatible saves and version 2 otherwise. Version 2 and later transfer m_numberApproachPositionBones; version 1 skips it. Generals changes the comment for that field.

Changes

DockUpdate save transfer

Layer / File(s) Summary
Transfer version selection and bone-count handling
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp, Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp
GeneralsMD selects version 1 for retail-compatible saves and version 2 otherwise. It transfers m_numberApproachPositionBones only for version 2 and later. Generals updates the comment above the field transfer.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: caball009

Merge Risk: 🟡 Moderate · up to bf43c

Loading an older save and saving it again can preserve incorrect dock approach behavior. Correct the legacy-load path before merging, unless this risk is explicitly accepted.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #3150 requires the dock approach position bone count to survive save/load. The PR transfers m_numberApproachPositionBones in version 2 in both Generals and GeneralsMD. It keeps version 1 f…
Out of Scope Changes check ✅ Passed The changes are limited to DockUpdate::xfer in the two code variants named by Issue #3150. Transfer versioning, compatibility handling, and bone-count serialization directly address the reported sav…
Title check ✅ Passed The title clearly identifies the save/load bug and the restored dock approach bone count. It accurately summarizes the primary change.
Description check ✅ Passed The description directly explains the missing bone count, the save/load impact, the compatibility behavior, and the reported testing results.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 69109dbf-5afc-4b1b-98e3-9ea9aeb4ae68

📥 Commits

Reviewing files that changed from the base of the PR and between bfa3bbf and d802721.

📒 Files selected for processing (2)
  • Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp
  • GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

/** Xfer Method
* Version Info:
* 1: Initial version
* 2: Save the approach position bone count. */

@Caball009 Caball009 Sep 27, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use a TSH comment for xfer changes (see other xfer changes for reference if needed).

@bobtista
bobtista marked this pull request as ready for review September 27, 2026 22:41
@greptile-apps

greptile-apps Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Fixes dock loading to recompute approach bone count.

The PR appears safe to merge; no actionable new issue was identified.

Summary

The PR restores the unsaved dock approach-bone count after loading in Generals and Zero Hour, without changing the save format. Since the previous review, it adds comments documenting that the count is recomputed.

Reviews (3) · Last reviewed commit: "docs(generals): Explain approach bone co..."

xezon
xezon previously approved these changes Sep 29, 2026
Comment thread Generals/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/DockUpdate.cpp Outdated
@xezon
xezon self-requested a review September 29, 2026 17:09
@xezon
xezon dismissed their stale review September 29, 2026 17:10

Premature approval.

@bobtista bobtista changed the title bugfix(saveload): Transfer the dock approach position bone count bugfix(saveload): Restore dock approach bone count after loading Sep 30, 2026

@xezon xezon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok cool

xfer->xferCoord3D( &m_exitPosition );

// # approach positions
xfer->xferInt( &m_numberApproachPositions );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest add a comment behind m_numberApproachPositionBones in the header that it needs no xfer serialization.

Or add it somewhere here if that is a better fit.

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

3 participants