Removed useless code.
This commit is contained in:
parent
abf1231aac
commit
c57cfea7f7
|
|
@ -10,12 +10,6 @@
|
|||
|
||||
int create_asset(asset_t *asset, va_list args)
|
||||
{
|
||||
if(!asset)
|
||||
{
|
||||
error_printf("Failed to allocate memory : %d", errno);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
asset->type = va_arg(args, asset_type_t);
|
||||
asset->nb_refs = 0;
|
||||
|
||||
|
|
|
|||
27
src/ecs.c
27
src/ecs.c
|
|
@ -6,12 +6,6 @@
|
|||
|
||||
int create_component(component_t *component, va_list args)
|
||||
{
|
||||
if(!component)
|
||||
{
|
||||
error_printf("Component cannot be NULL");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
component->type = va_arg(args, component_type_t);
|
||||
|
||||
switch(component->type)
|
||||
|
|
@ -41,12 +35,6 @@ int create_component(component_t *component, va_list args)
|
|||
|
||||
inline int destroy_component(component_t *component)
|
||||
{
|
||||
if(!component)
|
||||
{
|
||||
error_printf("Component cannot be NULL");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if(component->deleter(component)) return EXIT_FAILURE;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
|
@ -54,12 +42,6 @@ inline int destroy_component(component_t *component)
|
|||
|
||||
int create_entity(entity_t *entity, va_list args)
|
||||
{
|
||||
if(!entity)
|
||||
{
|
||||
error_printf("Entity cannot be NULL");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
entity->id = va_arg(args, size_t);
|
||||
entity->draw_priority = 0;
|
||||
|
||||
|
|
@ -70,12 +52,6 @@ int create_entity(entity_t *entity, va_list args)
|
|||
|
||||
inline int destroy_entity(entity_t *entity)
|
||||
{
|
||||
if(!entity)
|
||||
{
|
||||
error_printf("Entity cannot be NULL");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if(linked_list_exit(&entity->components)) return EXIT_FAILURE;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
|
@ -85,6 +61,7 @@ component_t *entity_new_component(entity_t *entity, component_type_t component_t
|
|||
{
|
||||
elem_t *component_elem = create_elem(&entity->components, component_type);
|
||||
if(!component_elem) return NULL;
|
||||
|
||||
component_t *component = component_elem->data;
|
||||
|
||||
component->entity = entity;
|
||||
|
|
@ -118,6 +95,7 @@ inline component_t *entity_get_component(const entity_t *entity, component_type_
|
|||
static inline int action_update_component(elem_t *elem, va_list args __attribute__((unused)))
|
||||
{
|
||||
component_t *component = elem->data;
|
||||
|
||||
if(component->update(component)) return EXIT_FAILURE;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
|
@ -135,6 +113,7 @@ inline int update_entity(entity_t *entity)
|
|||
static inline int action_draw_component(elem_t *elem, va_list args __attribute__((unused)))
|
||||
{
|
||||
component_t *component = elem->data;
|
||||
|
||||
if(component->draw) if(component->draw(component)) return EXIT_FAILURE;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ elem_t *linked_list_get_if(const linked_list_t *linked_list, const condition_t c
|
|||
* @param condition Condition to verify
|
||||
* @param ... Argument to pass to the condition
|
||||
*
|
||||
* @return Pointer to element, NULL if no element verify the condition or if an error occurred.
|
||||
* @return EXIT_SUCCESS, EXIT_FAILURE on error.
|
||||
*/
|
||||
int linked_list_remove_if(linked_list_t *linked_list, const condition_t condition, ...);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue