Adding const to entity get component.
This commit is contained in:
parent
a4b970636b
commit
d648bcbb9b
|
|
@ -103,14 +103,10 @@ static inline bool condition_is_component_type(elem_t *elem, va_list args)
|
|||
return ((component_t *)elem->data)->type == va_arg(args, component_type_t);
|
||||
}
|
||||
|
||||
inline component_t *entity_get_component(entity_t *entity, component_type_t component_type)
|
||||
inline component_t *entity_get_component(const entity_t *entity, component_type_t component_type)
|
||||
{
|
||||
elem_t *component_elem = linked_list_get_if(&entity->components, condition_is_component_type, component_type);
|
||||
if(!component_elem)
|
||||
{
|
||||
error_printf("Entity with id:%lu doesn't have componant of type : %d", entity->id, component_type);
|
||||
return NULL;
|
||||
}
|
||||
if(!component_elem) return NULL;
|
||||
|
||||
component_t *component = component_elem->data;
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ int destroy_entity(entity_t *entity);
|
|||
|
||||
component_t *entity_new_component(entity_t *entity, component_type_t component_type);
|
||||
|
||||
component_t *entity_get_component(entity_t *entity, component_type_t component_type);
|
||||
component_t *entity_get_component(const entity_t *entity, component_type_t component_type);
|
||||
|
||||
int update_entity(entity_t *entity);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue