remove comments

This commit is contained in:
Mikhail 2024-02-29 22:44:23 +08:00
parent a3a61d21da
commit c7b8246e09
2 changed files with 0 additions and 25 deletions

View File

@ -33,8 +33,6 @@ namespace DCFApixels.DragonECS
private IdDispenser _entityDispenser;
private int _entitiesCount = 0;
private int _entitiesCapacity = 0;
//private short[] _gens = Array.Empty<short>(); //старший бит указывает на то жива ли сущность
//private short[] _componentCounts = Array.Empty<short>();
private EntitySlot[] _entities = Array.Empty<EntitySlot>();
private int[] _delEntBuffer = Array.Empty<int>();
@ -154,8 +152,6 @@ namespace DCFApixels.DragonECS
public void Destroy()
{
_entityDispenser = null;
//_gens = null;
//_componentCounts = null;
_pools = null;
_nullPool = null;
_worlds[id] = null;
@ -231,11 +227,8 @@ namespace DCFApixels.DragonECS
_entitiesCount++;
if (_entitiesCapacity <= entityID)
{
//OnEntityDispenserResized(_gens.Length << 1);
OnEntityDispenserResized(_entities.Length << 1);
}
//_gens[entityID] &= GEN_MASK;
//_entities[entityID].gen &= GEN_MASK;
_entities[entityID].isUsed = true;
_entityListeners.InvokeOnNewEntity(entityID);
}
@ -262,7 +255,6 @@ namespace DCFApixels.DragonECS
#endif
UpVersion();
_delEntBuffer[_delEntBufferCount++] = entityID;
//_gens[entityID] |= DEATH_GEN_BIT;
_entities[entityID].isUsed = false;
_entitiesCount--;
_entityListeners.InvokeOnDelEntity(entityID);
@ -288,20 +280,17 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe EntitySlotInfo GetEntitySlotInfoDebug(int entityID)
{
//return new EntitySlotInfo(entityID, _gens[entityID], id);
return new EntitySlotInfo(entityID, _entities[entityID].gen, id);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool IsAlive(int entityID, short gen)
{
//ref short slotGen = ref _gens[entityID];
ref var slot = ref _entities[entityID];
return slot.gen == gen && slot.isUsed;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool IsUsed(int entityID)
{
//return _entityDispenser.IsUsed(entityID);
return _entities[entityID].isUsed;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@ -309,7 +298,6 @@ namespace DCFApixels.DragonECS
{
unchecked
{
//ref short slotGen = ref _gens[entityID];
ref short slotGen = ref _entities[entityID].gen;
if (slotGen < 0)
{ //up gen
@ -323,7 +311,6 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public short GetComponentsCount(int entityID)
{
//return _componentCounts[entityID];
return _entities[entityID].componentsCount;
}
@ -360,7 +347,6 @@ namespace DCFApixels.DragonECS
int delCount = 0;
foreach (var e in Entities)
{
//if (_componentCounts[e] <= 0)
if (_entities[e].componentsCount <= 0)
{
DelEntity(e);
@ -383,7 +369,6 @@ namespace DCFApixels.DragonECS
int delCount = 0;
foreach (var e in Entities)
{
//if (_componentCounts[e] <= 0)
if (_entities[e].componentsCount <= 0)
{
delCount++;
@ -483,7 +468,6 @@ namespace DCFApixels.DragonECS
for (int i = 0; i < slisedCount; i++)
{
int e = _delEntBuffer[i];
//if (_componentCounts[e] <= 0)
if (_entities[e].componentsCount <= 0)
{
int tmp = _delEntBuffer[i];
@ -508,8 +492,6 @@ namespace DCFApixels.DragonECS
{
int e = buffer[i];
_entityDispenser.Release(e);
//unchecked { _gens[e]++; }//up gen
//_gens[e] |= DEATH_GEN_BIT;
_entities[e].gen |= SLEEPING_GEN_FLAG;
}
Densify();
@ -528,14 +510,11 @@ namespace DCFApixels.DragonECS
[MethodImpl(MethodImplOptions.NoInlining)]
private void OnEntityDispenserResized(int newSize)
{
//Array.Resize(ref _gens, newSize);
//Array.Resize(ref _componentCounts, newSize);
Array.Resize(ref _entities, newSize);
Array.Resize(ref _delEntBuffer, newSize);
_entityComponentMaskLength = _pools.Length / COMPONENT_MATRIX_MASK_BITSIZE + 1;
Array.Resize(ref _entityComponentMasks, newSize * _entityComponentMaskLength);
//ArrayUtility.Fill(_gens, DEATH_GEN_BIT, _entitiesCapacity);
ArrayUtility.Fill(_entities, EntitySlot.Empty, _entitiesCapacity);
_entitiesCapacity = newSize;

View File

@ -210,7 +210,6 @@ namespace DCFApixels.DragonECS
private void RegisterEntityComponent(int entityID, int componentTypeID, EcsMaskChunck maskBit)
{
_poolComponentCounts[componentTypeID]++;
//_componentCounts[entityID]++;
_entities[entityID].componentsCount++;
_entityComponentMasks[entityID * _entityComponentMaskLength + maskBit.chankIndex] |= maskBit.mask;
}
@ -218,7 +217,6 @@ namespace DCFApixels.DragonECS
private void UnregisterEntityComponent(int entityID, int componentTypeID, EcsMaskChunck maskBit)
{
_poolComponentCounts[componentTypeID]--;
//var count = --_componentCounts[entityID];
var count = --_entities[entityID].componentsCount;
_entityComponentMasks[entityID * _entityComponentMaskLength + maskBit.chankIndex] &= ~maskBit.mask;
@ -241,7 +239,6 @@ namespace DCFApixels.DragonECS
{
chunk = newChunk;
_poolComponentCounts[componentTypeID]++;
//_componentCounts[entityID]++;
_entities[entityID].componentsCount++;
return true;
}
@ -255,7 +252,6 @@ namespace DCFApixels.DragonECS
if (chunk != newChunk)
{
_poolComponentCounts[componentTypeID]--;
//var count = --_componentCounts[entityID];
var count = --_entities[entityID].componentsCount;
chunk = newChunk;