bugfix(savegame): Restore particle system IDs before registation with ParticleSystemManager#2316
Open
stephanmeesters wants to merge 3 commits intoTheSuperHackers:mainfrom
Conversation
… ParticleSystemManager
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Source/GameClient/System/ParticleSys.cpp | Defers particle system registration with ParticleSystemManager until after system ID is restored from save data, fixing master/slave lookup failures. The fix is logically sound and well-targeted. |
Sequence Diagram
sequenceDiagram
participant SM as ParticleSystemManager::xfer
participant PS as ParticleSystem (new)
participant XF as Xfer (xferSnapshot)
Note over SM: Old (buggy) flow
SM->>SM: createParticleSystem(template, FALSE)
SM->>PS: constructor(template, m_uniqueSystemID++, FALSE)
PS->>SM: friend_addParticleSystem(this) [temp ID]
SM->>XF: xferSnapshot(system)
XF->>PS: restores real m_systemID
Note over SM: systemMap has wrong ID → lookup fails
Note over SM: New (fixed) flow
SM->>PS: constructor(template, INVALID_PARTICLE_SYSTEM_ID, FALSE)
Note over PS: Skips friend_addParticleSystem (ID is invalid)
SM->>XF: xferSnapshot(system)
XF->>PS: restores real m_systemID
SM->>SM: friend_addParticleSystem(system) [correct ID]
Note over SM: systemMap has correct ID → lookups succeed
Last reviewed commit: e962c05
xezon
requested changes
Feb 17, 2026
| DEBUG_CRASH(( "ParticleSystemManager::xfer - Unable to allocate particle system '%s'", | ||
| if( system->getSystemID() == INVALID_PARTICLE_SYSTEM_ID ) | ||
| { | ||
| DEBUG_CRASH(( "ParticleSystemManager::xfer - Unable to restore system ID to particle system '%s'", |
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.