ECS: @memcpy Overlap Memory Bug Fix

This commit is contained in:
Dustin Taylor 2024-03-27 01:52:06 -04:00 committed by Stephen Gutekanst
parent 3ea64966f0
commit 92a9836c61

View file

@ -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];