Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int destroy_obstacle(WINDOW * win_game, struct obstaclelist * olist, struct obstacle * target_ob)
- {
- mvwaddch(win_game, ob->y_pos, ob->x_pos, ' ');
- wrefresh(win_game);
- struct obstacle * prev;
- struct obstacle * cur;
- int state = EXIT_FAILURE;
- if (target_ob == olist->head)
- {
- olist->head = target_ob->next;
- free(target_ob);
- state = EXIT_SUCCESS;
- olist->count--;
- }
- else
- {
- /* Go through the list */
- for (cur = olist->head; cur != NULL; prev = cur, cur = cur->next)
- {
- if (cur == target_ob)
- {
- prev->next = cur->next;
- free(cur);
- state = EXIT_SUCCESS;
- olist->count--;
- break;
- }
- }
- }
- return state;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement