mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-17 09:24:37 +08:00
hot fix up version to 0.9.20
This commit is contained in:
parent
2e1b22c129
commit
4512245e57
@ -10,7 +10,7 @@
|
||||
<RootNamespace>DCFApixels.DragonECS</RootNamespace>
|
||||
|
||||
<Title>DragonECS</Title>
|
||||
<Version>0.9.19</Version>
|
||||
<Version>0.9.20</Version>
|
||||
<Authors>DCFApixels</Authors>
|
||||
<Description>ECS Framework for Game Engines with C# and .Net Platform</Description>
|
||||
<Copyright>DCFApixels</Copyright>
|
||||
|
@ -8,7 +8,7 @@
|
||||
"displayName": "DragonECS",
|
||||
"description": "C# Entity Component System Framework",
|
||||
"unity": "2020.3",
|
||||
"version": "0.9.19",
|
||||
"version": "0.9.20",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DCFApixels/DragonECS.git"
|
||||
|
@ -442,7 +442,7 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
if (++_count >= _dense.Length)
|
||||
{
|
||||
Array.Resize(ref _dense, ArrayUtility.NextPow2(_count << 1));
|
||||
Array.Resize(ref _dense, ArrayUtility.NextPow2(_count));
|
||||
}
|
||||
_dense[_count] = entityID;
|
||||
|
||||
@ -576,7 +576,7 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
if (minSize >= _dense.Length)
|
||||
{
|
||||
Array.Resize(ref _dense, ArrayUtility.NextPow2_ClampOverflow(minSize));
|
||||
Array.Resize(ref _dense, ArrayUtility.CeilPow2_ClampOverflow(minSize));
|
||||
}
|
||||
}
|
||||
|
||||
@ -663,7 +663,7 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
if (dynamicBuffer.Length < _count)
|
||||
{
|
||||
Array.Resize(ref dynamicBuffer, ArrayUtility.NextPow2(_count));
|
||||
Array.Resize(ref dynamicBuffer, ArrayUtility.CeilPow2(_count));
|
||||
}
|
||||
int i = 0;
|
||||
foreach (var e in this)
|
||||
|
@ -98,7 +98,7 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
if (dynamicBuffer.Length < _values.Length)
|
||||
{
|
||||
Array.Resize(ref dynamicBuffer, ArrayUtility.NextPow2(_values.Length));
|
||||
Array.Resize(ref dynamicBuffer, ArrayUtility.CeilPow2(_values.Length));
|
||||
}
|
||||
int i = 0;
|
||||
foreach (var e in this)
|
||||
@ -247,7 +247,7 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
if (dynamicBuffer.Length < _source.Count)
|
||||
{
|
||||
Array.Resize(ref dynamicBuffer, ArrayUtility.NextPow2(_source.Count));
|
||||
Array.Resize(ref dynamicBuffer, ArrayUtility.CeilPow2(_source.Count));
|
||||
}
|
||||
int i = 0;
|
||||
foreach (var e in this)
|
||||
|
@ -876,7 +876,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
}
|
||||
|
||||
if(_sortAnyChunckBuffer.Length != 0)
|
||||
if (_sortAnyChunckBuffer.Length != 0)
|
||||
{
|
||||
for (int i = 0; i < _sortAnyChunckBuffer.Length; i++)
|
||||
{
|
||||
|
@ -205,12 +205,12 @@ namespace DCFApixels.DragonECS
|
||||
|
||||
_poolsMediator = new PoolsMediator(this);
|
||||
|
||||
int poolsCapacity = ArrayUtility.NextPow2(config.PoolsCapacity);
|
||||
int poolsCapacity = ArrayUtility.CeilPow2Safe(config.PoolsCapacity);
|
||||
_pools = new IEcsPoolImplementation[poolsCapacity];
|
||||
_poolSlots = new PoolSlot[poolsCapacity];
|
||||
ArrayUtility.Fill(_pools, _nullPool);
|
||||
|
||||
int entitiesCapacity = ArrayUtility.NextPow2(config.EntitiesCapacity);
|
||||
int entitiesCapacity = ArrayUtility.CeilPow2Safe(config.EntitiesCapacity);
|
||||
_entityDispenser = new IdDispenser(entitiesCapacity, 0, OnEntityDispenserResized);
|
||||
|
||||
_executorCoures = new Dictionary<(Type, object), IQueryExecutorImplementation>(config.PoolComponentsCapacity);
|
||||
@ -570,7 +570,7 @@ namespace DCFApixels.DragonECS
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if(count == 0)
|
||||
if (count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ namespace DCFApixels.DragonECS.Core
|
||||
var slots = _world._poolSlots;
|
||||
for (int i = 1; i < _count; i++)
|
||||
{
|
||||
if(_versions[i] == slots[_componentIDs[i]].version)
|
||||
if (_versions[i] == slots[_componentIDs[i]].version)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ namespace DCFApixels.DragonECS
|
||||
private readonly Dictionary<Type, InjectionNodeBase> _nodes = new Dictionary<Type, InjectionNodeBase>(32);
|
||||
private ReadOnlySpan<InjectionNodeBase> GetNodes(Type type)
|
||||
{
|
||||
if(_branches.TryGetValue(type, out InjectionBranch branch))
|
||||
if (_branches.TryGetValue(type, out InjectionBranch branch))
|
||||
{
|
||||
return branch.Nodes;
|
||||
}
|
||||
@ -34,7 +34,7 @@ namespace DCFApixels.DragonECS
|
||||
private ReadOnlySpan<object> EndReadHistory_Internal(int startIndex)
|
||||
{
|
||||
_injectionTempHistoryReadersCount--;
|
||||
if(_injectionTempHistoryReadersCount < 0)
|
||||
if (_injectionTempHistoryReadersCount < 0)
|
||||
{
|
||||
Throw.OpeningClosingMethodsBalanceError();
|
||||
}
|
||||
|
@ -144,7 +144,19 @@ namespace DCFApixels.DragonECS.Core.Internal
|
||||
array = result;
|
||||
}
|
||||
|
||||
public static int NextPow2Safe(int v, int min = 4)
|
||||
{
|
||||
return NextPow2(v < min ? min : v);
|
||||
}
|
||||
public static int NextPow2(int v)
|
||||
{
|
||||
return CeilPow2(v | 1);
|
||||
}
|
||||
public static int CeilPow2Safe(int v, int min = 4)
|
||||
{
|
||||
return CeilPow2(v < min ? min : v);
|
||||
}
|
||||
public static int CeilPow2(int v)
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
@ -157,7 +169,7 @@ namespace DCFApixels.DragonECS.Core.Internal
|
||||
return ++v;
|
||||
}
|
||||
}
|
||||
public static int NextPow2_ClampOverflow(int v)
|
||||
public static int CeilPow2_ClampOverflow(int v)
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
@ -166,7 +178,7 @@ namespace DCFApixels.DragonECS.Core.Internal
|
||||
{
|
||||
return int.MaxValue;
|
||||
}
|
||||
return NextPow2(v);
|
||||
return CeilPow2(v);
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,19 +217,18 @@ namespace DCFApixels.DragonECS.Core.Internal
|
||||
Array.Resize(ref array, minSize);
|
||||
}
|
||||
}
|
||||
public static void UpsizeToNextPow2<T>(ref T[] array, int minSize)
|
||||
{
|
||||
if (array == null)
|
||||
{
|
||||
minSize = NextPow2(minSize);
|
||||
array = new T[minSize];
|
||||
}
|
||||
else if (minSize > array.Length)
|
||||
{
|
||||
minSize = NextPow2(minSize);
|
||||
Array.Resize(ref array, minSize);
|
||||
}
|
||||
}
|
||||
//public static void UpsizeToCeilPow2<T>(ref T[] array, int newSize, int minSize = 4)
|
||||
//{
|
||||
// newSize = CeilPow2(newSize < minSize ? minSize : newSize);
|
||||
// if (array == null)
|
||||
// {
|
||||
// array = new T[newSize];
|
||||
// }
|
||||
// else if (newSize > array.Length)
|
||||
// {
|
||||
// Array.Resize(ref array, newSize);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
internal readonly struct EnumerableInt : IEnumerable<int>
|
||||
{
|
||||
|
@ -248,7 +248,7 @@ namespace DCFApixels.DragonECS.Core.Internal
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private void Upsize_Internal(int minSize)
|
||||
{
|
||||
Resize(ArrayUtility.NextPow2_ClampOverflow(minSize));
|
||||
Resize(ArrayUtility.CeilPow2_ClampOverflow(minSize));
|
||||
}
|
||||
private void Resize(int newSize)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ namespace DCFApixels.DragonECS.Core.Internal
|
||||
set
|
||||
{
|
||||
if (value <= _items.Length) { return; }
|
||||
value = ArrayUtility.NextPow2(value);
|
||||
value = ArrayUtility.CeilPow2Safe(value);
|
||||
Array.Resize(ref _items, value);
|
||||
}
|
||||
}
|
||||
@ -64,7 +64,7 @@ namespace DCFApixels.DragonECS.Core.Internal
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public StructList(int capacity)
|
||||
{
|
||||
_items = new T[ArrayUtility.NextPow2(capacity)];
|
||||
_items = new T[ArrayUtility.CeilPow2Safe(capacity)];
|
||||
_count = 0;
|
||||
}
|
||||
#endregion
|
||||
@ -226,7 +226,7 @@ namespace DCFApixels.DragonECS.Core.Internal
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Recreate(int newSize)
|
||||
{
|
||||
_items = new T[ArrayUtility.NextPow2(newSize)];
|
||||
_items = new T[ArrayUtility.CeilPow2Safe(newSize)];
|
||||
_count = 0;
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
@ -94,7 +94,7 @@ namespace DCFApixels.DragonECS
|
||||
public EcsPool() { }
|
||||
public EcsPool(int capacity, int recycledCapacity = -1)
|
||||
{
|
||||
capacity = ArrayUtility.NextPow2(capacity);
|
||||
capacity = ArrayUtility.CeilPow2Safe(capacity);
|
||||
if (recycledCapacity < 0)
|
||||
{
|
||||
recycledCapacity = capacity / 2;
|
||||
@ -113,7 +113,7 @@ namespace DCFApixels.DragonECS
|
||||
var worldConfig = world.Configs.GetWorldConfigOrDefault();
|
||||
if (_items == null)
|
||||
{
|
||||
_items = new T[ArrayUtility.NextPow2(worldConfig.PoolComponentsCapacity)];
|
||||
_items = new T[ArrayUtility.CeilPow2Safe(worldConfig.PoolComponentsCapacity)];
|
||||
}
|
||||
if (_recycledItems == null)
|
||||
{
|
||||
@ -232,7 +232,7 @@ namespace DCFApixels.DragonECS
|
||||
DisableComponent(ref _items[itemIndex]);
|
||||
if (_recycledItemsCount >= _recycledItems.Length)
|
||||
{
|
||||
Array.Resize(ref _recycledItems, ArrayUtility.NextPow2(_recycledItemsCount));
|
||||
Array.Resize(ref _recycledItems, ArrayUtility.NextPow2Safe(_recycledItemsCount));
|
||||
}
|
||||
_recycledItems[_recycledItemsCount++] = itemIndex;
|
||||
itemIndex = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user