From 15d0e6d00d60d71de44dfed0e48ac1a547c5a2da Mon Sep 17 00:00:00 2001 From: RUSshy <18348637+RUSshy@users.noreply.github.com> Date: Sat, 17 Jul 2021 14:08:19 +0200 Subject: [PATCH] Update registry.zig --- zig-ecs/src/ecs/registry.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zig-ecs/src/ecs/registry.zig b/zig-ecs/src/ecs/registry.zig index 6ebab46..5a64402 100644 --- a/zig-ecs/src/ecs/registry.zig +++ b/zig-ecs/src/ecs/registry.zig @@ -10,7 +10,7 @@ const TypeStore = @import("type_store.zig").TypeStore; // allow overriding EntityTraits by setting in root via: EntityTraits = EntityTraitsType(.medium); const root = @import("root"); -const entity_traits = if (@hasDecl(root, "EntityTraits")) root.EntityTraits.init() else @import("entity.zig").EntityTraits.init(); +pub const entity_traits = if (@hasDecl(root, "EntityTraits")) root.EntityTraits.init() else @import("entity.zig").EntityTraits.init(); // setup the Handles type based on the type set in EntityTraits const EntityHandles = Handles(entity_traits.entity_type, entity_traits.index_type, entity_traits.version_type); @@ -261,7 +261,7 @@ pub const Registry = struct { /// Returns the version stored along with an entity identifier pub fn version(_: *Registry, entity: Entity) entity_traits.version_type { - return @truncate(entity_traits.version_type, entity >> @bitSizeOf(entity_traits.index_type)); + return @truncate(entity_traits.version_type, entity >> entity_traits.entity_shift); } /// Creates a new entity and returns it