diff options
author | Rudy Bousset <rbousset@z2r5p2.le-101.fr> | 2020-02-28 18:30:36 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r5p2.le-101.fr> | 2020-02-28 18:30:36 +0100 |
commit | c9b5e6dfdfc7d97183786279bbe68675a83d83f4 (patch) | |
tree | b121c25d2fa56dc45331d952948bf9cea7a64e8b /src/ft_get_tex_nl.c | |
parent | In progress (diff) | |
download | 42-cub3d-c9b5e6dfdfc7d97183786279bbe68675a83d83f4.tar.gz 42-cub3d-c9b5e6dfdfc7d97183786279bbe68675a83d83f4.tar.bz2 42-cub3d-c9b5e6dfdfc7d97183786279bbe68675a83d83f4.tar.xz 42-cub3d-c9b5e6dfdfc7d97183786279bbe68675a83d83f4.tar.zst 42-cub3d-c9b5e6dfdfc7d97183786279bbe68675a83d83f4.zip |
In progress
Diffstat (limited to 'src/ft_get_tex_nl.c')
-rw-r--r-- | src/ft_get_tex_nl.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/ft_get_tex_nl.c b/src/ft_get_tex_nl.c new file mode 100644 index 0000000..e1ee5ce --- /dev/null +++ b/src/ft_get_tex_nl.c @@ -0,0 +1,41 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_get_tex_nl.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/28 18:24:52 by rbousset #+# #+# */ +/* Updated: 2020/02/28 18:24:56 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <cub3d.h> +#include <stdint.h> + +int8_t + ft_get_tex_nl(char **words, t_cub *clist) +{ + if (!(*words) || !(*(words + 1)) || (*(words + 2))) + { + ft_sprintf(clist->errmsg, "%s", FT_ERR_ARGS); + return (-1); + } + if (ft_check_ext(*(words + 1), ".xpm") < 0) + { + ft_sprintf(clist->errmsg, "%s", FT_ERR_NOT_A_XPM); + return (-1); + } + ft_memdel((void**)&clist->mlist->nl_tex_path); + if (!(clist->mlist->nl_tex_path = ft_strdup(*(words + 1)))) + { + ft_sprintf(clist->errmsg, "%s", FT_ERR_ALLOCATE); + return (-1); + } + if (ft_check_not_found(clist->mlist->nl_tex_path) < 0) + { + ft_sprintf(clist->errmsg, "%s", FT_ERR_RD_NO); + return (-1); + } + return (0); +} |