rename EcsWorld.id to EcsWorld.ID

This commit is contained in:
Mikhail 2024-10-31 16:27:53 +08:00
parent 6ff13eaf1e
commit 02834d6826
10 changed files with 88 additions and 59 deletions

View File

@ -197,7 +197,7 @@ namespace DCFApixels.DragonECS
public short WorldID public short WorldID
{ {
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return _source.id; } get { return _source.ID; }
} }
public EcsWorld World public EcsWorld World
{ {
@ -477,7 +477,7 @@ namespace DCFApixels.DragonECS
public void UnionWith(EcsSpan span) public void UnionWith(EcsSpan span)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_source.id != span.WorldID) Throw.Group_ArgumentDifferentWorldsException(); if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
#endif #endif
foreach (var entityID in span) { UnionWithStep(entityID); } foreach (var entityID in span) { UnionWithStep(entityID); }
} }
@ -525,7 +525,7 @@ namespace DCFApixels.DragonECS
public void ExceptWith(EcsSpan span) public void ExceptWith(EcsSpan span)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_source.id != span.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); } if (_source.ID != span.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
#endif #endif
foreach (var entityID in span) { ExceptWithStep_Internal(entityID); } foreach (var entityID in span) { ExceptWithStep_Internal(entityID); }
} }
@ -563,10 +563,10 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void IntersectWith(EcsReadonlyGroup group) { IntersectWith(group.GetSource_Internal()); } public void IntersectWith(EcsReadonlyGroup group) { IntersectWith(group.GetSource_Internal()); }
/// <summary>as Intersect sets</summary> /// <summary>as Intersect sets</summary>
public void IntersectWith(EcsSpan span) //TODO протестировать public void IntersectWith(EcsSpan span)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_source.id != span.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); } if (_source.ID != span.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
#endif #endif
foreach (var entityID in span) foreach (var entityID in span)
{ {
@ -621,7 +621,7 @@ namespace DCFApixels.DragonECS
public void SymmetricExceptWith(EcsSpan span) public void SymmetricExceptWith(EcsSpan span)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_source.id != span.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); } if (_source.ID != span.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
#endif #endif
foreach (var entityID in span) { SymmetricExceptWithStep_Internal(entityID); } foreach (var entityID in span) { SymmetricExceptWithStep_Internal(entityID); }
} }
@ -688,7 +688,7 @@ namespace DCFApixels.DragonECS
public bool SetEquals(EcsSpan span) public bool SetEquals(EcsSpan span)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_source.id != span.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); } if (_source.ID != span.WorldID) { Throw.Group_ArgumentDifferentWorldsException(); }
#endif #endif
if (span.Count != Count) { return false; } if (span.Count != Count) { return false; }
foreach (var entityID in span) foreach (var entityID in span)
@ -747,7 +747,7 @@ namespace DCFApixels.DragonECS
public bool Overlaps(EcsSpan span) public bool Overlaps(EcsSpan span)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_source.id != span.WorldID) Throw.Group_ArgumentDifferentWorldsException(); if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
#endif #endif
foreach (var entityID in span) foreach (var entityID in span)
{ {
@ -786,7 +786,7 @@ namespace DCFApixels.DragonECS
public bool IsSubsetOf(EcsSpan span) public bool IsSubsetOf(EcsSpan span)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_source.id != span.WorldID) Throw.Group_ArgumentDifferentWorldsException(); if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
#endif #endif
if (Count == 0) { return true; } if (Count == 0) { return true; }
if (span.Count < Count) { return false; } if (span.Count < Count) { return false; }
@ -815,7 +815,7 @@ namespace DCFApixels.DragonECS
public bool IsProperSubsetOf(EcsSpan span) public bool IsProperSubsetOf(EcsSpan span)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_source.id != span.WorldID) Throw.Group_ArgumentDifferentWorldsException(); if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
#endif #endif
if (Count == 0) { return true; } if (Count == 0) { return true; }
if (span.Count <= Count) { return false; } if (span.Count <= Count) { return false; }
@ -884,7 +884,7 @@ namespace DCFApixels.DragonECS
public bool IsSupersetOf(EcsSpan span) public bool IsSupersetOf(EcsSpan span)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_source.id != span.WorldID) Throw.Group_ArgumentDifferentWorldsException(); if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
#endif #endif
if (span.Count > Count) { return false; } if (span.Count > Count) { return false; }
return IsSupersetOf_Internal(span); return IsSupersetOf_Internal(span);
@ -910,7 +910,7 @@ namespace DCFApixels.DragonECS
public bool IsProperSupersetOf(EcsSpan span) public bool IsProperSupersetOf(EcsSpan span)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_source.id != span.WorldID) Throw.Group_ArgumentDifferentWorldsException(); if (_source.ID != span.WorldID) Throw.Group_ArgumentDifferentWorldsException();
#endif #endif
if (span.Count >= Count) { return false; } if (span.Count >= Count) { return false; }
return IsSupersetOf_Internal(span); return IsSupersetOf_Internal(span);
@ -1030,7 +1030,7 @@ namespace DCFApixels.DragonECS
public static EcsGroup Except(EcsSpan a, EcsGroup b) public static EcsGroup Except(EcsSpan a, EcsGroup b)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (a.WorldID != b._source.id) { Throw.Group_ArgumentDifferentWorldsException(); } if (a.WorldID != b._source.ID) { Throw.Group_ArgumentDifferentWorldsException(); }
#endif #endif
EcsGroup result = b._source.GetFreeGroup(); EcsGroup result = b._source.GetFreeGroup();
foreach (var entityID in a) foreach (var entityID in a)
@ -1085,7 +1085,7 @@ namespace DCFApixels.DragonECS
public static EcsGroup Intersect(EcsSpan a, EcsGroup b) public static EcsGroup Intersect(EcsSpan a, EcsGroup b)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (a.WorldID != b._source.id) { Throw.Group_ArgumentDifferentWorldsException(); } if (a.WorldID != b._source.ID) { Throw.Group_ArgumentDifferentWorldsException(); }
#endif #endif
EcsGroup result = b._source.GetFreeGroup(); EcsGroup result = b._source.GetFreeGroup();
foreach (var entityID in a) foreach (var entityID in a)

