Jump to content

CIGI findComponentID does not return ID but index


photo

Recommended Posts

Posted

Hello,

When using CIGI, findComponentID does not return the requested component ID, but the index of the component in the list.

int Cigi::Entity::findComponentID(int entity_type, const char* name)
{
	EntityType* entity = &entity_types[entity_type];
	for (int i = 0; i < entity->components.size(); i++)
		if (entity->components[i].name == name)
			return i; ///< incorrect ! should be: return entity->components[i].id;

	return -1;
}

By the way, a great addition to the API would be to be able to publicly enumerate all known entity type and their component ID.

×
×
  • Create New...