Skip to content

Commit 79e0736

Browse files
committed
More fixes.
1 parent c27d3fa commit 79e0736

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

src/Arch.Benchmarks/ArchetypeIterationTechnqiquesBenchmark.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public void Setup()
2424
{
2525
_consumer = new Consumer();
2626

27-
_globalArchetype = new Archetype(_group);
27+
_globalArchetype = new Archetype(_group, 16_382, 100);
2828
_globalArchetype.EnsureEntityCapacity(Amount);
2929

3030
for (var index = 0; index < Amount; index++)

src/Arch/Core/Extensions/Dangerous/DangerousArchetypeExtensions.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ public static Archetype CreateArchetype(int baseChunkSizeInBytes, int minimumAmo
2626
/// Sets the <see cref="Archetype.ChunkCount"/>.
2727
/// </summary>
2828
/// <param name="archetype">The <see cref="Archetype"/>.</param>
29-
/// <param name="size">The size.</param>
30-
public static void SetSize(this Archetype archetype, int size)
29+
/// <param name="count">The count.</param>
30+
public static void SetCount(this Archetype archetype, int count)
3131
{
32-
//archetype.ChunkCount = size;
32+
archetype.Chunks.EnsureCapacity(count);
33+
archetype.Count = count;
3334
}
3435

3536
/// <summary>
@@ -39,11 +40,11 @@ public static void SetSize(this Archetype archetype, int size)
3940
/// <param name="chunks">The list of <see cref="Chunk"/>s.</param>
4041
public static void SetChunks(this Archetype archetype, List<Chunk> chunks)
4142
{
42-
/*
43-
archetype.Chunks = ArrayPool<Chunk>.Shared.Rent(chunks.Count);
44-
chunks.CopyTo(archetype.Chunks);
45-
46-
archetype.ChunkCapacity = chunks.Count;*/
43+
archetype.Chunks.EnsureCapacity(chunks.Count);
44+
foreach (var chunk in chunks)
45+
{
46+
archetype.Chunks.Add(chunk);
47+
}
4748
}
4849

4950
/// <summary>

src/Arch/Core/Extensions/Dangerous/DangerousEntityExtensions.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@ public static class DangerousEntityExtensions
88
{
99
/// <summary>
1010
/// Creates an <see cref="Entity"/> struct and returns it.
11-
/// Does not create an <see cref="Entity"/> in the world, just the plain struct.
11+
/// Does not create an <see cref="Entity"/> in the world, just the plain struct.
1212
/// </summary>
1313
/// <param name="id">Its id.</param>
1414
/// <param name="world">Its world id.</param>
15+
/// <param name="version">Its version.</param>
1516
/// <returns>The new <see cref="Entity"/>.</returns>
16-
public static Entity CreateEntityStruct(int id, int world)
17+
public static Entity CreateEntityStruct(int id, int world, int version)
1718
{
1819
#if PURE_ECS
19-
return new Entity(id, 0);
20+
return new Entity(id, 0, version);
2021
#else
21-
return new Entity(id, world);
22+
return new Entity(id, world, version);
2223
#endif
2324
}
2425
}

0 commit comments

Comments
 (0)