skuska
This commit is contained in:
parent
d34f15fb47
commit
8b6ffcb16b
16
cv9/snake.c
16
cv9/snake.c
@ -18,11 +18,23 @@ struct snake* remove_snake(struct snake* snake){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct snake* nova_hlavicka = snake->next;
|
||||
|
||||
struct snake* nova_hlavicka = snake->next;
|
||||
free(snake);
|
||||
|
||||
assert(nova_hlavicka == NULL || nova_hlavicka->next == NULL);
|
||||
|
||||
if (nova_hlavicka == NULL || nova_hlavicka->next == NULL) {
|
||||
assert(nova_hlavicka == NULL || nova_hlavicka->next == NULL);
|
||||
return nova_hlavicka;
|
||||
}
|
||||
|
||||
|
||||
struct snake* chvost = nova_hlavicka;
|
||||
while (chvost->next != NULL) {
|
||||
chvost = chvost->next;
|
||||
}
|
||||
|
||||
assert(chvost->next == NULL);
|
||||
|
||||
return nova_hlavicka;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user