From 69773438b156d74db51287301ae0fdb456fec0a2 Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Sat, 29 Feb 2020 20:39:06 +0100 Subject: Argv in progress --- src/main.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 52bb211..0e21668 100644 --- a/src/main.c +++ b/src/main.c @@ -24,15 +24,20 @@ int if (argc < 2) { ft_dprintf(STDERR_FILENO, "Error\n\033[1;31mNo map selected\n\033[0m"); - return (1); + return (RET_NO_ARGV); } if (ft_init_cub3d(&clist) < 0) - return (2); + return (RET_FAILED_STRUCTS); ft_parse_map(argv[1], clist); if (ft_init_winlx(clist) < 0) return (ft_exit(3, clist)); ft_wall_tex_init(clist); - ft_draw_scene(clist); - ft_hooks_and_loops(clist->wlist, clist); + if (argc < 3) + { + ft_draw_scene(clist); + ft_hooks_and_loops(clist->wlist, clist); + } + else if (argc == 3 && !ft_strncmp("--save", argv[2], 7)) + ft_save_to_bmp(); return (0); } -- cgit v1.2.3