diff options
author | Rudy Bousset <rbousset@z2r4p3.le-101.fr> | 2020-03-09 20:42:04 +0100 |
---|---|---|
committer | Rudy Bousset <rbousset@z2r4p3.le-101.fr> | 2020-03-09 20:42:04 +0100 |
commit | 35a7b48f99b64ddbd23eb1a264df7ea453b3f9a4 (patch) | |
tree | f7c16c9e2d31a1c6c81e82df96f9c68769c16ae9 /src/ft_get_skybox.c | |
parent | in progress (diff) | |
download | 42-cub3d-35a7b48f99b64ddbd23eb1a264df7ea453b3f9a4.tar.gz 42-cub3d-35a7b48f99b64ddbd23eb1a264df7ea453b3f9a4.tar.bz2 42-cub3d-35a7b48f99b64ddbd23eb1a264df7ea453b3f9a4.tar.xz 42-cub3d-35a7b48f99b64ddbd23eb1a264df7ea453b3f9a4.tar.zst 42-cub3d-35a7b48f99b64ddbd23eb1a264df7ea453b3f9a4.zip |
In progress, Makefile was bav back then
Diffstat (limited to '')
-rw-r--r-- | src/ft_get_skybox.c | 43 |
1 files changed, 43 insertions, 0 deletions
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 <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:28:53 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:28:53 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <libft.h> +#include <cub3d.h> +#include <stdint.h> + +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); +} |