Fix allocation bug and some other
- Add *.core (core dumps) to .gitignore - Change defines of directions to enumfix-mingw
parent
1d63892d67
commit
793db5f00a
|
@ -1,2 +1,3 @@
|
|||
obj/
|
||||
game
|
||||
*.core
|
||||
|
|
|
@ -4,12 +4,7 @@
|
|||
#include <stdbool.h>
|
||||
#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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue