diff options
author | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2020-02-02 18:12:45 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r5p6.le-101.fr> | 2020-02-02 18:12:56 +0100 |
commit | 95670611b3636932b6e64c3e485a4e4bf40d8b07 (patch) | |
tree | 77a588ad4c2b9ac84bfc124f8fab37887d7d8bf8 | |
parent | Norme (diff) | |
download | 42-cub3d-95670611b3636932b6e64c3e485a4e4bf40d8b07.tar.gz 42-cub3d-95670611b3636932b6e64c3e485a4e4bf40d8b07.tar.bz2 42-cub3d-95670611b3636932b6e64c3e485a4e4bf40d8b07.tar.xz 42-cub3d-95670611b3636932b6e64c3e485a4e4bf40d8b07.tar.zst 42-cub3d-95670611b3636932b6e64c3e485a4e4bf40d8b07.zip |
Norme again
Diffstat (limited to '')
-rw-r--r-- | inc/cub3d.h | 13 | ||||
-rw-r--r-- | src/ft_check_map_line.c | 17 | ||||
-rw-r--r-- | src/ft_check_missing.c | 17 | ||||
-rw-r--r-- | src/ft_drawmap.c | 15 | ||||
-rw-r--r-- | src/ft_drawsquare.c | 15 | ||||
-rw-r--r-- | src/ft_exit.c | 17 | ||||
-rw-r--r-- | src/ft_free_words.c | 17 | ||||
-rw-r--r-- | src/ft_get_colors.c | 19 | ||||
-rw-r--r-- | src/ft_get_map.c | 21 | ||||
-rw-r--r-- | src/ft_get_res.c | 19 | ||||
-rw-r--r-- | src/ft_get_sprite.c | 15 | ||||
-rw-r--r-- | src/ft_get_tex.c | 21 | ||||
-rw-r--r-- | src/ft_init_lists.c | 17 | ||||
-rw-r--r-- | src/ft_init_winlx.c | 17 | ||||
-rw-r--r-- | src/ft_key_events.c | 23 | ||||
-rw-r--r-- | src/ft_map_error.c | 15 | ||||
-rw-r--r-- | src/ft_parse_map.c | 35 | ||||
-rw-r--r-- | src/ft_print_list.c | 15 | ||||
-rw-r--r-- | src/ft_select_get.c | 33 | ||||
-rw-r--r-- | src/main.c | 13 |
20 files changed, 313 insertions, 61 deletions
diff --git a/inc/cub3d.h b/inc/cub3d.h index c8bf278..011a4d0 100644 --- a/inc/cub3d.h +++ b/inc/cub3d.h @@ -1,3 +1,16 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* cub3d.h .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:43 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:43 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #ifndef CUB3D_H #define CUB3D_H diff --git a/src/ft_check_map_line.c b/src/ft_check_map_line.c index 0d164cd..5ca8bcf 100644 --- a/src/ft_check_map_line.c +++ b/src/ft_check_map_line.c @@ -1,9 +1,22 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_check_map_line.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:10 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:11 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <cub3d.h> #include <stdint.h> size_t -ft_get_line_len(char *line) + ft_get_line_len(char *line) { size_t i; size_t j; @@ -20,7 +33,7 @@ ft_get_line_len(char *line) } int8_t -ft_check_map_line(char *line, uint8_t l, t_cub *clist) + ft_check_map_line(char *line, uint8_t l, t_cub *clist) { size_t i; diff --git a/src/ft_check_missing.c b/src/ft_check_missing.c index ed86a32..4d7713d 100644 --- a/src/ft_check_missing.c +++ b/src/ft_check_missing.c @@ -1,9 +1,22 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_check_missing.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:12 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:13 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <cub3d.h> #include <unistd.h> int -ft_missing_error(const char *err, t_cub *clist) + ft_missing_error(const char *err, t_cub *clist) { ft_dprintf(STDERR_FILENO, "Error\n"); ft_dprintf(STDERR_FILENO, @@ -12,7 +25,7 @@ ft_missing_error(const char *err, t_cub *clist) } int -ft_check_missing(t_cub *clist) + ft_check_missing(t_cub *clist) { if (!clist->no_tex_path) return (ft_missing_error("north side texture", clist)); diff --git a/src/ft_drawmap.c b/src/ft_drawmap.c index 172a637..4063695 100644 --- a/src/ft_drawmap.c +++ b/src/ft_drawmap.c @@ -1,8 +1,21 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_drawmap.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:18 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:19 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <cub3d.h> void -ft_drawmap(t_cub *clist) + ft_drawmap(t_cub *clist) { int x; int y; diff --git a/src/ft_drawsquare.c b/src/ft_drawsquare.c index 3bf891b..211f122 100644 --- a/src/ft_drawsquare.c +++ b/src/ft_drawsquare.c @@ -1,8 +1,21 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_drawsquare.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:22 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:22 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <mlx.h> #include <cub3d.h> void -ft_drawsquare(int a, int b, int rgb, t_cub *clist) + ft_drawsquare(int a, int b, int rgb, t_cub *clist) { int x; int y; diff --git a/src/ft_exit.c b/src/ft_exit.c index 6631c34..1e926ce 100644 --- a/src/ft_exit.c +++ b/src/ft_exit.c @@ -1,3 +1,16 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_exit.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:23 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:23 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <cub3d.h> #include <mlx.h> @@ -6,7 +19,7 @@ #include <inttypes.h> static void -ft_free_lists(t_cub *clist) + ft_free_lists(t_cub *clist) { ft_memdel((void**)&clist->no_tex_path); ft_memdel((void**)&clist->so_tex_path); @@ -23,7 +36,7 @@ ft_free_lists(t_cub *clist) } int -ft_exit(uint8_t exit_code, t_cub *clist) + ft_exit(uint8_t exit_code, t_cub *clist) { if (clist->wlist->inited) mlx_destroy_window(clist->wlist->wlx, clist->wlist->winptr); diff --git a/src/ft_free_words.c b/src/ft_free_words.c index 1029710..4ea9ef2 100644 --- a/src/ft_free_words.c +++ b/src/ft_free_words.c @@ -1,7 +1,20 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_free_words.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:24 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:24 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> void -ft_free_words(char **words) + ft_free_words(char **words) { size_t i; @@ -11,5 +24,5 @@ ft_free_words(char **words) ft_memdel((void**)&words[i]); i++; } - ft_memdel((void**)&words); + ft_memdel((void**)words); } diff --git a/src/ft_get_colors.c b/src/ft_get_colors.c index f21cd99..7d7907a 100644 --- a/src/ft_get_colors.c +++ b/src/ft_get_colors.c @@ -1,9 +1,22 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_get_colors.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:25 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:25 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <cub3d.h> #include <stddef.h> static int -ft_check_digits(const char *word) + ft_check_digits(const char *word) { size_t i; @@ -16,7 +29,7 @@ ft_check_digits(const char *word) } int -ft_get_f_color(char **words, t_cub *clist) + ft_get_f_color(char **words, t_cub *clist) { char **num; @@ -42,7 +55,7 @@ ft_get_f_color(char **words, t_cub *clist) } int -ft_get_c_color(char **words, t_cub *clist) + ft_get_c_color(char **words, t_cub *clist) { char **num; diff --git a/src/ft_get_map.c b/src/ft_get_map.c index adedf7c..00de520 100644 --- a/src/ft_get_map.c +++ b/src/ft_get_map.c @@ -1,10 +1,23 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_get_map.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:26 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:26 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <cub3d.h> #include <stddef.h> #include <stdint.h> static void -ft_linecpy(char *line, char *mapl, size_t start) + ft_linecpy(char *line, char *mapl, size_t start) { size_t i; size_t j; @@ -25,7 +38,7 @@ ft_linecpy(char *line, char *mapl, size_t start) } static int8_t -ft_cat_mapl(char *line, size_t i, t_cub *clist) + ft_cat_mapl(char *line, size_t i, t_cub *clist) { if (!(clist->mapl = (char *)ft_nrealloc(clist->mapl, ((clist->map_w + 1) * i) * sizeof(char), @@ -36,7 +49,7 @@ ft_cat_mapl(char *line, size_t i, t_cub *clist) } int -ft_get_map_first_line(char *line, t_cub *clist) + ft_get_map_first_line(char *line, t_cub *clist) { if (!line[0]) { @@ -60,7 +73,7 @@ ft_get_map_first_line(char *line, t_cub *clist) } int -ft_get_map_core(int fd, t_cub *clist) + ft_get_map_core(int fd, t_cub *clist) { int ret; size_t i; diff --git a/src/ft_get_res.c b/src/ft_get_res.c index 372ebca..5b48688 100644 --- a/src/ft_get_res.c +++ b/src/ft_get_res.c @@ -1,8 +1,21 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_get_res.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:27 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:27 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <cub3d.h> static void -ft_checkdigit(const char *word, t_cub *clist) + ft_checkdigit(const char *word, t_cub *clist) { size_t i; @@ -12,9 +25,9 @@ ft_checkdigit(const char *word, t_cub *clist) if (i != ft_strlen(word)) ft_map_error(clist); } - + int -ft_get_res(char **words, t_cub *clist) + ft_get_res(char **words, t_cub *clist) { if (!(*words + 0) || !(*(words + 1)) || !(*(words + 2)) || (*(words + 3))) diff --git a/src/ft_get_sprite.c b/src/ft_get_sprite.c index b588df7..641219d 100644 --- a/src/ft_get_sprite.c +++ b/src/ft_get_sprite.c @@ -1,8 +1,21 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_get_sprite.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:27 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:27 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <cub3d.h> int -ft_get_sprite(char **words, t_cub *clist) + ft_get_sprite(char **words, t_cub *clist) { if (!(*words) || !words[1] || words[2]) return (-1); diff --git a/src/ft_get_tex.c b/src/ft_get_tex.c index 5b8e24e..1826825 100644 --- a/src/ft_get_tex.c +++ b/src/ft_get_tex.c @@ -1,9 +1,22 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_get_tex.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:28 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:28 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <cub3d.h> #include <stdlib.h> int -ft_get_tex_no(char **words, t_cub *clist) + ft_get_tex_no(char **words, t_cub *clist) { if (!(*words) || !(*(words + 1)) || (*(words + 2))) return (-1); @@ -14,7 +27,7 @@ ft_get_tex_no(char **words, t_cub *clist) } int -ft_get_tex_so(char **words, t_cub *clist) + ft_get_tex_so(char **words, t_cub *clist) { if (!(*words) || !(*(words + 1)) || (*(words + 2))) return (-1); @@ -25,7 +38,7 @@ ft_get_tex_so(char **words, t_cub *clist) } int -ft_get_tex_ea(char **words, t_cub *clist) + ft_get_tex_ea(char **words, t_cub *clist) { if (!(*words) || !(*(words + 1)) || (*(words + 2))) return (-1); @@ -36,7 +49,7 @@ ft_get_tex_ea(char **words, t_cub *clist) } int -ft_get_tex_we(char **words, t_cub *clist) + ft_get_tex_we(char **words, t_cub *clist) { if (!(*words) || !(*(words + 1)) || (*(words + 2))) return (-1); diff --git a/src/ft_init_lists.c b/src/ft_init_lists.c index 285dbd8..02ca36c 100644 --- a/src/ft_init_lists.c +++ b/src/ft_init_lists.c @@ -1,3 +1,16 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_init_lists.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:29 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:29 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <mlx.h> #include <cub3d.h> @@ -5,7 +18,7 @@ #include <stdlib.h> t_win -*ft_init_win(void) + *ft_init_win(void) { t_win *wlist; @@ -21,7 +34,7 @@ t_win } t_cub -*ft_init_cub(void) + *ft_init_cub(void) { t_cub *clist; diff --git a/src/ft_init_winlx.c b/src/ft_init_winlx.c index 5706685..b9c714e 100644 --- a/src/ft_init_winlx.c +++ b/src/ft_init_winlx.c @@ -1,10 +1,23 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_init_winlx.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:29 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:29 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <mlx.h> #include <cub3d.h> #include <stdlib.h> int -ft_init_winlx(t_cub *clist) + ft_init_winlx(t_cub *clist) { ft_memdel((void**)&clist->wlist->wlx); if (!(clist->wlist->wlx = mlx_init())) @@ -15,6 +28,6 @@ ft_init_winlx(t_cub *clist) return (-1); clist->wlist->inited = 1; ft_printf("Created window of size %dx%d\n", - clist->wlist->x_size, clist->wlist->y_size); + clist->wlist->x_size, clist->wlist->y_size); return (0); } diff --git a/src/ft_key_events.c b/src/ft_key_events.c index 7b3cdf2..580bb17 100644 --- a/src/ft_key_events.c +++ b/src/ft_key_events.c @@ -1,37 +1,50 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_key_events.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:30 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:30 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <cub3d.h> #include <stdlib.h> static int -ft_w_key(void) + ft_w_key(void) { ft_printf("[W]\n"); return (0); } static int -ft_a_key(void) + ft_a_key(void) { ft_printf("[A]\n"); return (0); } static int -ft_s_key(void) + ft_s_key(void) { ft_printf("[S]\n"); return (0); } static int -ft_d_key(void) + ft_d_key(void) { ft_printf("[D]\n"); return (0); } int -ft_key_event(int keycode, void *param) + ft_key_event(int keycode, void *param) { int (*fun_ptr[4])(void); diff --git a/src/ft_map_error.c b/src/ft_map_error.c index 0970936..3413bbb 100644 --- a/src/ft_map_error.c +++ b/src/ft_map_error.c @@ -1,9 +1,22 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_map_error.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:30 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:30 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <cub3d.h> #include <unistd.h> int -ft_map_error(t_cub *clist) + ft_map_error(t_cub *clist) { ft_dprintf(STDERR_FILENO, "Error\n"); ft_dprintf(STDERR_FILENO, diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c index cc4d920..3ca2052 100644 --- a/src/ft_parse_map.c +++ b/src/ft_parse_map.c @@ -1,3 +1,16 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_parse_map.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:31 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:31 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <cub3d.h> #include <stdlib.h> @@ -5,7 +18,7 @@ #include <unistd.h> static void -ft_check_cub(const char *map_path, t_cub *clist) + ft_check_cub(const char *map_path, t_cub *clist) { char **words; size_t i; @@ -31,7 +44,7 @@ ft_check_cub(const char *map_path, t_cub *clist) } static void -ft_check_map_last_line(t_cub *clist) + ft_check_map_last_line(t_cub *clist) { size_t i; size_t j; @@ -49,7 +62,7 @@ ft_check_map_last_line(t_cub *clist) } static int8_t -ft_parse_it(int fd, t_cub *clist) + ft_parse_it(int fd, t_cub *clist) { char *line; char **words; @@ -58,33 +71,25 @@ ft_parse_it(int fd, t_cub *clist) clist->line_chk += 1; if ((ret = get_next_line(fd, &line)) < 0) return (ft_map_error(clist)); - if (ret == 0) - { - ft_memdel((void**)&line); - return (ft_map_error(clist)); - } if (!line[0]) { ft_memdel((void**)&line); return (ft_parse_it(fd, clist)); } - if (!(words = ft_split(line, ' '))) + if (ret == 0 || !ft_ischarset("RNSEWFC1\0", line[0]) + || !(words = ft_split(line, ' '))) { ft_memdel((void**)&line); return (ft_map_error(clist)); } if ((ret = ft_select_get(words, clist)) == 12) - { - if (ft_get_map_first_line(line, clist) < 0) - return (-1); - return (12); - } + return ((ft_get_map_first_line(line, clist) < 0) ? (-1) : (12)); ft_memdel((void**)&line); return (ret); } void -ft_parse_map(const char *map_path, t_cub *clist) + ft_parse_map(const char *map_path, t_cub *clist) { int fd; int8_t ret; diff --git a/src/ft_print_list.c b/src/ft_print_list.c index 92d8674..b86d915 100644 --- a/src/ft_print_list.c +++ b/src/ft_print_list.c @@ -1,8 +1,21 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_print_list.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:32 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:32 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <cub3d.h> void -ft_print_list(t_cub *clist) + ft_print_list(t_cub *clist) { size_t i; diff --git a/src/ft_select_get.c b/src/ft_select_get.c index 6c1900d..448223e 100644 --- a/src/ft_select_get.c +++ b/src/ft_select_get.c @@ -1,31 +1,44 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_select_get.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:33 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:33 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <cub3d.h> #include <stdint.h> static uint8_t -ft_get_id(char **words) + ft_get_id(char **words) { - if (!ft_strncmp(words[0], "R", 1)) + if (!ft_strncmp(words[0], "R", 2)) return (0); - if (!ft_strncmp(words[0], "NO", 2)) + if (!ft_strncmp(words[0], "NO", 3)) return (1); - if (!ft_strncmp(words[0], "SO", 2)) + if (!ft_strncmp(words[0], "SO", 3)) return (2); - if (!ft_strncmp(words[0], "EA", 2)) + if (!ft_strncmp(words[0], "EA", 3)) return (3); - if (!ft_strncmp(words[0], "WE", 2)) + if (!ft_strncmp(words[0], "WE", 3)) return (4); - if (!ft_strncmp(words[0], "S", 1)) + if (!ft_strncmp(words[0], "S", 2)) return (5); - if (!ft_strncmp(words[0], "F", 1)) + if (!ft_strncmp(words[0], "F", 2)) return (6); - if (!ft_strncmp(words[0], "C", 1)) + if (!ft_strncmp(words[0], "C", 2)) return (7); return (12); } uint8_t -ft_select_get(char **words, t_cub *clist) + ft_select_get(char **words, t_cub *clist) { int (*fun_ptr[8])(char**, t_cub*); uint8_t id; @@ -1,3 +1,16 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* main.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2020/02/02 17:19:34 by rbousset #+# ## ## #+# */ +/* Updated: 2020/02/02 17:19:34 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + #include <libft.h> #include <mlx.h> #include <cub3d.h> |