fix bug when doing pending and existing read
parent
5dd923e07a
commit
8b9a778bfd
|
@ -69,7 +69,7 @@ namespace Encompass
|
||||||
|
|
||||||
internal void AddExistingComponentMessage<TComponent>(ComponentMessage<TComponent> componentMessage) where TComponent : struct, IComponent
|
internal void AddExistingComponentMessage<TComponent>(ComponentMessage<TComponent> componentMessage) where TComponent : struct, IComponent
|
||||||
{
|
{
|
||||||
RegisterExistingOrPendingComponentMessage(componentMessage.componentID, componentMessage.component);
|
RegisterExistingOrPendingComponentMessage(componentMessage.entity, componentMessage.componentID, componentMessage.component);
|
||||||
|
|
||||||
if (!componentMessageTypeToExistingComponentIDs.ContainsKey(typeof(TComponent)))
|
if (!componentMessageTypeToExistingComponentIDs.ContainsKey(typeof(TComponent)))
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,7 @@ namespace Encompass
|
||||||
|
|
||||||
internal void AddPendingComponentMessage<TComponent>(PendingComponentMessage<TComponent> pendingComponentMessage) where TComponent : struct, IComponent
|
internal void AddPendingComponentMessage<TComponent>(PendingComponentMessage<TComponent> pendingComponentMessage) where TComponent : struct, IComponent
|
||||||
{
|
{
|
||||||
RegisterExistingOrPendingComponentMessage(pendingComponentMessage.componentID, pendingComponentMessage.component);
|
RegisterExistingOrPendingComponentMessage(pendingComponentMessage.entity, pendingComponentMessage.componentID, pendingComponentMessage.component);
|
||||||
|
|
||||||
if (!componentMessageTypeToPendingComponentIDs.ContainsKey(typeof(TComponent)))
|
if (!componentMessageTypeToPendingComponentIDs.ContainsKey(typeof(TComponent)))
|
||||||
{
|
{
|
||||||
|
@ -113,14 +113,26 @@ namespace Encompass
|
||||||
entityToTypeToPendingComponentIDs[pendingComponentMessage.entity][typeof(TComponent)].Add(pendingComponentMessage.componentID);
|
entityToTypeToPendingComponentIDs[pendingComponentMessage.entity][typeof(TComponent)].Add(pendingComponentMessage.componentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RegisterExistingOrPendingComponentMessage<TComponent>(Guid componentID, TComponent component) where TComponent: struct, IComponent
|
private void RegisterExistingOrPendingComponentMessage<TComponent>(Entity entity, Guid componentID, TComponent component) where TComponent: struct, IComponent
|
||||||
{
|
{
|
||||||
componentIDToComponent[componentID] = component;
|
componentIDToComponent[componentID] = component;
|
||||||
|
|
||||||
if (!componentMessageTypeToComponentIDs.ContainsKey(typeof(TComponent)))
|
if (!componentMessageTypeToComponentIDs.ContainsKey(typeof(TComponent)))
|
||||||
{
|
{
|
||||||
componentMessageTypeToComponentIDs.Add(typeof(TComponent), new HashSet<Guid>());
|
componentMessageTypeToComponentIDs.Add(typeof(TComponent), new HashSet<Guid>());
|
||||||
}
|
}
|
||||||
componentMessageTypeToComponentIDs[typeof(TComponent)].Add(componentID);
|
componentMessageTypeToComponentIDs[typeof(TComponent)].Add(componentID);
|
||||||
|
|
||||||
|
if (!entityToTypeToComponentIDs.ContainsKey(entity))
|
||||||
|
{
|
||||||
|
entityToTypeToComponentIDs.Add(entity, new Dictionary<Type, HashSet<Guid>>());
|
||||||
|
}
|
||||||
|
if (!entityToTypeToComponentIDs[entity].ContainsKey(typeof(TComponent)))
|
||||||
|
{
|
||||||
|
entityToTypeToComponentIDs[entity].Add(typeof(TComponent), new HashSet<Guid>());
|
||||||
|
}
|
||||||
|
|
||||||
|
entityToTypeToComponentIDs[entity][typeof(TComponent)].Add(componentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// general component reads by type
|
// general component reads by type
|
||||||
|
|
Loading…
Reference in New Issue