Compare commits

..

No commits in common. "03666c9b615a00fe14f47b854830752db1a90e3e" and "870823f9fc8290a0886d8f902d20c3e5677f072e" have entirely different histories.

2 changed files with 21 additions and 45 deletions

View file

@ -1154,8 +1154,6 @@ do
for archetype_id in idr_t.columns do for archetype_id in idr_t.columns do
local idr_t_archetype = archetypes[archetype_id] local idr_t_archetype = archetypes[archetype_id]
local idr_t_types = idr_t_archetype.types local idr_t_types = idr_t_archetype.types
local to = idr_t_archetype
local children = table.clone(idr_t_archetype.entities) local children = table.clone(idr_t_archetype.entities)
local n = #children local n = #children
@ -1165,10 +1163,7 @@ do
end end
local object = ecs_pair_second(world, id) local object = ecs_pair_second(world, id)
if object ~= delete then if object == delete then
continue
end
local id_record = component_index[id] local id_record = component_index[id]
local flags = id_record.flags local flags = id_record.flags
local flags_delete_mask: number = bit32.band(flags, ECS_ID_DELETE) local flags_delete_mask: number = bit32.band(flags, ECS_ID_DELETE)
@ -1179,7 +1174,7 @@ do
break break
else else
local on_remove = id_record.hooks.on_remove local on_remove = id_record.hooks.on_remove
to = archetype_traverse_remove(world, id, to) local to = archetype_traverse_remove(world, id, idr_t_archetype)
local empty = #to.types == 0 local empty = #to.types == 0
for i = n, 1, -1 do for i = n, 1, -1 do
local child = children[i] local child = children[i]
@ -1193,6 +1188,7 @@ do
end end
end end
end end
end
archetype_destroy(world, idr_t_archetype) archetype_destroy(world, idr_t_archetype)
end end

View file

@ -1333,26 +1333,6 @@ TEST("world:target", function()
CHECK(i == 10) CHECK(i == 10)
end end
do CASE("should return correct targets after deletion") -- ISSUE #207
local world = jecs.World.new()
local Attacks = world:component()
local Eats = world:component()
local a = world:entity()
local b = world:entity()
local c = world:entity()
world:add(a, jecs.pair(Attacks, b))
world:add(a, jecs.pair(Attacks, c))
world:add(a, jecs.pair(Eats, c))
world:add(a, jecs.pair(Eats, b))
world:delete(c)
CHECK(world:target(a, Attacks, 0) == b)
CHECK(not world:target(a, Attacks, 1))
CHECK(not world:target(a, Attacks, 2))
end
end) end)
TEST("world:contains", function() TEST("world:contains", function()