ecs: fix appendUndefined() off-by-one error
This commit is contained in:
parent
3549f6bc4d
commit
390b8bd922
1 changed files with 2 additions and 1 deletions
|
|
@ -97,8 +97,9 @@ pub const ArchetypeStorage = struct {
|
||||||
pub fn appendUndefined(storage: *ArchetypeStorage, gpa: Allocator) !u32 {
|
pub fn appendUndefined(storage: *ArchetypeStorage, gpa: Allocator) !u32 {
|
||||||
try storage.ensureUnusedCapacity(gpa, 1);
|
try storage.ensureUnusedCapacity(gpa, 1);
|
||||||
assert(storage.len < storage.capacity);
|
assert(storage.len < storage.capacity);
|
||||||
|
const row_index = storage.len;
|
||||||
storage.len += 1;
|
storage.len += 1;
|
||||||
return storage.len;
|
return row_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn append(storage: *ArchetypeStorage, gpa: Allocator, row: anytype) !u32 {
|
pub fn append(storage: *ArchetypeStorage, gpa: Allocator, row: anytype) !u32 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue