Compare commits
No commits in common. "54ae7038b850221bfed2ef5e2fdf192d24bc59f0" and "0e9dc3b10e62011708c977b9616c52557cb3c5d5" have entirely different histories.
54ae7038b8
...
0e9dc3b10e
|
@ -21,14 +21,14 @@ typedef struct animation_system_data_t {
|
|||
linked_list_t frames;
|
||||
} animation_system_data_t;
|
||||
|
||||
void animation_system_init(component_t *component, va_list args);
|
||||
void animation_system_init(component_t *, va_list);
|
||||
|
||||
void animation_system_update(component_t *component);
|
||||
void animation_system_update(component_t *);
|
||||
|
||||
void animation_system_destroy(component_t *component);
|
||||
void animation_system_destroy(component_t *);
|
||||
|
||||
void animation_system_create_frames_clips(animation_system_data_t *system_data);
|
||||
void animation_system_create_frames_clips(animation_system_data_t *);
|
||||
|
||||
void animation_system_change_animation(animation_system_data_t *system_data, const char *name, size_t nb_frames);
|
||||
void animation_system_change_animation(animation_system_data_t *, const char *, size_t);
|
||||
|
||||
#endif // SPRITE_COMPONENT_H
|
|
@ -5,6 +5,7 @@
|
|||
#include "sprite_component.h"
|
||||
#include "animation_system.h"
|
||||
#include "player_system.h"
|
||||
#include "enemy_system.h"
|
||||
// Add new components header file here
|
||||
|
||||
#endif // COMPONENTS_H
|
|
@ -54,6 +54,17 @@ component_t *create_component(component_type_t component_type)
|
|||
component->component_deleter = player_system_destroy;
|
||||
break;
|
||||
|
||||
case ENEMY_SYSTEM:
|
||||
component->component_init = enemy_system_init;
|
||||
component->component_update = enemy_system_update;
|
||||
component->component_draw = NULL;
|
||||
|
||||
component->component_data.enemy_system_data = kmalloc(sizeof(enemy_system_data_t), NULL);
|
||||
if(!component->component_data.enemy_system_data) return NULL;
|
||||
|
||||
component->component_deleter = enemy_system_destroy;
|
||||
break;
|
||||
|
||||
// Add new components attributions here
|
||||
|
||||
default:
|
||||
|
|
|
@ -8,13 +8,15 @@ typedef enum component_type_t {
|
|||
TRANSFORM_COMPONENT,
|
||||
SPRITE_COMPONENT,
|
||||
ANIMATION_SYSTEM,
|
||||
PLAYER_SYSTEM
|
||||
PLAYER_SYSTEM,
|
||||
ENEMY_SYSTEM,
|
||||
} component_type_t;
|
||||
|
||||
typedef struct transform_component_data_t transform_component_data_t;
|
||||
typedef struct sprite_component_data_t sprite_component_data_t;
|
||||
typedef struct animation_system_data_t animation_system_data_t;
|
||||
typedef struct player_system_data_t player_system_data_t;
|
||||
typedef struct enemy_system_data_t enemy_system_data_t;
|
||||
|
||||
typedef struct component_t component_t;
|
||||
|
||||
|
@ -38,6 +40,7 @@ typedef struct component_t {
|
|||
sprite_component_data_t *sprite_component_data;
|
||||
animation_system_data_t *animation_system_data;
|
||||
player_system_data_t *player_system_data;
|
||||
enemy_system_data_t *enemy_system_data;
|
||||
} component_data;
|
||||
|
||||
component_deleter_t component_deleter;
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
#include <gint/kmalloc.h>
|
||||
#include "enemy_system.h"
|
||||
#include "animation_system.h"
|
||||
#include "sprite_component.h"
|
||||
#include "transform_component.h"
|
||||
#include "../game.h"
|
||||
|
||||
// No args
|
||||
void enemy_system_init(component_t *component, va_list args __attribute__((unused)))
|
||||
{
|
||||
enemy_system_data_t *system_data = component->component_data.enemy_system_data;
|
||||
|
||||
system_data->animation_system_data = get_component(component->entity, ANIMATION_SYSTEM)->component_data.animation_system_data;
|
||||
system_data->sprite_component_data = system_data->animation_system_data->sprite_component_data;
|
||||
system_data->transform_component_data = system_data->sprite_component_data->transform_component_data;
|
||||
|
||||
system_data->state = ENEMY_IDLE;
|
||||
}
|
||||
|
||||
// Only for this file
|
||||
static void enemy_system_get_inputs(enemy_system_data_t *system_data)
|
||||
{
|
||||
system_data->last_state = system_data->state;
|
||||
|
||||
system_data->state &= 0xF0; // 11110000
|
||||
|
||||
system_data->state |= game.event.keys[KEY_UP] * ENEMY_RUNNING_UP;
|
||||
system_data->state |= game.event.keys[KEY_DOWN] * ENEMY_RUNNING_DOWN;
|
||||
system_data->state |= game.event.keys[KEY_LEFT] * ENEMY_RUNNING_LEFT;
|
||||
system_data->state |= game.event.keys[KEY_RIGHT] * ENEMY_RUNNING_RIGHT;
|
||||
|
||||
// Special cases
|
||||
if(system_data->state & ENEMY_RUNNING_UP && system_data->state & ENEMY_RUNNING_DOWN) system_data->state &= 0xFC; // 11111100
|
||||
if(system_data->state & ENEMY_RUNNING_LEFT && system_data->state & ENEMY_RUNNING_RIGHT) system_data->state &= 0xF3; // 11110011
|
||||
}
|
||||
|
||||
// Only for this file
|
||||
static void enemy_system_set_velocity(enemy_system_data_t *system_data)
|
||||
{
|
||||
transform_component_data_t *transform_component_data = system_data->transform_component_data;
|
||||
|
||||
transform_component_data->velocity.x =
|
||||
(float)((system_data->state & ENEMY_RUNNING_RIGHT) >> 3) - (float)((system_data->state & ENEMY_RUNNING_LEFT) >> 2);
|
||||
transform_component_data->velocity.y =
|
||||
(float)((system_data->state & ENEMY_RUNNING_DOWN) >> 1) - (float)(system_data->state & ENEMY_RUNNING_UP);
|
||||
|
||||
if(is_not_zero(transform_component_data->velocity.x) && is_not_zero(transform_component_data->velocity.y))
|
||||
{
|
||||
transform_component_data->velocity.x *= 0.707106781186548f;
|
||||
transform_component_data->velocity.y *= 0.707106781186548f;
|
||||
}
|
||||
}
|
||||
|
||||
// Only for this file
|
||||
static void enemy_system_set_animation(enemy_system_data_t *system_data)
|
||||
{
|
||||
sprite_component_data_t *sprite_component_data = system_data->sprite_component_data;
|
||||
animation_system_data_t *animation_system_data = system_data->animation_system_data;
|
||||
|
||||
if(system_data->state & ENEMY_RUNNING_LEFT) sprite_component_data->flip = true;
|
||||
if(system_data->state & ENEMY_RUNNING_RIGHT) sprite_component_data->flip = false;
|
||||
|
||||
if((system_data->state & ENEMY_RUNNING) && !(system_data->last_state & ENEMY_RUNNING))
|
||||
{
|
||||
animation_system_data->frame_delay_ms = ENEMY_DEFAULT_RUN_ANIMATION_SPEED;
|
||||
animation_system_change_animation(animation_system_data, "enemy_run_sheet", 6);
|
||||
}
|
||||
else if(!(system_data->state & ENEMY_RUNNING) && (system_data->last_state & ENEMY_RUNNING))
|
||||
{
|
||||
animation_system_data->actual_frame_nb = 0;
|
||||
animation_system_data->frame_delay_ms = ENEMY_DEFAULT_IDLE_ANIMATION_SPEED;
|
||||
animation_system_change_animation(animation_system_data, "enemy_idle_sheet", 4);
|
||||
}
|
||||
}
|
||||
|
||||
void enemy_system_update(component_t *component)
|
||||
{
|
||||
enemy_system_data_t *system_data = component->component_data.enemy_system_data;
|
||||
|
||||
enemy_system_get_inputs(system_data);
|
||||
enemy_system_set_velocity(system_data);
|
||||
enemy_system_set_animation(system_data);
|
||||
}
|
||||
|
||||
void enemy_system_destroy(component_t *component)
|
||||
{
|
||||
kfree(component->component_data.enemy_system_data);
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef ENEMY_SYSTEM_H
|
||||
#define ENEMY_SYSTEM_H
|
||||
|
||||
#include "ecs.h"
|
||||
|
||||
#define ENEMY_DEFAULT_SPEED 80.0f // px / s
|
||||
#define ENEMY_DEFAULT_IDLE_ANIMATION_SPEED 250.0f // ms / frame
|
||||
#define ENEMY_DEFAULT_RUN_ANIMATION_SPEED 160.0f // ms / frame
|
||||
|
||||
typedef enum enemy_state_t {
|
||||
ENEMY_IDLE = 0x00, // 00000000
|
||||
ENEMY_RUNNING_UP = 0x01, // 00000001
|
||||
ENEMY_RUNNING_DOWN = 0x02, // 00000010
|
||||
ENEMY_RUNNING_LEFT = 0x04, // 00000100
|
||||
ENEMY_RUNNING_RIGHT = 0x08, // 00001000
|
||||
ENEMY_RUNNING = 0x0F, // 00001111
|
||||
ENEMY_DEATH = 0x80 // 10000000
|
||||
} enemy_state_t;
|
||||
|
||||
typedef struct enemy_system_data_t {
|
||||
transform_component_data_t *transform_component_data;
|
||||
sprite_component_data_t *sprite_component_data;
|
||||
animation_system_data_t *animation_system_data;
|
||||
|
||||
enemy_state_t state;
|
||||
enemy_state_t last_state;
|
||||
} enemy_system_data_t;
|
||||
|
||||
void enemy_system_init(component_t *, va_list);
|
||||
|
||||
void enemy_system_update(component_t *);
|
||||
|
||||
void enemy_system_destroy(component_t *);
|
||||
|
||||
#endif // ENEMY_SYSTEM_H
|
|
@ -2,11 +2,8 @@
|
|||
#define EVENT_H
|
||||
|
||||
#include <gint/keycodes.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/* event_t: Events struct
|
||||
Store events for inputs
|
||||
@keys Addressable array containing boolean state of each key */
|
||||
// Base struct
|
||||
typedef struct event_t {
|
||||
bool keys[0xa6];
|
||||
} event_t;
|
||||
|
|
|
@ -223,6 +223,7 @@ void linked_list_insert(linked_list_t *linked_list, void *data, const size_t ind
|
|||
void linked_list_remove_elem(linked_list_t *linked_list, elem_t *elem)
|
||||
{
|
||||
if(!elem) return;
|
||||
if(!elem->prev && !elem->next) return;
|
||||
|
||||
if(elem == linked_list->first)
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <gint/defs/types.h>
|
||||
|
||||
/* elem_t: Element struct for linked lists
|
||||
/* elem_t: Element base for linked lists
|
||||
This struct is the base for storing data.
|
||||
|
||||
@data Raw pointer to any type of data
|
||||
|
@ -15,7 +15,7 @@ typedef struct elem_t {
|
|||
struct elem_t *next;
|
||||
} elem_t;
|
||||
|
||||
/* deleter_t: A type for deleters used during the destruction of data stored in elements
|
||||
/* deleter_t: A type for deleters used during the destruction of elements
|
||||
|
||||
During the initialisation of linked lists you can pass in argument a deleter.
|
||||
It is used during the destruction of an element.
|
||||
|
@ -24,11 +24,11 @@ typedef struct elem_t {
|
|||
|
||||
void name_of_your_deleter(void *data);
|
||||
|
||||
Then do what you need to destroy your data (don't forget to free the data itself...).
|
||||
You should always define your function with "inline" if it's no too long. */
|
||||
typedef void (*deleter_t)(void *data);
|
||||
Then do what you need to destroy your data (don't forget to kfree the data itself...).
|
||||
You can define your function with "inline" if the deleting is short. */
|
||||
typedef void (*deleter_t)(void *);
|
||||
|
||||
/* condition_t: A type for condition used for function like linked_list_remove_if
|
||||
/* condition_t: A type for condition used for conditionned function like linked_list_remove_if
|
||||
|
||||
For function like linked_list_remove_if you need a condition.
|
||||
It have two argument which are "elem_t *" and "va_list", that is because it passes the element on the actual index
|
||||
|
@ -38,8 +38,8 @@ typedef void (*deleter_t)(void *data);
|
|||
bool name_of_your_condition(elem_t *elem, va_list);
|
||||
|
||||
Then return true if you want the element to be removed from the list or false if not.
|
||||
You should always define your function with static, and inline if the condition is not too long. */
|
||||
typedef bool (*condition_t)(elem_t *elem, va_list args);
|
||||
You can define your function with "static inline" if the condition is short. */
|
||||
typedef bool (*condition_t)(elem_t *, va_list);
|
||||
|
||||
/* action_t: A type for action used for function like linked_list_for_each
|
||||
|
||||
|
@ -50,18 +50,18 @@ typedef bool (*condition_t)(elem_t *elem, va_list args);
|
|||
|
||||
void name_of_your_condition(elem_t *elem, va_list);
|
||||
|
||||
Then do whatever you want with the element data, just don't remove it lol.
|
||||
You should alwaus define your function with static, and inline if the action is short. */
|
||||
typedef void (*action_t)(elem_t *elem, va_list args);
|
||||
Then do whatever you want with the element data, just don't remove it XD.
|
||||
You can define your function with "static inline" if the condition is short. */
|
||||
typedef void (*action_t)(elem_t *, va_list);
|
||||
|
||||
/* linked_list_t: Base of linked lists
|
||||
This struct is the base for creating linked lists.
|
||||
|
||||
@data_size Size of the data stored in elements of the linked list
|
||||
@data_size Size of the data stored in the linked list
|
||||
@first Pointer to the first element in the linked list
|
||||
@last Pointer to the last element in the linked list
|
||||
@size Size of the linked list
|
||||
@deleter Deleter of the data when removing an element */
|
||||
@deleter Deleter of the data when removing an element*/
|
||||
typedef struct linked_list_t {
|
||||
size_t data_size;
|
||||
elem_t *first;
|
||||
|
@ -73,21 +73,19 @@ typedef struct linked_list_t {
|
|||
/* linked_list_init(): Init a linked_list_t
|
||||
This function is necessary if you create a linked list.
|
||||
|
||||
It doesn't allocate the memory for you !
|
||||
|
||||
@linked_list Pointer to an linked_list_t
|
||||
@data_size Data size for elements in the linked list */
|
||||
void linked_list_init(linked_list_t *linked_list, const size_t data_size, deleter_t deleter);
|
||||
@data_size Data size for the linked list */
|
||||
void linked_list_init(linked_list_t *, const size_t, deleter_t deleter);
|
||||
|
||||
/* elem_create(): Create an elem to fill with data to insert in a linked list.
|
||||
This function is usefull when you want to initialise an elem with the proper data_size strored in the linked list.
|
||||
/* elem_create(): Create an elem to fill with data and insert in a linked list.
|
||||
This function is usefull when you want to initialise an elem with the proper data_size.
|
||||
WARNING : Don't change the "data" ptr after calling this function or it will lead to memory leaks !
|
||||
Instead do something like this :
|
||||
*(int *)elem->data = 42;
|
||||
|
||||
@linked_list Pointer to an linked_list_t
|
||||
Return adress of initialised elem, NULL on error. */
|
||||
elem_t *elem_create(const linked_list_t *linked_list);
|
||||
elem_t *elem_create(const linked_list_t *);
|
||||
|
||||
/* destroy_elem(): Destroy the given element and its data.
|
||||
This function is usefull when you want to free an element.
|
||||
|
@ -95,79 +93,79 @@ elem_t *elem_create(const linked_list_t *linked_list);
|
|||
|
||||
@elem Pointer to an elem_t
|
||||
Free the given elem. */
|
||||
void destroy_elem(elem_t *elem, const deleter_t elem_deleter);
|
||||
void destroy_elem(elem_t *, const deleter_t);
|
||||
|
||||
/* linked_list_push_back_elem(): Insert an elem_t from the back in a linked_list_t.
|
||||
|
||||
@linked_list Pointer to an linked_list_t
|
||||
@elem Pointer to an elem_t
|
||||
Insert elem in the back of the linked list, do nothing on error. */
|
||||
void linked_list_push_back_elem(linked_list_t *linked_list, elem_t *elem);
|
||||
void linked_list_push_back_elem(linked_list_t *, elem_t *);
|
||||
|
||||
/* linked_list_push_front_elem(): Insert an elem_t from the front in a linked_list_t.
|
||||
|
||||
@linked_list Pointer to an linked_list_t
|
||||
@elem Pointer to an elem_t
|
||||
Insert elem in the front of the linked list, do nothing on error. */
|
||||
void linked_list_push_front_elem(linked_list_t *linked_list, elem_t *elem);
|
||||
void linked_list_push_front_elem(linked_list_t *, elem_t *);
|
||||
|
||||
/* linked_list_push_back_elem(): Insert an elem_t initialised and filled with data from the back in a linked_list_t.
|
||||
/* linked_list_push_back_elem(): Insert an elem_t filled with data from the back in a linked_list_t.
|
||||
|
||||
@linked_list Pointer to an linked_list_t
|
||||
@data Pointer to any data
|
||||
Insert elem filled with data in the back of the linked list, do nothing on error. */
|
||||
void linked_list_push_back(linked_list_t *linked_list, void *data);
|
||||
void linked_list_push_back(linked_list_t *, void *);
|
||||
|
||||
/* linked_list_push_front_elem(): Insert an elem_t filled with data from the front in a linked_list_t.
|
||||
|
||||
@linked_list Pointer to an linked_list_t
|
||||
@data Pointer to any data
|
||||
Insert elem filled with data in the front of the linked list, do nothing on error. */
|
||||
void linked_list_push_front(linked_list_t *linked_list, void *data);
|
||||
void linked_list_push_front(linked_list_t *, void *);
|
||||
|
||||
/* linked_list_pop_back(): Delete the last elem in the given linked list
|
||||
|
||||
@linked_list Pointer to an linked_list_t
|
||||
Delete last elem of the linked list, do nothing on error. */
|
||||
void linked_list_pop_back(linked_list_t *linked_list);
|
||||
void linked_list_pop_back(linked_list_t *);
|
||||
|
||||
/* linked_list_pop_front(): Delete the first elem in the given linked list
|
||||
|
||||
@linked_list Pointer to an linked_list_t
|
||||
Delete first elem of the linked list, do nothing on error. */
|
||||
void linked_list_pop_front(linked_list_t *linked_list);
|
||||
void linked_list_pop_front(linked_list_t *);
|
||||
|
||||
/* linked_list_clear(): Clear the given linked list
|
||||
|
||||
@linked_list Pointer to an linked_list_t
|
||||
Clear linked list. */
|
||||
void linked_list_clear(linked_list_t *linked_list);
|
||||
void linked_list_clear(linked_list_t *);
|
||||
|
||||
/* linked_list_is_empty(): Check if the given linked list is empty
|
||||
|
||||
@linked_list Pointer to an linked_list_t
|
||||
Return true if the given linked list is empty else false. */
|
||||
bool linked_list_is_empty(const linked_list_t *linked_list);
|
||||
bool linked_list_is_empty(const linked_list_t *);
|
||||
|
||||
/* linked_list_is_in_bound(): Check if the given index is whithin the range of the linked list
|
||||
|
||||
@linked_list Pointer to an linked_list_t
|
||||
Return true if the given linked list is empty else false. */
|
||||
bool linked_list_is_in_bound(const linked_list_t *linked_list, const size_t index);
|
||||
bool linked_list_is_in_bound(const linked_list_t *, const size_t);
|
||||
|
||||
/* linked_list_get_elem(): Get element at the given index in the linked list
|
||||
|
||||
@linked_list Pointer to an linked_list_t
|
||||
@index Index of the wanted element
|
||||
Return the element, NULL on error. */
|
||||
elem_t *linked_list_get_elem(const linked_list_t *linked_list, const size_t index);
|
||||
elem_t *linked_list_get_elem(const linked_list_t *, const size_t);
|
||||
|
||||
/* linked_list_get(): Get data in the element at the given index in the linked list
|
||||
|
||||
@linked_list Pointer to an linked_list_t
|
||||
@index Index of the wanted element
|
||||
Return the data, NULL on error. */
|
||||
void *linked_list_get(const linked_list_t *linked_list, const size_t index);
|
||||
void *linked_list_get(const linked_list_t *, const size_t);
|
||||
|
||||
/* linked_list_insert_elem(): Insert element at the given index in the linked list
|
||||
|
||||
|
@ -175,7 +173,7 @@ void *linked_list_get(const linked_list_t *linked_list, const size_t index);
|
|||
@elem Pointer to an element
|
||||
@index Index of the wanted element
|
||||
Insert the element, do nothing on error. */
|
||||
void linked_list_insert_elem(linked_list_t *linked_list, elem_t *elem, const size_t index);
|
||||
void linked_list_insert_elem(linked_list_t *, elem_t *, const size_t);
|
||||
|
||||
/* linked_list_insert(): Insert element with data at the given index in the linked list
|
||||
|
||||
|
@ -183,21 +181,21 @@ void linked_list_insert_elem(linked_list_t *linked_list, elem_t *elem, const siz
|
|||
@data Data to put in the new element
|
||||
@index Index of the wanted element
|
||||
Return the element, do nothing on error. */
|
||||
void linked_list_insert(linked_list_t *linked_list, void *data, const size_t index);
|
||||
void linked_list_insert(linked_list_t *, void *, const size_t);
|
||||
|
||||
/* linked_list_remove_elem(): Remove the given elem in the linked list
|
||||
|
||||
@linked_list Pointer to an linked_list_t
|
||||
@elem Element to remove
|
||||
Remove the element, do nothing on error. */
|
||||
void linked_list_remove_elem(linked_list_t *linked_list, elem_t *elem);
|
||||
void linked_list_remove_elem(linked_list_t *, elem_t *);
|
||||
|
||||
/* linked_list_remove(): Remove element at the given index in the linked list
|
||||
|
||||
@linked_list Pointer to an linked_list_t
|
||||
@index Index of the element
|
||||
Remove the element, do nothing on error. */
|
||||
void linked_list_remove(linked_list_t *linked_list, const size_t index);
|
||||
void linked_list_remove(linked_list_t *, const size_t);
|
||||
|
||||
/* linked_list_get_elem_if(): Return first element that the condition verify
|
||||
|
||||
|
@ -205,7 +203,7 @@ void linked_list_remove(linked_list_t *linked_list, const size_t index);
|
|||
@condition Condition to verify
|
||||
@... Argument to pass to the condition
|
||||
Return the element, NULL on error. */
|
||||
elem_t *linked_list_get_elem_if(const linked_list_t *linked_list, const condition_t condition, ...);
|
||||
elem_t *linked_list_get_elem_if(const linked_list_t *, const condition_t, ...);
|
||||
|
||||
/* linked_list_get_if(): Return data in the first element that the condition verify
|
||||
|
||||
|
@ -213,7 +211,7 @@ elem_t *linked_list_get_elem_if(const linked_list_t *linked_list, const conditio
|
|||
@condition Condition to verify
|
||||
@... Argument to pass to the condition
|
||||
Return the element data, NULL on error. */
|
||||
void *linked_list_get_if(const linked_list_t *linked_list, const condition_t condition, ...);
|
||||
void *linked_list_get_if(const linked_list_t *, const condition_t, ...);
|
||||
|
||||
/* linked_list_remove_if(): Remove element(s) that the condition verify
|
||||
|
||||
|
@ -221,7 +219,7 @@ void *linked_list_get_if(const linked_list_t *linked_list, const condition_t con
|
|||
@condition Condition to verify
|
||||
@... Argument to pass to the condition
|
||||
Remove the element(s), do nothing on error. */
|
||||
void linked_list_remove_if(linked_list_t *linked_list, const condition_t condition, ...);
|
||||
void linked_list_remove_if(linked_list_t *, const condition_t, ...);
|
||||
|
||||
/* linked_list_for_each(): Apply the condition to every elements in the list
|
||||
Useful for changing a value in every single element data.
|
||||
|
@ -230,6 +228,6 @@ void linked_list_remove_if(linked_list_t *linked_list, const condition_t conditi
|
|||
@linked_list Pointer to an linked_list_t
|
||||
@condition Condition to apply
|
||||
@... Argument to pass to the condition */
|
||||
void linked_list_for_each(const linked_list_t *linked_list, const action_t action, ...);
|
||||
void linked_list_for_each(const linked_list_t *, const action_t, ...);
|
||||
|
||||
#endif // LINKED_LIST_H
|
|
@ -82,7 +82,7 @@ int main(void)
|
|||
dclear(C_WHITE);
|
||||
|
||||
linked_list_t linked_list;
|
||||
linked_list_init(&linked_list, sizeof(int), NULL);
|
||||
linked_list_init(&linked_list, sizeof(int));
|
||||
if(linked_list.first == linked_list.last &&
|
||||
linked_list.first == NULL)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue