mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 01:20:04 +00:00
Avoid recomputing column size (#100)
This commit is contained in:
parent
aa21b5ee47
commit
3de4789c03
1 changed files with 1 additions and 1 deletions
|
@ -186,6 +186,7 @@ local function archetype_move(entityIndex: EntityIndex, to: Archetype,
|
||||||
local destinationColumns = to.columns
|
local destinationColumns = to.columns
|
||||||
local records = to.records
|
local records = to.records
|
||||||
local types = from.types
|
local types = from.types
|
||||||
|
local last = #sourceEntities
|
||||||
|
|
||||||
for i, column in columns do
|
for i, column in columns do
|
||||||
-- Retrieves the new column index from the source archetype's record from each component
|
-- Retrieves the new column index from the source archetype's record from each component
|
||||||
|
@ -197,7 +198,6 @@ local function archetype_move(entityIndex: EntityIndex, to: Archetype,
|
||||||
destinationColumns[tr.column][destinationRow] = column[sourceRow]
|
destinationColumns[tr.column][destinationRow] = column[sourceRow]
|
||||||
end
|
end
|
||||||
-- If the entity is the last row in the archetype then swapping it would be meaningless.
|
-- If the entity is the last row in the archetype then swapping it would be meaningless.
|
||||||
local last = #column
|
|
||||||
if sourceRow ~= last then
|
if sourceRow ~= last then
|
||||||
-- Swap rempves columns to ensure there are no holes in the archetype.
|
-- Swap rempves columns to ensure there are no holes in the archetype.
|
||||||
column[sourceRow] = column[last]
|
column[sourceRow] = column[last]
|
||||||
|
|
Loading…
Reference in a new issue