View File

@ -225,7 +225,7 @@ namespace DCFApixels.DragonECS
public Iterator(EcsMaskIterator iterator, EcsSpan span) public Iterator(EcsMaskIterator iterator, EcsSpan span)
{ {
worldID = iterator.World.id; worldID = iterator.World.ID;
_span = span; _span = span;
this.iterator = iterator.Iterate(span); this.iterator = iterator.Iterate(span);
} }

View File

@ -379,9 +379,9 @@ namespace DCFApixels.DragonECS
EmptyMask = CreateEmpty(_staticMasks.Count, world.id); EmptyMask = CreateEmpty(_staticMasks.Count, world.ID);
_staticMasks.Add(EmptyMask._staticMask.ID, EmptyMask); _staticMasks.Add(EmptyMask._staticMask.ID, EmptyMask);
BrokenMask = CreateBroken(_staticMasks.Count, world.id); BrokenMask = CreateBroken(_staticMasks.Count, world.ID);
_staticMasks.Add(BrokenMask._staticMask.ID, BrokenMask); _staticMasks.Add(BrokenMask._staticMask.ID, BrokenMask);
} }
public void Init(ref WorldMaskComponent component, EcsWorld world) public void Init(ref WorldMaskComponent component, EcsWorld world)
@ -444,7 +444,7 @@ namespace DCFApixels.DragonECS
int[] incs = ConvertTypeCodeToComponentTypeID(staticMask.IncTypeCodes, _world); int[] incs = ConvertTypeCodeToComponentTypeID(staticMask.IncTypeCodes, _world);
int[] excs = ConvertTypeCodeToComponentTypeID(staticMask.ExcTypeCodes, _world); int[] excs = ConvertTypeCodeToComponentTypeID(staticMask.ExcTypeCodes, _world);
result = new EcsMask(staticMask, _staticMasks.Count, _world.id, incs, excs); result = new EcsMask(staticMask, _staticMasks.Count, _world.ID, incs, excs);
_staticMasks.Add(staticMask.ID, result); _staticMasks.Add(staticMask.ID, result);
} }

View File

