From 273459283c98b5f10814fdf74c74c2e6a13f10c0 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 13 Mar 2020 18:09:55 +0100 Subject: Not ideal --- src/ft_exit.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'src/ft_exit.c') diff --git a/src/ft_exit.c b/src/ft_exit.c index 5bcc653..6a92dac 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -39,6 +40,8 @@ static void ft_free_words(clist->mlist.map); ft_free_words(clist->mlist.mcmd_words); ft_free_words(clist->sfx.death); + ft_free_words(clist->sfx.pain_one); + ft_free_words(clist->sfx.pain_two); ft_free_words(clist->sfx.trap); ft_free_sprites(clist->mlist.sprite_path); if (!clist->wlist.inited) @@ -76,15 +79,21 @@ static void if (!(tmp = waitpid(clist->mpid, NULL, WNOHANG))) kill(clist->mpid, SIGTERM); wait(&clist->mpid); - if (!(tmp = waitpid(clist->death_pid, NULL, WNOHANG))) - kill(clist->death_pid, SIGTERM); - wait(&clist->death_pid); - if (!(tmp = waitpid(clist->trap_pid, NULL, WNOHANG))) - kill(clist->trap_pid, SIGTERM); - wait(&clist->trap_pid); - if (!(tmp = waitpid(clist->pain_pid, NULL, WNOHANG))) - kill(clist->pain_pid, SIGTERM); - wait(&clist->pain_pid); + if (!(tmp = waitpid(clist->sfx.death_pid, NULL, WNOHANG))) + kill(clist->sfx.death_pid, SIGTERM); + wait(&clist->sfx.death_pid); + if (!(tmp = waitpid(clist->sfx.footstep_pid, NULL, WNOHANG))) + kill(clist->sfx.footstep_pid, SIGTERM); + wait(&clist->sfx.footstep_pid); + if (!(tmp = waitpid(clist->sfx.new_lvl_pid, NULL, WNOHANG))) + kill(clist->sfx.new_lvl_pid, SIGTERM); + wait(&clist->sfx.new_lvl_pid); + if (!(tmp = waitpid(clist->sfx.pain_pid, NULL, WNOHANG))) + kill(clist->sfx.pain_pid, SIGTERM); + wait(&clist->sfx.pain_pid); + if (!(tmp = waitpid(clist->sfx.trap_pid, NULL, WNOHANG))) + kill(clist->sfx.trap_pid, SIGTERM); + wait(&clist->sfx.trap_pid); } int -- cgit v1.2.3