diff options
Diffstat (limited to 'src/ft_exit.c')
-rw-r--r-- | src/ft_exit.c | 27 |
1 files changed, 18 insertions, 9 deletions
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 <stddef.h> #include <stdlib.h> #include <signal.h> +#include <sys/types.h> #include <sys/wait.h> #include <stdint.h> @@ -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 |