Skip to content

Commit

Permalink
fixed archetype duplication after loading a save (#191)
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Arch/Core/Extensions/Dangerous/DangerousWorldExtensions.cs
  • Loading branch information
richdog authored Dec 17, 2023
1 parent 0afd40a commit 967b8b8
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Arch.Core.Utils;
using Arch.LowLevel.Jagged;

namespace Arch.Core.Extensions.Dangerous;
Expand All @@ -17,8 +18,12 @@ public static class DangerousWorldExtensions
public static void SetArchetypes(this World world, List<Archetype> archetypes)
{
world.Archetypes.AddRange(archetypes);

foreach (var archetype in archetypes)
{
var hash = Component.GetHashCode(archetype.Types);
world.GroupToArchetype[hash] = archetype;

world.Size += archetype.EntityCount;
world.Capacity += archetype.EntitiesPerChunk * archetype.ChunkCount;
}
Expand Down

0 comments on commit 967b8b8

Please sign in to comment.