-
Notifications
You must be signed in to change notification settings - Fork 150
bugfix(ghostobject): Add Ghost Objects of the local player to the scene correctly after loading a savegame #2186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…oading a savegame
Greptile Overview
|
| Filename | Overview |
|---|---|
| Generals/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp | Moved ghost object scene addition logic from xfer() to loadPostProcess() with proper local player filtering |
| GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp | Moved ghost object scene addition logic from xfer() to loadPostProcess() with proper local player filtering |
Sequence Diagram
sequenceDiagram
participant Save as Savegame System
participant Xfer as Xfer (Load)
participant Ghost as W3DGhostObject
participant Scene as 3D Scene
participant Parent as Parent Object
Note over Save,Parent: Loading Savegame Process
Save->>Xfer: Load savegame data
Xfer->>Ghost: xfer(xfer)
Note over Ghost: Loop through all players
Ghost->>Ghost: Create snapshots for ALL players
Note over Ghost: ❌ OLD: Added ALL snapshots to scene<br/>✅ NEW: Only create snapshots, don't add
Xfer->>Ghost: loadPostProcess()
Ghost->>Ghost: Get local player index
Ghost->>Ghost: addToScene(localPlayerIndex)
alt Snapshot added for local player
Ghost->>Scene: Add local player's snapshot
Scene-->>Ghost: Success
Ghost->>Parent: removeParentObject()
Note over Parent: Remove real object<br/>since ghost is visible
else No snapshot for local player
Note over Ghost: Keep real object in scene
end
Skyaero42
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good - I haven't tested it though.
|
Replicated in Generals without conflicts. I did another pass on the code comment and preserved the EA comments. |


This change fixes wrong ghost objects shown after loading a savegame.
This happened because the original Xfer code added ALL ghost objects to scene, including those that do not belong to the local player.
This issue does not happen in Retail Game, because it did not record snapshots for all players and was disabled behind the
DEBUG_FOG_MEMORYmacro. We enabled this functionality with #1569 so that we can track the ghost objects for all players.I moved the fix to
loadPostProcessbecause that is a cleaner location for it.TODO