@ -355,7 +355,6 @@ namespace DCFApixels.DragonECS
return $"Inc({string.Join(", ", inc)}) Exc({string.Join(", ", exc)})"; // Release optimization return $"Inc({string.Join(", ", inc)}) Exc({string.Join(", ", exc)})"; // Release optimization
#endif #endif
} }
internal class DebuggerProxy internal class DebuggerProxy
{ {
private EcsStaticMask _source; private EcsStaticMask _source;
@ -388,28 +387,49 @@ namespace DCFApixels.DragonECS
#if DEBUG #if DEBUG
//TODO оптимизировать, так как списки сортированны, наверняка есть способ без хешсета пройтись и не локать треды //TODO оптимизировать, так как списки сортированны, наверняка есть способ без хешсета пройтись и не локать треды
private static HashSet<int> _dummyHashSet = new HashSet<int>(); private static void CheckConstraints(EcsTypeCode[] incs, EcsTypeCode[] excs)
private static void CheckConstraints(int[] inc, int[] exc)
{ {
lock (_dummyHashSet) if (CheckRepeats(incs)) { throw new EcsFrameworkException("The values in the Include constraints are repeated."); }
{ if (CheckRepeats(excs)) { throw new EcsFrameworkException("The values in the Exclude constraints are repeated."); }
if (CheckRepeats(inc)) { throw new EcsFrameworkException("The values in the Include constraints are repeated."); } if (HasCommonElements(incs, excs)) { throw new EcsFrameworkException("Conflicting Include and Exclude constraints."); }
if (CheckRepeats(exc)) { throw new EcsFrameworkException("The values in the Exclude constraints are repeated."); }
_dummyHashSet.Clear();
_dummyHashSet.UnionWith(inc);
if (_dummyHashSet.Overlaps(exc)) { throw new EcsFrameworkException("Conflicting Include and Exclude constraints."); }
}
} }
private static bool CheckRepeats(int[] array) private static bool HasCommonElements(EcsTypeCode[] a, EcsTypeCode[] b)
{ {
_dummyHashSet.Clear(); int i = 0;
foreach (var item in array) int j = 0;
while (i < a.Length && j < b.Length)
{ {
if (_dummyHashSet.Contains(item)) if (a[i] == b[j])
{
return true;
}
else if (a[i] < b[j])
{
i++;
}
else
{
j++;
}
}
return false;
}
private static bool CheckRepeats(EcsTypeCode[] array)
{
if(array.Length <= 0)
{
return false;
}
EcsTypeCode lastValue = array[0];
for (int i = 1; i < array.Length; i++)
{
EcsTypeCode value = array[i];
if(value == lastValue)
{ {
return true; return true;
} }
_dummyHashSet.Add(item); lastValue = value;
} }
return false; return false;
} }

View File

@ -42,7 +42,7 @@ namespace DCFApixels.DragonECS
[DebuggerTypeProxy(typeof(DebuggerProxy))] [DebuggerTypeProxy(typeof(DebuggerProxy))]
public partial class EcsWorld : IEntityStorage, IEcsMember public partial class EcsWorld : IEntityStorage, IEcsMember
{ {
public readonly short id; public readonly short ID;
private IConfigContainer _configs; private IConfigContainer _configs;
private bool _isDestroyed = false; private bool _isDestroyed = false;
@ -73,6 +73,12 @@ namespace DCFApixels.DragonECS
private List<IEcsEntityEventListener> _entityListeners = new List<IEcsEntityEventListener>(); private List<IEcsEntityEventListener> _entityListeners = new List<IEcsEntityEventListener>();
#region Properties #region Properties
[Obsolete("Use EcsWorld.ID")]
public short id
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return ID; }
}
EcsWorld IEntityStorage.World EcsWorld IEntityStorage.World
{ {
get { return this; } get { return this; }
@ -119,7 +125,7 @@ namespace DCFApixels.DragonECS
get get
{ {
ReleaseDelEntityBufferAll(); ReleaseDelEntityBufferAll();
return _entityDispenser.UsedToEcsSpan(id); return _entityDispenser.UsedToEcsSpan(ID);
} }
} }
public int PoolsCount public int PoolsCount
@ -166,7 +172,7 @@ namespace DCFApixels.DragonECS
Throw.Exception("The world with the specified ID has already been created\r\n"); Throw.Exception("The world with the specified ID has already been created\r\n");
} }
} }
id = worldID; ID = worldID;
_worlds[worldID] = this; _worlds[worldID] = this;
_poolsMediator = new PoolsMediator(this); _poolsMediator = new PoolsMediator(this);
@ -191,7 +197,7 @@ namespace DCFApixels.DragonECS
EcsDebug.PrintWarning("The world is already destroyed"); EcsDebug.PrintWarning("The world is already destroyed");
return; return;
} }
if (id == NULL_WORLD_ID) if (ID == NULL_WORLD_ID)
{ {
#if (DEBUG && !DISABLE_DEBUG) #if (DEBUG && !DISABLE_DEBUG)
Throw.World_WorldCantBeDestroyed(); Throw.World_WorldCantBeDestroyed();
@ -202,9 +208,9 @@ namespace DCFApixels.DragonECS
_entityDispenser = null; _entityDispenser = null;
_pools = null; _pools = null;
_nullPool = null; _nullPool = null;
_worlds[id] = null; _worlds[ID] = null;
ReleaseData(id); ReleaseData(ID);
_worldIdDispenser.Release(id); _worldIdDispenser.Release(ID);
_isDestroyed = true; _isDestroyed = true;
_poolTypeCode_2_CmpTypeIDs = null; _poolTypeCode_2_CmpTypeIDs = null;
_cmpTypeCode_2_CmpTypeIDs = null; _cmpTypeCode_2_CmpTypeIDs = null;
@ -241,12 +247,12 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public ref T Get<T>() where T : struct public ref T Get<T>() where T : struct
{ {
return ref WorldComponentPool<T>.GetForWorld(id); return ref WorldComponentPool<T>.GetForWorld(ID);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public ref T GetUnchecked<T>() where T : struct public ref T GetUnchecked<T>() where T : struct
{ {
return ref WorldComponentPool<T>.GetForWorldUnchecked(id); return ref WorldComponentPool<T>.GetForWorldUnchecked(ID);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ref T Get<T>(int worldID) where T : struct public static ref T Get<T>(int worldID) where T : struct
@ -341,18 +347,18 @@ namespace DCFApixels.DragonECS
{ {
ReleaseDelEntityBufferAll(); ReleaseDelEntityBufferAll();
} }
return _entityDispenser.UsedToEcsSpan(id); return _entityDispenser.UsedToEcsSpan(ID);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe entlong GetEntityLong(int entityID) public unsafe entlong GetEntityLong(int entityID)
{ {
long x = (long)id << 48 | (long)GetGen(entityID) << 32 | (long)entityID; long x = (long)ID << 48 | (long)GetGen(entityID) << 32 | (long)entityID;
return *(entlong*)&x; return *(entlong*)&x;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe EntitySlotInfo GetEntitySlotInfoDebug(int entityID) public unsafe EntitySlotInfo GetEntitySlotInfoDebug(int entityID)
{ {
return new EntitySlotInfo(entityID, _entities[entityID].gen, id); return new EntitySlotInfo(entityID, _entities[entityID].gen, ID);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool IsAlive(int entityID, short gen) public bool IsAlive(int entityID, short gen)
@ -392,7 +398,7 @@ namespace DCFApixels.DragonECS
public bool IsMatchesMask(EcsMask mask, int entityID) public bool IsMatchesMask(EcsMask mask, int entityID)
{ {
#if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || !DISABLE_DRAGONECS_ASSERT_CHEKS
if (mask._worldID != id) { Throw.World_MaskDoesntBelongWorld(); } if (mask._worldID != ID) { Throw.World_MaskDoesntBelongWorld(); }
#endif #endif
for (int i = 0, iMax = mask._inc.Length; i < iMax; i++) for (int i = 0, iMax = mask._inc.Length; i < iMax; i++)
{ {
@ -821,7 +827,7 @@ namespace DCFApixels.DragonECS
#region DebuggerProxy #region DebuggerProxy
private EcsSpan GetSpan_Debug() private EcsSpan GetSpan_Debug()
{ {
return _entityDispenser.UsedToEcsSpan(id); return _entityDispenser.UsedToEcsSpan(ID);
} }
protected class DebuggerProxy protected class DebuggerProxy
{ {
@ -841,7 +847,7 @@ namespace DCFApixels.DragonECS
} }
public long Version { get { return _world.Version; } } public long Version { get { return _world.Version; } }
public IEcsPool[] Pools { get { return _world._pools; } } public IEcsPool[] Pools { get { return _world._pools; } }
public short ID { get { return _world.id; } } public short ID { get { return _world.ID; } }
public DebuggerProxy(EcsWorld world) public DebuggerProxy(EcsWorld world)
{ {
_world = world; _world = world;

View File

@ -28,7 +28,7 @@ namespace DCFApixels.DragonECS
public short WorldID public short WorldID
{ {
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return _source.id; } get { return _source.ID; }
} }
public EcsWorld World public EcsWorld World
{ {

View File

@ -58,7 +58,7 @@ namespace DCFApixels.DragonECS.Internal
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (span.IsNull) { Throw.ArgumentNull(nameof(span)); } if (span.IsNull) { Throw.ArgumentNull(nameof(span)); }
if (span.WorldID != World.id) { Throw.Quiery_ArgumentDifferentWorldsException(); } if (span.WorldID != World.ID) { Throw.Quiery_ArgumentDifferentWorldsException(); }
#endif #endif
if (_filteredEntities == null) if (_filteredEntities == null)
{ {
@ -71,13 +71,13 @@ namespace DCFApixels.DragonECS.Internal
public EcsSpan Execute() public EcsSpan Execute()
{ {
Execute_Iternal(); Execute_Iternal();
return new EcsSpan(World.id, _filteredAllEntities, _filteredAllEntitiesCount); return new EcsSpan(World.ID, _filteredAllEntities, _filteredAllEntitiesCount);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public EcsSpan ExecuteFor(EcsSpan span) public EcsSpan ExecuteFor(EcsSpan span)
{ {
ExecuteFor_Iternal(span); ExecuteFor_Iternal(span);
return new EcsSpan(World.id, _filteredEntities, _filteredEntitiesCount); return new EcsSpan(World.ID, _filteredEntities, _filteredEntitiesCount);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
@ -85,14 +85,14 @@ namespace DCFApixels.DragonECS.Internal
{ {
Execute_Iternal(); Execute_Iternal();
ArraySortHalperX<int>.Sort(_filteredAllEntities, comparison, _filteredAllEntitiesCount); ArraySortHalperX<int>.Sort(_filteredAllEntities, comparison, _filteredAllEntitiesCount);
return new EcsSpan(World.id, _filteredAllEntities, _filteredAllEntitiesCount); return new EcsSpan(World.ID, _filteredAllEntities, _filteredAllEntitiesCount);
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public EcsSpan ExecuteFor(EcsSpan span, Comparison<int> comparison) public EcsSpan ExecuteFor(EcsSpan span, Comparison<int> comparison)
{ {
ExecuteFor_Iternal(span); ExecuteFor_Iternal(span);
ArraySortHalperX<int>.Sort(_filteredEntities, comparison, _filteredEntitiesCount); ArraySortHalperX<int>.Sort(_filteredEntities, comparison, _filteredEntitiesCount);
return new EcsSpan(World.id, _filteredEntities, _filteredEntitiesCount); return new EcsSpan(World.ID, _filteredEntities, _filteredEntitiesCount);
} }
#endregion #endregion
} }

View File

@ -57,7 +57,7 @@ namespace DCFApixels.DragonECS.Internal
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (span.IsNull) { Throw.ArgumentNull(nameof(span)); } if (span.IsNull) { Throw.ArgumentNull(nameof(span)); }
if (span.WorldID != World.id) { Throw.Quiery_ArgumentDifferentWorldsException(); } if (span.WorldID != World.ID) { Throw.Quiery_ArgumentDifferentWorldsException(); }
#endif #endif
if (_filteredGroup == null) if (_filteredGroup == null)
{ {

View File

@ -1,4 +1,7 @@
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS
{ {
public enum EcsTypeCode : int { } public enum EcsTypeCode : int
{
NULL = 0,
}
} }

View File

@ -9,13 +9,13 @@ namespace DCFApixels.DragonECS
public static int NewEntity(this EcsWorld world, ITemplateNode template) public static int NewEntity(this EcsWorld world, ITemplateNode template)
{ {
int e = world.NewEntity(); int e = world.NewEntity();
template.Apply(world.id, e); template.Apply(world.ID, e);
return e; return e;
} }
public static entlong NewEntityLong(this EcsWorld world, ITemplateNode template) public static entlong NewEntityLong(this EcsWorld world, ITemplateNode template)
{ {
entlong e = world.NewEntityLong(); entlong e = world.NewEntityLong();
template.Apply(world.id, e.ID); template.Apply(world.ID, e.ID);
return e; return e;
} }
} }