diff --git a/zig-ecs/src/ecs/groups.zig b/zig-ecs/src/ecs/groups.zig index 683d1f4..0af32c1 100644 --- a/zig-ecs/src/ecs/groups.zig +++ b/zig-ecs/src/ecs/groups.zig @@ -173,7 +173,7 @@ pub const OwningGroup = struct { var component_ptrs: [component_info.fields.len][*]u8 = undefined; inline for (component_info.fields) |field, i| { - const storage = self.registry.assure(field.field_type.Child); + const storage = self.registry.assure(std.meta.Child(field.field_type)); component_ptrs[i] = @ptrCast([*]u8, storage.instances.items.ptr); } @@ -181,7 +181,7 @@ pub const OwningGroup = struct { const index = self.firstOwnedStorage().set.index(entity); var comps: Components = undefined; inline for (component_info.fields) |field, i| { - const typed_ptr = @ptrCast([*]field.field_type.Child, @alignCast(@alignOf(field.field_type.Child), component_ptrs[i])); + const typed_ptr = @ptrCast([*]std.meta.Child(field.field_type), @alignCast(@alignOf(std.meta.Child(field.field_type)), component_ptrs[i])); @field(comps, field.name) = &typed_ptr[index]; } diff --git a/zig-ecs/src/ecs/registry.zig b/zig-ecs/src/ecs/registry.zig index 3ec8027..c0b861b 100644 --- a/zig-ecs/src/ecs/registry.zig +++ b/zig-ecs/src/ecs/registry.zig @@ -344,7 +344,7 @@ pub const Registry = struct { assert(self.valid(entity)); var iter = self.components.iterator(); - for (iter.next()) |ptr| { + while (iter.next()) |ptr| { // HACK: we dont know the Type here but we need to be able to call methods on the Storage(T) var store = @intToPtr(*Storage(u1), ptr.value); store.removeIfContains(entity); diff --git a/zig-ecs/src/resources/assets.zig b/zig-ecs/src/resources/assets.zig index bb02846..cc6aa53 100644 --- a/zig-ecs/src/resources/assets.zig +++ b/zig-ecs/src/resources/assets.zig @@ -14,7 +14,8 @@ pub const Assets = struct { } pub fn deinit(self: *Assets) void { - for (self.caches.items()) |ptr| { + var iter = self.caches.iterator(); + while (iter.next()) |ptr| { // HACK: we dont know the Type here but we need to call deinit @intToPtr(*Cache(u1), ptr.value).deinit(); } @@ -39,7 +40,7 @@ pub const Assets = struct { fn ReturnType(comptime loader: anytype, strip_ptr: bool) type { var ret = @typeInfo(@TypeOf(@field(loader, "load"))).BoundFn.return_type.?; if (strip_ptr) { - return ret.Child; + return std.meta.Child(ret); } return ret; } diff --git a/zig-ecs/src/resources/cache.zig b/zig-ecs/src/resources/cache.zig index 576ef9e..d9d9fd0 100644 --- a/zig-ecs/src/resources/cache.zig +++ b/zig-ecs/src/resources/cache.zig @@ -67,7 +67,8 @@ pub fn Cache(comptime T: type) type { pub fn clear(self: *@This()) void { // optionally deinit any resources that have a deinit method if (@hasDecl(T, "deinit")) { - for (self.resources.items()) |kv| { + var iter = self.resources.iterator(); + while (iter.next()) |kv| { @call(.{ .modifier = .always_inline }, @field(kv.value, "deinit"), .{}); } } @@ -75,7 +76,7 @@ pub fn Cache(comptime T: type) type { } pub fn size(self: @This()) usize { - return self.resources.items().len; + return self.resources.count(); } }; } diff --git a/zig-ecs/src/signals/dispatcher.zig b/zig-ecs/src/signals/dispatcher.zig index 15eab06..6bbaf03 100644 --- a/zig-ecs/src/signals/dispatcher.zig +++ b/zig-ecs/src/signals/dispatcher.zig @@ -15,7 +15,8 @@ pub const Dispatcher = struct { } pub fn deinit(self: *Dispatcher) void { - for (self.signals.items()) |ptr| { + var iter = self.signals.iterator(); + while (iter.next()) |ptr| { // HACK: we dont know the Type here but we need to call deinit var signal = @intToPtr(*Signal(void), ptr.value); signal.deinit();