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,11 +89,15 @@ namespace psemek::ecs
|
||||||
{
|
{
|
||||||
// Swap with the last row in that table
|
// Swap with the last row in that table
|
||||||
auto table_entity_handles = table.entity_handles();
|
auto table_entity_handles = table.entity_handles();
|
||||||
table.swap_rows(row, table_entity_handles.size() - 1);
|
auto last_row = table_entity_handles.size() - 1;
|
||||||
table.pop_row();
|
if (row != last_row)
|
||||||
|
{
|
||||||
|
table.swap_rows(row, last_row);
|
||||||
auto swap_handle = table_entity_handles[row];
|
auto swap_handle = table_entity_handles[row];
|
||||||
entities[swap_handle.id].row = row;
|
entities[swap_handle.id].row = row;
|
||||||
}
|
}
|
||||||
|
table.pop_row();
|
||||||
|
}
|
||||||
|
|
||||||
void container::finalize_iteration(detail::table & table)
|
void container::finalize_iteration(detail::table & table)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue