Fix ecs bug when finalizing removal of detached entity in the last row of the old table
This commit is contained in:
parent
0bfedccc7b
commit
fc18c75557
1 changed files with 7 additions and 3 deletions
|
|
@ -89,10 +89,14 @@ namespace psemek::ecs
|
|||
{
|
||||
// Swap with the last row in that table
|
||||
auto table_entity_handles = table.entity_handles();
|
||||
table.swap_rows(row, table_entity_handles.size() - 1);
|
||||
auto last_row = table_entity_handles.size() - 1;
|
||||
if (row != last_row)
|
||||
{
|
||||
table.swap_rows(row, last_row);
|
||||
auto swap_handle = table_entity_handles[row];
|
||||
entities[swap_handle.id].row = row;
|
||||
}
|
||||
table.pop_row();
|
||||
auto swap_handle = table_entity_handles[row];
|
||||
entities[swap_handle.id].row = row;
|
||||
}
|
||||
|
||||
void container::finalize_iteration(detail::table & table)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue