bugfix(savegame): Restore particle system IDs before registation with ParticleSystemManager#2316
Open
stephanmeesters wants to merge 1 commit intoTheSuperHackers:mainfrom
Conversation
… ParticleSystemManager
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Source/GameClient/System/ParticleSys.cpp | Fixes savegame particle system ID mismatch by deferring registration with ParticleSystemManager until after xferSnapshot restores the real system ID. Constructor guard and MAX safeguard for m_uniqueSystemID are both correct and backward-compatible. |
Sequence Diagram
sequenceDiagram
participant XM as ParticleSystemManager::xfer
participant PS as ParticleSystem (constructor)
participant XS as xferSnapshot
participant PM as ParticleSystemManager (map)
Note over XM: Before Fix (broken)
XM->>PS: createParticleSystem(template) → assigns temp ID
PS->>PM: friend_addParticleSystem(this) with temp ID
XM->>XS: xferSnapshot(system) → restores real ID
Note over PM: Map has temp ID → system, but system now has real ID
XM->>PM: findParticleSystem(realID) → FAILS ❌
Note over XM: After Fix (correct)
XM->>PS: new ParticleSystem(template, INVALID_ID) → skips registration
XM->>XS: xferSnapshot(system) → restores real ID
XM->>XM: validate system ID != INVALID
XM->>PM: friend_addParticleSystem(system) with real ID
XM->>PM: findParticleSystem(realID) → SUCCESS ✓
Last reviewed commit: 7cbe0ab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some savegames would error due to being unable to reconnect master/slave systems to a particle system.
This appeared to be caused because during xfer of the ParticleSystemManager, the particle systems would initially be assigned with a new (temporary) system ID, and only moments later be properly restored with xferSnapshot and receive the real system ID. However, particle systems were registered with ParticleSystemManager using this old invalid ID, which would cause lookup failures later.
The fix here is to defer the registration of particle systems with ParticleSystemManager until the system ID has been properly restored.