Skip to content

Commit

Permalink
rename EntityRelationLinks<> -> EntityLinkRelations<>
Browse files Browse the repository at this point in the history
  • Loading branch information
friflo committed Dec 1, 2024
1 parent 38781f6 commit 9f33354
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/ECS/Entity/EntityNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ public struct EntityNode
[Browse(Never)] internal int isOwner; // 4

/// <summary>
/// Bit mask for all <see cref="EntityIndex"/> and all <see cref="EntityRelationLinks{TRelation}"/> instances.<br/>
/// Bit mask for all <see cref="EntityIndex"/> and all <see cref="EntityLinkRelations{TRelation}"/> instances.<br/>
/// A bit is set if the entity is linked by either a <see cref="ILinkComponent"/> or a <see cref="ILinkRelation"/>.
/// </summary>
/// <remarks>
/// Use <see cref="IsLinked"/> to see <see cref="ComponentTypes"/> by name.<br/>
/// This masks prevents the insane cost when deleting an entity.<br/>
/// Otherwise, all <see cref="EntityIndex"/> and <see cref="EntityRelationLinks{TRelation}"/> instances need to be iterated
/// Otherwise, all <see cref="EntityIndex"/> and <see cref="EntityLinkRelations{TRelation}"/> instances need to be iterated
/// to check if the entity is a key in their Dictionary's and perform required cleanup.
/// </remarks>
[Browse(Never)] internal int isLinked; // 4
Expand Down
2 changes: 1 addition & 1 deletion src/ECS/Relations/Internal/RelationTypeUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal static Type GetEntityRelationsType(Type componentType, out Type keyType
private static Type MakeIndexType(Type componentType, Type keyType)
{
if (keyType == typeof(Entity)) {
return typeof(EntityRelationLinks<>).MakeGenericType(new [] { componentType });
return typeof(EntityLinkRelations<>).MakeGenericType(new [] { componentType });
}
return typeof(EntityRelations<,>).MakeGenericType(new [] { componentType, keyType });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ namespace Friflo.Engine.ECS.Relations;


/// Contains a single <see cref="Archetype"/> with a single <see cref="StructHeap{T}"/><br/>
internal class EntityRelationLinks<TRelation> : EntityRelations<TRelation, Entity>
internal class EntityLinkRelations<TRelation> : EntityRelations<TRelation, Entity>
where TRelation : struct, ILinkRelation
{
/// Instance created at <see cref="EntityRelations.GetEntityRelations"/>
public EntityRelationLinks(ComponentType componentType, Archetype archetype, StructHeap heap)
public EntityLinkRelations(ComponentType componentType, Archetype archetype, StructHeap heap)
: base(componentType, archetype, heap)
{
linkEntityMap = new Dictionary<int, IdArray>();
Expand Down
2 changes: 1 addition & 1 deletion src/Tests-internal/ECS/Test_Relations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static void Test_Relations_LinkRelationUtils()
var entity2 = store.CreateEntity(2);
entity1.AddRelation(new AttackRelation { target = entity2 });

var relations = (EntityRelationLinks<AttackRelation>)store.extension.relationsMap[StructInfo<AttackRelation>.Index];
var relations = (EntityLinkRelations<AttackRelation>)store.extension.relationsMap[StructInfo<AttackRelation>.Index];
LinkRelationUtils.AddComponentValue(1, 2, relations);
AreEqual(1, relations.Count);

Expand Down

0 comments on commit 9f33354

Please sign in to comment.