remove unnecessary lookup checks
continuous-integration/drone/push Build is passing Details

pull/3/head
Evan Hemsley 2020-03-25 11:52:42 -07:00
parent 20d382f51a
commit df4a953628
2 changed files with 5 additions and 2 deletions

View File

@ -29,7 +29,6 @@ namespace Encompass
private TypedComponentStore<TComponent> Lookup<TComponent>() where TComponent : struct private TypedComponentStore<TComponent> Lookup<TComponent>() where TComponent : struct
{ {
RegisterComponentType<TComponent>();
return _stores[typeof(TComponent)] as TypedComponentStore<TComponent>; return _stores[typeof(TComponent)] as TypedComponentStore<TComponent>;
} }
@ -40,7 +39,7 @@ namespace Encompass
public bool Has(Type type, int entityID) public bool Has(Type type, int entityID)
{ {
return _stores.ContainsKey(type) && _stores[type].Has(entityID); return _stores[type].Has(entityID);
} }
public BitSet512 EntityBitArray(int entityID) public BitSet512 EntityBitArray(int entityID)

View File

@ -408,6 +408,10 @@ namespace Encompass
var method = typeof(WorldBuilder).GetMethod("RegisterComponentType", BindingFlags.NonPublic | BindingFlags.Instance); var method = typeof(WorldBuilder).GetMethod("RegisterComponentType", BindingFlags.NonPublic | BindingFlags.Instance);
var generic = method.MakeGenericMethod(componentType); var generic = method.MakeGenericMethod(componentType);
generic.Invoke(this, null); generic.Invoke(this, null);
var dummyRegisterMethod = typeof(ComponentManager).GetMethod("RegisterComponentType", BindingFlags.Public | BindingFlags.Instance);
var dummyGeneric = dummyRegisterMethod.MakeGenericMethod(componentType);
dummyGeneric.Invoke(dummyComponentManager, null);
} }
if (componentType.GetInterface("IDrawableComponent") != null) if (componentType.GetInterface("IDrawableComponent") != null)