Remove ETX as Flecs now supports Empty

main
copygirl 1 year ago
parent 5600a6f0ee
commit 1607506e32
  1. 2
      src/gaemstone.ECS/EntityBuilder.cs
  2. 2
      src/gaemstone.ECS/EntityPath.cs
  3. 1
      src/gaemstone.ECS/Utility/CStringExtensions.cs

@ -113,7 +113,7 @@ public class EntityBuilder<TContext>
_symbol = alloc.AllocateCString(_symbol), _symbol = alloc.AllocateCString(_symbol),
_add_expr = alloc.AllocateCString(Expression), _add_expr = alloc.AllocateCString(Expression),
use_low_id = UseLowId, use_low_id = UseLowId,
_sep = CStringExtensions.ETX, _sep = CStringExtensions.Empty,
}; };
var add = desc.add; var index = 0; var add = desc.add; var index = 0;

@ -197,7 +197,7 @@ public class EntityPath
foreach (var part in path) foreach (var part in path)
fixed (byte* ptr = part.AsSpan()) fixed (byte* ptr = part.AsSpan())
if (skipLookup || (parent = new(ecs_lookup_child(world, parent, ptr))).IsNone) { if (skipLookup || (parent = new(ecs_lookup_child(world, parent, ptr))).IsNone) {
var desc = new ecs_entity_desc_t { _name = ptr, _sep = CStringExtensions.ETX }; var desc = new ecs_entity_desc_t { _name = ptr, _sep = CStringExtensions.Empty };
if (parent.IsSome) desc.add[0] = Id.Pair(FlecsBuiltIn.ChildOf, parent); if (parent.IsSome) desc.add[0] = Id.Pair(FlecsBuiltIn.ChildOf, parent);
parent = new(ecs_entity_init(world, &desc)); parent = new(ecs_entity_init(world, &desc));
skipLookup = true; skipLookup = true;

@ -8,7 +8,6 @@ namespace gaemstone.ECS.Utility;
public unsafe static class CStringExtensions public unsafe static class CStringExtensions
{ {
public static CString Empty { get; } = (CString)""; public static CString Empty { get; } = (CString)"";
public static CString ETX { get; } = (CString)"\x3"; // TODO: Temporary, until flecs supports Empty.
public static unsafe byte[]? FlecsToBytes(this CString str) public static unsafe byte[]? FlecsToBytes(this CString str)
{ {

Loading…
Cancel
Save