From 6e412489a2bb423993f0ad72e5b996799448cdce Mon Sep 17 00:00:00 2001 From: Maurizio Crocci Date: Sat, 28 Nov 2020 02:21:03 +0000 Subject: [PATCH] Fixes Registry.removeAll iteration --- zig-ecs/src/ecs/registry.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zig-ecs/src/ecs/registry.zig b/zig-ecs/src/ecs/registry.zig index 9703202..3ec8027 100644 --- a/zig-ecs/src/ecs/registry.zig +++ b/zig-ecs/src/ecs/registry.zig @@ -343,7 +343,8 @@ pub const Registry = struct { pub fn removeAll(self: *Registry, entity: Entity) void { assert(self.valid(entity)); - for (self.components.items()) |ptr| { + var iter = self.components.iterator(); + for (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);