fix not allowing same engine to write twice
continuous-integration/drone/push Build is passing Details

pull/3/head
Evan Hemsley 2020-03-21 22:53:05 -07:00
parent 150043b0e5
commit e3d8f42bd9
1 changed files with 3 additions and 3 deletions

View File

@ -35,7 +35,7 @@ namespace Encompass
public bool Set(int entityID, in TComponent component, int priority) public bool Set(int entityID, in TComponent component, int priority)
{ {
if (!_priorities.ContainsKey(entityID) || priority < _priorities[entityID]) if (!_priorities.ContainsKey(entityID) || priority <= _priorities[entityID]) // if priorities are equal that means it's the same engine
{ {
InternalSet(entityID, component); InternalSet(entityID, component);
_priorities[entityID] = priority; _priorities[entityID] = priority;
@ -45,7 +45,7 @@ namespace Encompass
return false; return false;
} }
private unsafe void InternalSet(int entityID, in TComponent component) private void InternalSet(int entityID, in TComponent component)
{ {
if (!_indices.ContainsKey(entityID)) if (!_indices.ContainsKey(entityID))
{ {
@ -57,7 +57,7 @@ namespace Encompass
public override bool Remove(int entityID, int priority) public override bool Remove(int entityID, int priority)
{ {
if (!_priorities.ContainsKey(entityID) || priority < _priorities[entityID]) if (!_priorities.ContainsKey(entityID) || priority <= _priorities[entityID]) // if priorities are equal that means it's the same engine
{ {
_priorities[entityID] = priority; _priorities[entityID] = priority;
ForceRemove(entityID); ForceRemove(entityID);