soulfoam/ecs

destroying entity doesn't effect count and entity still valid

Opened this issue · 0 comments

consider this code

int countEnts(Ecs *ecs) 
{
	int count = 0;
    for (unsigned int i = 0; i < ecs_for_count(ecs); i++)
    {
		EcsEnt e = ecs_get_ent(ecs, i);
		if ( ecs_ent_is_valid(ecs, e) ) count++;
	}
	return count;
}

when entities are destroyed, ecs_ent_is_valid still returns true for that entity and ecs_for_count is unchanged

are destroyed ents eventually over written by new ents ?

should i only be counting ents having a specific common component to all ents ?