Skip to content

Commit

Permalink
Fix dyanmic spawned entities id duplicating #32
Browse files Browse the repository at this point in the history
  • Loading branch information
Arkensor committed Feb 12, 2024
1 parent ffd000c commit 9df4edf
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/Scripts/Game/EPF_PersistentRootEntityCollection.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,8 @@ class EPF_PersistentRootEntityCollection : EPF_MetaDataDbEntity
{
if (EPF_BitFlags.CheckFlags(persistenceComponent.GetFlags(), EPF_EPersistenceFlags.BAKED))
{
// TODO refactor to use https://feedback.bistudio.com/T172042 when patched
int idx = m_aRemovedBackedRootEntities.Find(persistentId);
if (idx != -1)
{
m_aRemovedBackedRootEntities.Remove(idx);
if (m_aRemovedBackedRootEntities.RemoveItem(persistentId))
return;
}
}

EPF_PersistenceComponentClass settings = EPF_ComponentData<EPF_PersistenceComponentClass>.Get(persistenceComponent);
Expand All @@ -37,11 +32,13 @@ class EPF_PersistentRootEntityCollection : EPF_MetaDataDbEntity
array<string> ids = m_mSelfSpawnDynamicEntities.Get(settings.m_tSaveDataType);
if (!ids)
{
ids = {};
ids = {persistentId};
m_mSelfSpawnDynamicEntities.Set(settings.m_tSaveDataType, ids);
return;
}

ids.Insert(persistentId);

if (!ids.Contains(persistentId))
ids.Insert(persistentId);
}

//------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit 9df4edf

Please sign in to comment.