From 35a7b48f99b64ddbd23eb1a264df7ea453b3f9a4 Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Mon, 9 Mar 2020 20:42:04 +0100 Subject: In progress, Makefile was bav back then --- src/ft_get_skybox.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/ft_get_skybox.c (limited to 'src/ft_get_skybox.c') diff --git a/src/ft_get_skybox.c b/src/ft_get_skybox.c new file mode 100644 index 0000000..011bec7 --- /dev/null +++ b/src/ft_get_skybox.c @@ -0,0 +1,43 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_get_skybox.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:53 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:53 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include + +int8_t + ft_get_skybox(char **words, t_cub *clist) +{ + if (!(*words) || !(*(words + 1)) || (*(words + 2))) + { + ft_sprintf(clist->errmsg, FT_ERR_ARGS); + return (-1); + } + if (ft_check_ext(*(words + 1), ".xpm") < 0) + { + ft_sprintf(clist->errmsg, FT_ERR_NOT_A_XPM); + return (-1); + } + ft_memdel((void**)&clist->mlist.skybox_path); + if (!(clist->mlist.skybox_path = ft_strdup(*(words + 1)))) + { + ft_sprintf(clist->errmsg, FT_ERR_ALLOCATE); + return (-1); + } + if (ft_check_not_found(clist->mlist.skybox_path) < 0) + { + ft_sprintf(clist->errmsg, FT_ERR_RD_NL_MAP); + return (-1); + } + clist->mlist.isskybox = 1; + return (0); +} -- cgit v1.2.3 From fcf4c36c2027d268afd7925785e8588fcb2d920c Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Mon, 9 Mar 2020 20:50:36 +0100 Subject: Not done --- src/ft_get_skybox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ft_get_skybox.c') diff --git a/src/ft_get_skybox.c b/src/ft_get_skybox.c index 011bec7..47c395e 100644 --- a/src/ft_get_skybox.c +++ b/src/ft_get_skybox.c @@ -35,7 +35,7 @@ int8_t } if (ft_check_not_found(clist->mlist.skybox_path) < 0) { - ft_sprintf(clist->errmsg, FT_ERR_RD_NL_MAP); + ft_sprintf(clist->errmsg, FT_ERR_RD_SB); return (-1); } clist->mlist.isskybox = 1; -- cgit v1.2.3