Skip to content

Commit

Permalink
Fixed #177
Browse files Browse the repository at this point in the history
  • Loading branch information
genaray committed Nov 24, 2023
1 parent e147287 commit a207c15
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Arch/Arch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DefineConstants>TRACE;</DefineConstants>
<DefineConstants>TRACE;EVENTS;</DefineConstants>
<Optimize>false</Optimize>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
Expand Down Expand Up @@ -93,7 +93,7 @@
<PackageReference Include="Collections.Pooled" Version="2.0.0-preview.27" />
<PackageReference Include="CommunityToolkit.HighPerformance" Version="7.1.2" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageReference Include="ZeroAllocJobScheduler" Version="1.0.2" />
<PackageReference Include="ZeroAllocJobScheduler" Version="1.0.1" />
</ItemGroup>

</Project>
22 changes: 18 additions & 4 deletions src/Arch/Core/Edges/Archetype.Edges.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,16 @@ internal void RemoveEdge(Archetype archetype)
for (var itemIndex = 0; itemIndex < bucket.Capacity; itemIndex++)
{
var edge = bucket[itemIndex];
if (edge == archetype)
if (edge != archetype)
{
RemoveAddEdge(index);
continue;
}

// Remove from bucket and if the removal caused it being trimmed, break the search and continue with the next
RemoveAddEdge((index * BucketSize) + itemIndex);
if (bucket.IsEmpty)
{
break;
}
}
}
Expand All @@ -159,9 +166,16 @@ internal void RemoveEdge(Archetype archetype)
for (var itemIndex = 0; itemIndex < bucket.Capacity; itemIndex++)
{
var edge = bucket[itemIndex];
if (edge == archetype)
if (edge != archetype)
{
continue;
}

// Remove from bucket and if the removal caused it being trimmed, break the search and continue with the next
RemoveRemoveEdge((index * BucketSize) + itemIndex);
if (bucket.IsEmpty)
{
RemoveRemoveEdge(index);
break;
}
}
}
Expand Down

0 comments on commit a207c15

Please sign in to comment.