Alka
Alka copied to clipboard
ECS StoreComponent, cannot use dynamic UniqueList
ECS StoreComponent, cannot use dynamic UniqueList.
For some reason after some UniqueList(T).append
it just resets the old ones data and repeats that cycle infinitely.
Forced to use fixed array list for the time being, but if possible i want to make use of the dynamic list.
source code
I am not totally sure if this fixes the .append issue you are talking about, but src/core/utils.zig:85
should probably read:
self.items = self.alloc.realloc(self.items, self.items.len - 1 + reserve) catch return Error.FailedtoAllocate;
I was testing the UniqueList by appending the items 'a', 'r','m', and then printing the resulting List. With just the 'a' I get a proper one item listing, but when I add the 'r' the resulting list is: a,a,r
. When I add the 'm' I get a,m,r
instead of a,r,m
.
With the slight change above the listing of the UniqueList is always proper, with no out of order items any more. Hope it helps with your case above...or perhaps is just more consistent... :)