master
Mike 5 years ago
parent 896095fc15
commit f0c711123e

@ -139,12 +139,14 @@ pub const OwningGroup = struct {
} }
fn validate(self: OwningGroup, comptime Components: var) void { 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| { inline for (@typeInfo(Components).Struct.fields) |field| {
std.debug.assert(@typeInfo(field.field_type) == .Pointer); 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))); const found = std.mem.indexOfScalar(u32, self.group_data.owned, utils.typeId(std.meta.Child(field.field_type)));
std.debug.assert(found != null); std.debug.assert(found != null);
}
} }
} }

Loading…
Cancel
Save