From f0c711123e5c540182e6c0f2e99e21babc33a753 Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 10 Jun 2020 16:01:09 -0700 Subject: [PATCH] debug only --- zig-ecs/src/ecs/groups.zig | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/zig-ecs/src/ecs/groups.zig b/zig-ecs/src/ecs/groups.zig index f1de8e0..d80a2f6 100644 --- a/zig-ecs/src/ecs/groups.zig +++ b/zig-ecs/src/ecs/groups.zig @@ -139,12 +139,14 @@ pub const OwningGroup = struct { } fn validate(self: OwningGroup, comptime Components: var) void { - std.debug.assert(@typeInfo(Components) == .Struct); + if (std.builtin.mode == .Debug and self.group_data.owned.len > 0) { + std.debug.assert(@typeInfo(Components) == .Struct); - inline for (@typeInfo(Components).Struct.fields) |field| { - std.debug.assert(@typeInfo(field.field_type) == .Pointer); - const found = std.mem.indexOfScalar(u32, self.group_data.owned, utils.typeId(std.meta.Child(field.field_type))); - std.debug.assert(found != null); + inline for (@typeInfo(Components).Struct.fields) |field| { + std.debug.assert(@typeInfo(field.field_type) == .Pointer); + const found = std.mem.indexOfScalar(u32, self.group_data.owned, utils.typeId(std.meta.Child(field.field_type))); + std.debug.assert(found != null); + } } }