From 92a9836c619a0083dfc5cbf719acca7c20000615 Mon Sep 17 00:00:00 2001 From: Dustin Taylor Date: Wed, 27 Mar 2024 01:52:06 -0400 Subject: [PATCH] ECS: @memcpy Overlap Memory Bug Fix --- src/ecs/Archetype.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ecs/Archetype.zig b/src/ecs/Archetype.zig index 6887d786..2bdc0a23 100644 --- a/src/ecs/Archetype.zig +++ b/src/ecs/Archetype.zig @@ -195,7 +195,7 @@ pub fn getDynamic(storage: *Archetype, row_index: u32, name: StringTable.Index, /// Swap-removes the specified row with the last row in the table. pub fn remove(storage: *Archetype, row_index: u32) void { - if (storage.len > 1) { + if (storage.len > 1 and row_index != storage.len - 1) { for (storage.columns) |column| { const dstStart = column.size * row_index; const dst = column.values[dstStart .. dstStart + column.size];