Removed variadic arguments from looping linked list functions.
This commit is contained in:
parent
d5ccaee457
commit
7db6164deb
|
|
@ -1 +1 @@
|
|||
Subproject commit 95167c91e8713cf05e9bade6c978903e9f0bdb39
|
||||
Subproject commit a7e3c16ad932e45dcd8efacdf496546e01102bba
|
||||
|
|
@ -62,7 +62,7 @@ inline int door_component_destroy(component_t *component)
|
|||
}
|
||||
|
||||
// Event arg : size_t state, Subscription arg : entity_t *entity
|
||||
static inline int door_component_callback(va_list event_args, void *subscription_data)
|
||||
static inline int door_component_callback(void *event_arg, void *subscription_data)
|
||||
{
|
||||
const entity_t *entity = subscription_data;
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ static inline int door_component_callback(va_list event_args, void *subscription
|
|||
|
||||
door_component_data_t *component_data = door_component->data;
|
||||
|
||||
component_data->state = (bool)va_arg(event_args, size_t);
|
||||
component_data->state = *(size_t *)event_arg;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ inline int interact_component_interact(interact_component_data_t *component_data
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if(event_bus_publish(component_data->topic_id, component_data->state)) return_failure_int;
|
||||
if(event_bus_publish(component_data->topic_id, &component_data->state)) return_failure_int;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ inline int lever_component_destroy(component_t *component)
|
|||
}
|
||||
|
||||
// Event arg : size_t state, Subscription arg : entity_t *entity
|
||||
static inline int lever_component_callback(va_list args, void *subscription_data)
|
||||
static inline int lever_component_callback(void *event_arg, void *subscription_data)
|
||||
{
|
||||
const entity_t *entity = subscription_data;
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ static inline int lever_component_callback(va_list args, void *subscription_data
|
|||
|
||||
lever_component_data_t *component_data = lever_component->data;
|
||||
|
||||
component_data->state = (bool)va_arg(args, size_t);
|
||||
component_data->state = *(size_t *)event_arg;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ inline int physics_system_init(component_t *component)
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
// Args : physics_system_data_t *system_data, size_t entity_id
|
||||
static int action_detect_solve_entities_collision(elem_t *elem, va_list args);
|
||||
// Args : component_t *component
|
||||
static int action_detect_solve_entities_collision(elem_t *elem, void *arg);
|
||||
|
||||
int physics_system_update(component_t *component)
|
||||
{
|
||||
|
|
@ -56,7 +56,7 @@ int physics_system_update(component_t *component)
|
|||
system_data->velocity.y = lerp(system_data->velocity.y, system_data->target_velocity.y, system_data->smoothing_factor);
|
||||
|
||||
if(hitbox_component_data->activated)
|
||||
if(linked_list_for_each(&game.entity_manager.entities, action_detect_solve_entities_collision, system_data, component->entity->id)) return EXIT_FAILURE;
|
||||
if(linked_list_for_each(&game.entity_manager.entities, action_detect_solve_entities_collision, component)) return EXIT_FAILURE;
|
||||
|
||||
transform_component_data->bounds.x += system_data->velocity.x * system_data->speed * (float)game.delta_time_ms / 1000.0f;
|
||||
transform_component_data->bounds.y += system_data->velocity.y * system_data->speed * (float)game.delta_time_ms / 1000.0f;
|
||||
|
|
@ -73,12 +73,13 @@ inline int physics_system_destroy(component_t *component)
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
static inline int action_detect_solve_entities_collision(elem_t *elem, va_list args)
|
||||
static inline int action_detect_solve_entities_collision(elem_t *elem, void *arg)
|
||||
{
|
||||
component_t *physics_system = arg;
|
||||
physics_system_data_t *system_data = physics_system->data;
|
||||
const entity_t *target_entity = elem->data;
|
||||
physics_system_data_t *system_data = va_arg(args, physics_system_data_t *);
|
||||
|
||||
if(target_entity->id == va_arg(args, size_t))
|
||||
if(target_entity->id == physics_system->entity->id)
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,10 +174,10 @@ static inline int player_system_set_animation_and_speed(player_system_data_t *sy
|
|||
}
|
||||
|
||||
// Args : player_system_data_t *system_data
|
||||
static inline int action_detect_activate_interact(elem_t *elem, va_list args)
|
||||
static inline int action_detect_activate_interact(elem_t *elem, void *arg)
|
||||
{
|
||||
const entity_t *target_entity = elem->data;
|
||||
const player_system_data_t *system_data = va_arg(args, player_system_data_t *);
|
||||
const player_system_data_t *system_data = arg;
|
||||
|
||||
const component_t *target_interact_component = entity_get_component(target_entity, INTERACT_COMPONENT);
|
||||
if(!target_interact_component) return EXIT_SUCCESS;
|
||||
|
|
|
|||
Loading…
Reference in New Issue