diff --git a/cv9/snake.c b/cv9/snake.c index f43a6d0..dc16a75 100644 --- a/cv9/snake.c +++ b/cv9/snake.c @@ -1,6 +1,5 @@ #include "snake.h" #include -#include struct snake* add_snake(struct snake* snake,int x,int y){ struct snake* hlavicka = calloc(1,sizeof(struct snake)); @@ -14,7 +13,7 @@ struct snake* add_snake(struct snake* snake,int x,int y){ } struct snake* remove_snake(struct snake* snake){ - if (snake == NULL) { + if (snake == NULL) { return NULL; } @@ -25,11 +24,13 @@ struct snake* remove_snake(struct snake* snake){ if (nova_hlavicka == NULL) { return NULL; } + struct snake* chvost = nova_hlavicka; while (chvost->next != NULL) { chvost = chvost->next; } - assert(chvost->next == NULL); + + chvost->next = NULL; return nova_hlavicka; }