mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-19 07:51:08 +00:00
[ecs] Use correct index when deleting subpool ranges
Coming up with tests is hard. Breaking code with real code is easy.
This commit is contained in:
parent
ad9e85b8d4
commit
76b6d3141b
1 changed files with 3 additions and 2 deletions
|
@ -77,13 +77,14 @@ ECS_DelSubpoolRange (ecs_registry_t *registry, uint32_t component, uint32_t id)
|
|||
uint32_t next = subpool->next | Ent_NextGen (Ent_Generation (id));
|
||||
uint32_t ind = Ent_Index (id);
|
||||
uint32_t count = subpool->num_ranges - subpool->available;
|
||||
uint32_t range = subpool->sorted[ind];
|
||||
subpool->rangeids[ind] = next;
|
||||
subpool->next = ind;
|
||||
subpool->available++;
|
||||
memmove (subpool->ranges + ind, subpool->ranges + ind + 1,
|
||||
(count - 1 - ind) * sizeof (ecs_range_t));
|
||||
(count - 1 - range) * sizeof (ecs_range_t));
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
if (subpool->sorted[i] > ind) {
|
||||
if (subpool->sorted[i] > range) {
|
||||
subpool->sorted[i]--;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue