Skip to content

Commit

Permalink
ECS - show Revision in EntityInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
friflo committed Aug 1, 2024
1 parent 0afa64c commit 4c916c2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/ECS/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ public ref readonly Tags Tags { get {
[FieldOffset(8)] internal readonly long idRevision; // 8
// ReSharper disable once InconsistentNaming
[FieldOffset(8)] public readonly int Id; // 4
[Browse(Never)]
[FieldOffset(12)] public readonly short Revision; // 2
#endregion

Expand Down
4 changes: 3 additions & 1 deletion src/ECS/Entity/EntityInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace Friflo.Engine.ECS;
/// <see cref="Entity.Parent"/> <br/>
/// <see cref="Entity.DebugJSON"/> <br/>
/// <see cref="Entity.DebugEventHandlers"/> <br/>
/// <see cref="Entity.Revision"/> <br/>
/// </summary>
internal readonly struct EntityInfo
{
Expand All @@ -28,7 +29,8 @@ internal readonly struct EntityInfo
internal Entity Parent => entity.Parent;
internal JSON JSON => new JSON(EntityUtils.EntityToJSON(entity));
internal DebugEventHandlers EventHandlers => EntityStore.GetEventHandlers(entity.store, entity.Id);
internal EntityLinks IncomingLinks => entity.GetAllIncomingLinks();
internal EntityLinks IncomingLinks => entity.GetAllIncomingLinks();
internal short Revision => entity.Revision;
public override string ToString() => GetString();
#endregion

Expand Down
1 change: 1 addition & 0 deletions src/Tests-internal/ECS/Test_Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public static void Test_Entity_Info()
AreEqual(json, entity.Info.JSON.Value);
AreEqual("event types: 0, handlers: 0", entity.Info.EventHandlers.ToString());
AreEqual("", entity.Info.JSON.ToString());
AreEqual(1, entity.Info.Revision);
}

[Test]
Expand Down

0 comments on commit 4c916c2

Please sign in to comment.