More minor style fixed

wip/source-generators
copygirl 1 year ago
parent 3ef86f5fa3
commit 9b0b44d1e9
  1. 2
      src/gaemstone/ECS/EntityBuilder.cs
  2. 2
      src/gaemstone/ECS/EntityRef.cs
  3. 4
      src/gaemstone/ECS/Identifier.cs
  4. 2
      src/gaemstone/ECS/IdentifierRef.cs

@ -53,7 +53,7 @@ public class EntityBuilder
{ {
// If adding a ChildOf relation, store the parent separately. // If adding a ChildOf relation, store the parent separately.
if (id.AsPair(Universe) is (EntityRef relation, EntityRef target) && if (id.AsPair(Universe) is (EntityRef relation, EntityRef target) &&
relation == Universe.ChildOf) { _parent = target; return this; } (relation == Universe.ChildOf)) { _parent = target; return this; }
if (_toAdd.Count == 31) throw new NotSupportedException( if (_toAdd.Count == 31) throw new NotSupportedException(
"Must not add more than 31 IDs at once with EntityBuilder"); "Must not add more than 31 IDs at once with EntityBuilder");

@ -153,7 +153,7 @@ public unsafe sealed class EntityRef
public EntityRef? GetTarget<T>(int index = 0) public EntityRef? GetTarget<T>(int index = 0)
=> GetTarget(Universe.LookupOrThrow(typeof(T)), index); => GetTarget(Universe.LookupOrThrow(typeof(T)), index);
public bool Equals(EntityRef? other) => (other is not null) && Universe == other.Universe && Entity == other.Entity; public bool Equals(EntityRef? other) => (other is not null) && (Universe == other.Universe) && (Entity == other.Entity);
public override bool Equals(object? obj) => Equals(obj as EntityRef); public override bool Equals(object? obj) => Equals(obj as EntityRef);
public override int GetHashCode() => HashCode.Combine(Universe, Entity); public override int GetHashCode() => HashCode.Combine(Universe, Entity);
public override string? ToString() => ecs_entity_str(Universe, this).FlecsToStringAndFree()!; public override string? ToString() => ecs_entity_str(Universe, this).FlecsToStringAndFree()!;

@ -23,8 +23,8 @@ public readonly struct Identifier
public static Identifier Pair(Entity relation, Entity target) public static Identifier Pair(Entity relation, Entity target)
=> Combine(IdentifierFlags.Pair, new( => Combine(IdentifierFlags.Pair, new(
(relation.Value.Data << 32) | ((relation.Value.Data << 32) & ECS_COMPONENT_MASK) |
(target.Value.Data & ECS_ENTITY_MASK))); ( target.Value.Data & ECS_ENTITY_MASK )));
public (EntityRef Relation, EntityRef Target)? AsPair(Universe universe) public (EntityRef Relation, EntityRef Target)? AsPair(Universe universe)
=> new IdentifierRef(universe, this).AsPair(); => new IdentifierRef(universe, this).AsPair();

@ -28,7 +28,7 @@ public unsafe class IdentifierRef
public (EntityRef Relation, EntityRef Target)? AsPair() public (EntityRef Relation, EntityRef Target)? AsPair()
=> IsPair ? (Universe.LookupOrThrow(ID.RelationUnsafe), Universe.LookupOrThrow(ID.TargetUnsafe)) : null; => IsPair ? (Universe.LookupOrThrow(ID.RelationUnsafe), Universe.LookupOrThrow(ID.TargetUnsafe)) : null;
public bool Equals(IdentifierRef? other) => (other is not null) && Universe == other.Universe && ID == other.ID; public bool Equals(IdentifierRef? other) => (other is not null) && (Universe == other.Universe) && (ID == other.ID);
public override bool Equals(object? obj) => Equals(obj as IdentifierRef); public override bool Equals(object? obj) => Equals(obj as IdentifierRef);
public override int GetHashCode() => HashCode.Combine(Universe, ID); public override int GetHashCode() => HashCode.Combine(Universe, ID);
public override string? ToString() => ecs_id_str(Universe, this).FlecsToStringAndFree()!; public override string? ToString() => ecs_id_str(Universe, this).FlecsToStringAndFree()!;

Loading…
Cancel
Save