aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_exit.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-13 18:09:55 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-13 18:09:55 +0100
commit273459283c98b5f10814fdf74c74c2e6a13f10c0 (patch)
tree6959619028e32cb5452e7ca6b65cccf5a7ca0072 /src/ft_exit.c
parentNew sfx, clean exit (diff)
download42-cub3d-273459283c98b5f10814fdf74c74c2e6a13f10c0.tar.gz
42-cub3d-273459283c98b5f10814fdf74c74c2e6a13f10c0.tar.bz2
42-cub3d-273459283c98b5f10814fdf74c74c2e6a13f10c0.tar.xz
42-cub3d-273459283c98b5f10814fdf74c74c2e6a13f10c0.tar.zst
42-cub3d-273459283c98b5f10814fdf74c74c2e6a13f10c0.zip
Not ideal
Diffstat (limited to '')
-rw-r--r--src/ft_exit.c27
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