[scene] Improve entity component check

For a component to be on an entity, the entity id in the component
pool's dense array must match the entity.
This commit is contained in:
Bill Currie 2022-10-26 12:34:09 +09:00
parent 52b7f7f308
commit 4df145d76a

View file

@ -194,7 +194,7 @@ COMPINLINE int
Ent_HasComponent (uint32_t ent, uint32_t comp, ecs_registry_t *reg)
{
uint32_t ind = reg->comp_pools[comp].sparse[Ent_Index (ent)];
return ind != nullent;
return reg->comp_pools[comp].dense[ind] == ent;
}
COMPINLINE void *