diff options
author | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2020-03-05 15:59:52 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2020-03-05 15:59:52 +0100 |
commit | 3a346b70624949dcf7f4bec385c840441c6e3e31 (patch) | |
tree | ca47ed855d8464c35cc5ef892d120391bf1314ec /src | |
parent | Pretty cool (diff) | |
download | 42-cub3d-3a346b70624949dcf7f4bec385c840441c6e3e31.tar.gz 42-cub3d-3a346b70624949dcf7f4bec385c840441c6e3e31.tar.bz2 42-cub3d-3a346b70624949dcf7f4bec385c840441c6e3e31.tar.xz 42-cub3d-3a346b70624949dcf7f4bec385c840441c6e3e31.tar.zst 42-cub3d-3a346b70624949dcf7f4bec385c840441c6e3e31.zip |
Get normed
Diffstat (limited to '')
-rw-r--r-- | src/ft_check_map_line.c | 7 | ||||
-rw-r--r-- | src/ft_check_map_surrounds.c | 2 | ||||
-rw-r--r-- | src/ft_click_close.c | 1 | ||||
-rw-r--r-- | src/ft_draw_hud.c | 1 | ||||
-rw-r--r-- | src/ft_exit.c | 32 | ||||
-rw-r--r-- | src/ft_get_music.c | 2 | ||||
-rw-r--r-- | src/ft_save_to_bmp.c | 8 |
7 files changed, 25 insertions, 28 deletions
diff --git a/src/ft_check_map_line.c b/src/ft_check_map_line.c index 2d69545..7b9b545 100644 --- a/src/ft_check_map_line.c +++ b/src/ft_check_map_line.c @@ -71,7 +71,7 @@ size_t static int8_t ft_check_side_walls(char *line, size_t i, t_cub *clist) { - if ((line [0] != ' ' && line[0] != '1') || line[i - 1] != '1') + if ((line[0] != ' ' && line[0] != '1') || line[i - 1] != '1') { ft_sprintf(clist->errmsg, FT_ERR_MAP_WALLS); return (-1); @@ -100,10 +100,5 @@ int8_t } if (ft_check_side_walls(line, i, clist) < 0) return (-1); - /* if (ft_get_line_len(line) != clist->mlist.map_w) */ - /* { */ - /* ft_sprintf(clist->errmsg, FT_ERR_MAP_LEN); */ - /* return (-1); */ - /* } */ return (0); } diff --git a/src/ft_check_map_surrounds.c b/src/ft_check_map_surrounds.c index 4b3f236..2bf228c 100644 --- a/src/ft_check_map_surrounds.c +++ b/src/ft_check_map_surrounds.c @@ -16,7 +16,7 @@ #include <stdint.h> static int8_t - ft_wall_check(size_t y, size_t x, char** const map) + ft_wall_check(size_t y, size_t x, char **map) { if (map[y + 1][x] == ' ' || map[y - 1][x] == ' ' || diff --git a/src/ft_click_close.c b/src/ft_click_close.c index 02efbe3..113c241 100644 --- a/src/ft_click_close.c +++ b/src/ft_click_close.c @@ -20,7 +20,6 @@ int { (void)keycode; (void)clist; - /* ft_exit(0, clist); */ exit(0); return (0); } diff --git a/src/ft_draw_hud.c b/src/ft_draw_hud.c index 76320f4..f807714 100644 --- a/src/ft_draw_hud.c +++ b/src/ft_draw_hud.c @@ -14,7 +14,6 @@ #include <mlx.h> #include <stdint.h> - static void ft_draw_minimap_back(size_t map_h, size_t map_w, t_win *wl, t_cub *cl) { diff --git a/src/ft_exit.c b/src/ft_exit.c index a63d600..ca5201c 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -38,24 +38,28 @@ static void ft_memdel((void**)&clist->wlist.winptr); } +static void + ft_del_tex(t_cub *clist) +{ + if (clist->tlist[0].img) + mlx_destroy_image(clist->wlist.wlx, clist->tlist[0].img); + if (clist->tlist[1].img) + mlx_destroy_image(clist->wlist.wlx, clist->tlist[1].img); + if (clist->tlist[2].img) + mlx_destroy_image(clist->wlist.wlx, clist->tlist[2].img); + if (clist->tlist[3].img) + mlx_destroy_image(clist->wlist.wlx, clist->tlist[3].img); + if (clist->tlist[4].img) + mlx_destroy_image(clist->wlist.wlx, clist->tlist[4].img); + if (clist->mlist.isnlvl && clist->tlist[5].img) + mlx_destroy_image(clist->wlist.wlx, clist->tlist[5].img); +} + int ft_exit(uint8_t exit_code, t_cub *clist) { if (clist->walltexgood) - { - if (clist->tlist[0].img) - mlx_destroy_image(clist->wlist.wlx, clist->tlist[0].img); - if (clist->tlist[1].img) - mlx_destroy_image(clist->wlist.wlx, clist->tlist[1].img); - if (clist->tlist[2].img) - mlx_destroy_image(clist->wlist.wlx, clist->tlist[2].img); - if (clist->tlist[3].img) - mlx_destroy_image(clist->wlist.wlx, clist->tlist[3].img); - if (clist->tlist[4].img) - mlx_destroy_image(clist->wlist.wlx, clist->tlist[4].img); - if (clist->mlist.isnlvl && clist->tlist[5].img) - mlx_destroy_image(clist->wlist.wlx, clist->tlist[5].img); - } + ft_del_tex(clist); if (clist->wlist.inited) { mlx_destroy_window(clist->wlist.wlx, clist->wlist.winptr); diff --git a/src/ft_get_music.c b/src/ft_get_music.c index fe39361..cdd7039 100644 --- a/src/ft_get_music.c +++ b/src/ft_get_music.c @@ -26,7 +26,7 @@ static void if (!(mlist->music_cmd = (char *)malloc((len + 1) * sizeof(char)))) return ; ft_sprintf(mlist->music_cmd, FT_MUS_CMD, - mlist->music_path); + mlist->music_path); } int8_t diff --git a/src/ft_save_to_bmp.c b/src/ft_save_to_bmp.c index 648cba6..90bbb1f 100644 --- a/src/ft_save_to_bmp.c +++ b/src/ft_save_to_bmp.c @@ -26,11 +26,11 @@ static char if (ft_strrchr(ml->filename, '/')) { if (!(str = (char*)malloc((ft_strlen(FT_BMP_SAVE_DIR) + - ft_strlen(ft_strrchr(ml->filename, '/')+ 1) - + 1) * sizeof(char)))) + ft_strlen(ft_strrchr(ml->filename, '/') + 1) + + 1) * sizeof(char)))) return (NULL); ft_sprintf(str, "%s%s", FT_BMP_SAVE_DIR, - ft_strrchr(ml->filename, '/') + 1); + ft_strrchr(ml->filename, '/') + 1); } else { @@ -91,7 +91,7 @@ static int8_t bmp_info.height = h; bmp_info.bit_count = 24; bmp_info.size_image = size; - if (!(fd = open(fname, O_RDWR | O_CREAT , 0644))) + if (!(fd = open(fname, O_RDWR | O_CREAT, 0644))) return (-1); write(fd, &bmp_file, sizeof(t_bmp_file)); write(fd, &bmp_info, sizeof(t_bmp_info)); |