Merge branch 'dev' into next_version

This commit is contained in:
DCFApixels 2025-04-21 21:22:12 +08:00
commit 5c80c13924
9 changed files with 18 additions and 11 deletions

View File

@ -185,7 +185,7 @@ namespace DCFApixels.DragonECS
public bool IsCollidingID(string id) public bool IsCollidingID(string id)
{ {
if(_collidingIDs== null) if (_collidingIDs == null)
{ {
return false; return false;
} }

View File

@ -436,7 +436,7 @@ namespace DCFApixels.DragonECS
{ {
for (int i = _emptyEntitiesCount - 1; i >= 0; i--) for (int i = _emptyEntitiesCount - 1; i >= 0; i--)
{ {
if(_emptyEntities[i] == entityID) if (_emptyEntities[i] == entityID)
{ {
_emptyEntities[i] = _emptyEntities[--_emptyEntitiesCount]; _emptyEntities[i] = _emptyEntities[--_emptyEntitiesCount];
return true; return true;
@ -852,7 +852,7 @@ namespace DCFApixels.DragonECS
} }
_emptyEntitiesCount = 0; _emptyEntitiesCount = 0;
if(count < 0) if (count < 0)
{ {
count = _delEntBufferCount; count = _delEntBufferCount;
} }

View File

@ -314,7 +314,7 @@ namespace DCFApixels.DragonECS
slot.count++; slot.count++;
slot.version++; slot.version++;
var count = _entities[entityID].componentsCount++; var count = _entities[entityID].componentsCount++;
if(count == 0 && IsUsed(entityID)) if (count == 0 && IsUsed(entityID))
{ {
RemoveFromEmptyEntities(entityID); RemoveFromEmptyEntities(entityID);
} }

View File

@ -45,10 +45,15 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryGetWorld(short worldID, out EcsWorld world) public static bool TryGetWorld(short worldID, out EcsWorld world)
{// ts {// ts
if (worldID >= _worlds.Length)
{
world = null;
return false;
}
world = _worlds[worldID]; world = _worlds[worldID];
return return
world != null && world != null &&
world.IsDestroyed != false && world.IsDestroyed == false &&
worldID != 0; worldID != 0;
} }

View File

@ -69,19 +69,19 @@ namespace DCFApixels.DragonECS.Internal
_version++; _version++;
_iterator.IterateTo(World.Entities, _filteredAllGroup); _iterator.IterateTo(World.Entities, _filteredAllGroup);
#if DEBUG && DRAGONECS_DEEP_DEBUG #if DEBUG && DRAGONECS_DEEP_DEBUG
if(_filteredGroup == null) if (_filteredGroup == null)
{ {
_filteredGroup = EcsGroup.New(World); _filteredGroup = EcsGroup.New(World);
} }
_filteredGroup.Clear(); _filteredGroup.Clear();
foreach (var e in World.Entities) foreach (var e in World.Entities)
{ {
if(World.IsMatchesMask(Mask, e)) if (World.IsMatchesMask(Mask, e))
{ {
_filteredGroup.Add(e); _filteredGroup.Add(e);
} }
} }
if(_filteredAllGroup.SetEquals(_filteredGroup) == false) if (_filteredAllGroup.SetEquals(_filteredGroup) == false)
{ {
throw new System.InvalidOperationException(); throw new System.InvalidOperationException();
} }

View File

@ -538,7 +538,7 @@ namespace DCFApixels.DragonECS.Internal
state ^= state >> 17; state ^= state >> 17;
state ^= state << 5; state ^= state << 5;
return state; return state;
}; }
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static long NextXorShiftState(long state) public static long NextXorShiftState(long state)

View File

@ -590,7 +590,7 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void RemoveListener(IEcsPoolEventListener listener) { _pool.AddListener(listener); } public void RemoveListener(IEcsPoolEventListener listener) { _pool.AddListener(listener); }
#endif #endif
#endregion #endregion
#region Convertors #region Convertors
public static implicit operator ReadonlyEcsPool<T>(EcsPool<T> a) { return new ReadonlyEcsPool<T>(a); } public static implicit operator ReadonlyEcsPool<T>(EcsPool<T> a) { return new ReadonlyEcsPool<T>(a); }

View File

@ -464,6 +464,8 @@ namespace DCFApixels.DragonECS
a.gen != b.gen || a.gen != b.gen ||
a.world != b.world; a.world != b.world;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static explicit operator EntitySlotInfo(entlong a) { return new EntitySlotInfo(a._full); }
#endregion #endregion
#region Other #region Other