++
This commit is contained in:
parent
dd56776a0e
commit
91ff2ad931
10
cv9/snake.c
10
cv9/snake.c
@ -18,18 +18,14 @@ struct snake* remove_snake(struct snake* snake) {
|
|||||||
// Snake is empty
|
// Snake is empty
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!snake->next) {
|
struct snake* next_part = snake->next;
|
||||||
// Snake has only one part
|
|
||||||
free(snake);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
struct snake* new_head = snake->next;
|
|
||||||
free(snake);
|
free(snake);
|
||||||
return new_head;
|
return next_part;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int is_snake(struct snake* snake, int x, int y) {
|
int is_snake(struct snake* snake, int x, int y) {
|
||||||
while (snake) {
|
while (snake) {
|
||||||
if (snake->x == x && snake->y == y) {
|
if (snake->x == x && snake->y == y) {
|
||||||
|
Loading…
Reference in New Issue
Block a user