mirror of
https://github.com/Ukendio/jecs.git
synced 2025-07-09 08:09:18 +00:00
Remove indirections to entity_index
This commit is contained in:
parent
6b6f6fb961
commit
6c1793f853
1 changed files with 3 additions and 5 deletions
|
@ -2728,7 +2728,6 @@ local function world_new()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function inner_world_delete<T>(world: World, entity: Entity<T>)
|
local function inner_world_delete<T>(world: World, entity: Entity<T>)
|
||||||
local entity_index = world.entity_index
|
|
||||||
local record = inner_entity_index_try_get_unsafe(entity::number)
|
local record = inner_entity_index_try_get_unsafe(entity::number)
|
||||||
if not record then
|
if not record then
|
||||||
return
|
return
|
||||||
|
@ -2904,20 +2903,19 @@ local function world_new()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local dense_array = entity_index.dense_array
|
|
||||||
local dense = record.dense
|
local dense = record.dense
|
||||||
local i_swap = entity_index.alive_count
|
local i_swap = entity_index.alive_count
|
||||||
entity_index.alive_count = i_swap - 1
|
entity_index.alive_count = i_swap - 1
|
||||||
|
|
||||||
local e_swap = dense_array[i_swap]
|
local e_swap = eindex_dense_array[i_swap]
|
||||||
local r_swap = inner_entity_index_try_get_any(e_swap :: number) :: Record
|
local r_swap = inner_entity_index_try_get_any(e_swap :: number) :: Record
|
||||||
r_swap.dense = dense
|
r_swap.dense = dense
|
||||||
record.archetype = nil :: any
|
record.archetype = nil :: any
|
||||||
record.row = nil :: any
|
record.row = nil :: any
|
||||||
record.dense = i_swap
|
record.dense = i_swap
|
||||||
|
|
||||||
dense_array[dense] = e_swap
|
eindex_dense_array[dense] = e_swap
|
||||||
dense_array[i_swap] = ECS_GENERATION_INC(entity :: number)
|
eindex_dense_array[i_swap] = ECS_GENERATION_INC(entity :: number)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function inner_world_exists<T>(world: World, entity: Entity<T>): boolean
|
local function inner_world_exists<T>(world: World, entity: Entity<T>): boolean
|
||||||
|
|
Loading…
Reference in a new issue