dense should be set at index

This commit is contained in:
Ukendio 2025-04-26 00:55:03 +02:00
parent d1d5b1f207
commit 52435e62a2
2 changed files with 3 additions and 1 deletions

View file

@ -11,7 +11,8 @@ The format is based on [Keep a Changelog][kac], and this project adheres to
## [Unreleased]
- `[world]`:
- Added `world:range` to allow for creating
- Added `world:range` to restrict entity range
- Changed `world:entity` to accept the overload to create an entity at the desired index
- Changed `world:clear` to also look through the component record for the cleared `ID`
- Removes the cleared ID from every entity that has it
- Changed entity ID layouts by putting the index in the lower bits, which should make every world function 1-5 nanoseconds faster

View file

@ -778,6 +778,7 @@ local function world_entity(world: ecs_world_t, entity: i53?): i53
local any = dense_array[dense]
if any == entity then
if alive_count > dense then
r.dense = dense
return entity
end
local e_swap = dense_array[alive_count]