From bc90842a3a9c2df93c2c658eb4c2e18469b0dc06 Mon Sep 17 00:00:00 2001 From: sebas77 Date: Sat, 19 Jan 2019 10:48:34 +0000 Subject: [PATCH] added option to return an exclusivegroup from egid --- Svelto.ECS/EGID.cs | 4 ++-- Svelto.ECS/ExclusiveGroups.cs | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Svelto.ECS/EGID.cs b/Svelto.ECS/EGID.cs index 0930987..8e3272d 100644 --- a/Svelto.ECS/EGID.cs +++ b/Svelto.ECS/EGID.cs @@ -13,9 +13,9 @@ namespace Svelto.ECS get { return (int) (_GID & 0xFFFFFFFF); } } - public int groupID + public ExclusiveGroup.ExclusiveGroupStruct groupID { - get { return (int) (_GID >> 32); } + get { return new ExclusiveGroup.ExclusiveGroupStruct((int) (_GID >> 32)); } } public static bool operator ==(EGID obj1, EGID obj2) diff --git a/Svelto.ECS/ExclusiveGroups.cs b/Svelto.ECS/ExclusiveGroups.cs index d8ac704..2d57ea7 100644 --- a/Svelto.ECS/ExclusiveGroups.cs +++ b/Svelto.ECS/ExclusiveGroups.cs @@ -100,6 +100,11 @@ namespace Svelto.ECS DBC.ECS.Check.Require(_globalId + range < ushort.MaxValue, "too many exclusive groups created"); _globalId += range; } + + internal ExclusiveGroupStruct(int groupID) + { + _id = groupID; + } public static implicit operator int(ExclusiveGroupStruct groupStruct) {