aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-05 20:29:27 +0100
committerRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-05 20:29:27 +0100
commita9744a89d31759cf9d5a03beede475ff18a9bf2b (patch)
tree4792abe0a77bafafd11456d95440ff7648cec563 /src/main.c
parentint16_tamer (diff)
download42-cub3d-a9744a89d31759cf9d5a03beede475ff18a9bf2b.tar.gz
42-cub3d-a9744a89d31759cf9d5a03beede475ff18a9bf2b.tar.bz2
42-cub3d-a9744a89d31759cf9d5a03beede475ff18a9bf2b.tar.xz
42-cub3d-a9744a89d31759cf9d5a03beede475ff18a9bf2b.tar.zst
42-cub3d-a9744a89d31759cf9d5a03beede475ff18a9bf2b.zip
Changed return values
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 5de43e5..e0a4742 100644
--- a/src/main.c
+++ b/src/main.c
@@ -14,25 +14,32 @@
#include <libft.h>
#include <mlx.h>
#include <cub3d.h>
+#include <unistd.h>
int
- main(void)
+ main(int argc, const char *argv[])
{
t_cub *clist;
+ (void)argv;
+ if (argc < 2)
+ {
+ ft_dprintf(STDERR_FILENO, "Error\n\033[1;31mNo map selected\n\033[0m");
+ return (1);
+ }
if (!(clist = ft_init_cub()))
{
ft_memdel((void**)&clist);
- return (1);
+ return (2);
}
if (!(clist->wlist = ft_init_win()))
{
ft_memdel((void**)&clist->wlist);
ft_memdel((void**)&clist);
- return (1);
+ return (2);
}
ft_print_list(clist);
- ft_parse_map("map/map_one.cub", clist);
+ ft_parse_map(argv[1], clist);
if (ft_init_winlx(clist) < 0)
return (ft_exit(3, clist));
mlx_key_hook(clist->wlist->winptr, ft_key_event, clist);