aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r5p2.le-101.fr>2020-02-29 20:56:53 +0100
committerRudy Bousset <rbousset@z2r5p2.le-101.fr>2020-02-29 20:56:53 +0100
commitd9413373ee6f514db934ced28bf8190d55548f66 (patch)
tree1b8ccffc8c4ac1ac280cc2c4e3880b7562acacb6
parentRemoved useless printf (diff)
download42-cub3d-d9413373ee6f514db934ced28bf8190d55548f66.tar.gz
42-cub3d-d9413373ee6f514db934ced28bf8190d55548f66.tar.bz2
42-cub3d-d9413373ee6f514db934ced28bf8190d55548f66.tar.xz
42-cub3d-d9413373ee6f514db934ced28bf8190d55548f66.tar.zst
42-cub3d-d9413373ee6f514db934ced28bf8190d55548f66.zip
in progress
Diffstat (limited to '')
-rw-r--r--inc/cub3d_defines.h14
-rw-r--r--src/ft_key_loop.c2
-rw-r--r--src/ft_parse_map.c2
-rw-r--r--src/ft_save_to_bmp.c12
-rw-r--r--src/main.c14
5 files changed, 32 insertions, 12 deletions
diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h
index f5cfd8a..ec990a4 100644
--- a/inc/cub3d_defines.h
+++ b/inc/cub3d_defines.h
@@ -18,13 +18,13 @@
*/
enum
{
- RET_FINE,
- RET_NO_ARGV,
- RET_FAILED_STRUCTS,
- RET_FAILED_MLX,
- RET_MAP_ERROR,
- RET_NO_MAP,
- RET_READ_ERROR
+ FT_RET_FINE,
+ FT_RET_BAD_ARGV,
+ FT_RET_FAILED_STRUCTS,
+ FT_RET_FAILED_MLX,
+ FT_RET_MAP_ERROR,
+ FT_RET_NO_MAP,
+ FT_RET_READ_ERROR
} retvals;
/*
diff --git a/src/ft_key_loop.c b/src/ft_key_loop.c
index f72125a..a7eaccf 100644
--- a/src/ft_key_loop.c
+++ b/src/ft_key_loop.c
@@ -75,7 +75,7 @@ int
if (cl->mlist->isnlvl)
{
if (ft_warp_level(cl) < 0)
- return (ft_exit(RET_FAILED_STRUCTS, cl));
+ return (ft_exit(FT_RET_FAILED_STRUCTS, cl));
}
i++;
}
diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c
index c2fb593..75eb403 100644
--- a/src/ft_parse_map.c
+++ b/src/ft_parse_map.c
@@ -75,7 +75,7 @@ static void
{
ft_dprintf(STDERR_FILENO, "Error\n");
ft_dprintf(STDERR_FILENO, "\033[31;1mNo map\033[0m\n");
- ft_exit(RET_NO_MAP, clist);
+ ft_exit(FT_RET_NO_MAP, clist);
}
void
diff --git a/src/ft_save_to_bmp.c b/src/ft_save_to_bmp.c
index b5c62b9..a510d6b 100644
--- a/src/ft_save_to_bmp.c
+++ b/src/ft_save_to_bmp.c
@@ -1,3 +1,15 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_save_to_bmp.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/29 20:50:35 by rbousset #+# #+# */
+/* Updated: 2020/02/29 20:50:37 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
#include <libft.h>
#include <cub3d.h>
diff --git a/src/main.c b/src/main.c
index 0e21668..c9a160d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -24,13 +24,13 @@ int
if (argc < 2)
{
ft_dprintf(STDERR_FILENO, "Error\n\033[1;31mNo map selected\n\033[0m");
- return (RET_NO_ARGV);
+ return (FT_RET_BAD_ARGV);
}
if (ft_init_cub3d(&clist) < 0)
- return (RET_FAILED_STRUCTS);
+ return (FT_RET_FAILED_STRUCTS);
ft_parse_map(argv[1], clist);
if (ft_init_winlx(clist) < 0)
- return (ft_exit(3, clist));
+ return (ft_exit(FT_RET_FAILED_MLX, clist));
ft_wall_tex_init(clist);
if (argc < 3)
{
@@ -38,6 +38,14 @@ int
ft_hooks_and_loops(clist->wlist, clist);
}
else if (argc == 3 && !ft_strncmp("--save", argv[2], 7))
+ {
ft_save_to_bmp();
+ return (ft_exit(FT_RET_FINE, clist));
+ }
+ else
+ {
+ ft_dprintf(STDERR_FILENO, "Error\n\033[1;31mBad arguments\n\033[0m");
+ return (ft_exit(FT_RET_BAD_ARGV, clist));
+ }
return (0);
}