diff --git a/.gitignore b/.gitignore index 0fd9bb7..c0b3827 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ obj/ game +*.core diff --git a/include/player.h b/include/player.h index 33bc140..e920a90 100644 --- a/include/player.h +++ b/include/player.h @@ -4,12 +4,7 @@ #include #include "food.h" -#define UP 0 -#define RIGHT 1 -#define DOWN 2 -#define LEFT 3 - -typedef int Direction; +typedef enum { UP, RIGHT, DOWN, LEFT} Direction; typedef struct player_node_t PlayerNode; typedef struct player_t Player; diff --git a/src/player.c b/src/player.c index 3cab937..57d51b7 100644 --- a/src/player.c +++ b/src/player.c @@ -45,6 +45,7 @@ bool playerDoTick(Player *player, Food food) { bool food_collision; PlayerNode *new_head = (PlayerNode *)malloc(sizeof(PlayerNode)); + new_head->next = NULL; int head_x = player->head->x; int head_y = player->head->y;