aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_skybox.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-03-09 23:08:39 +0100
committerRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-03-09 23:08:39 +0100
commita4eae07949127cbdfa9030ad086c1d0edfa8e1f5 (patch)
tree419651274887318990adb6e434d5f5bcfb835340 /src/ft_get_skybox.c
parentgang_2 (diff)
parentMap update (diff)
download42-cub3d-a4eae07949127cbdfa9030ad086c1d0edfa8e1f5.tar.gz
42-cub3d-a4eae07949127cbdfa9030ad086c1d0edfa8e1f5.tar.bz2
42-cub3d-a4eae07949127cbdfa9030ad086c1d0edfa8e1f5.tar.xz
42-cub3d-a4eae07949127cbdfa9030ad086c1d0edfa8e1f5.tar.zst
42-cub3d-a4eae07949127cbdfa9030ad086c1d0edfa8e1f5.zip
Merge branch 'skybox'
Diffstat (limited to 'src/ft_get_skybox.c')
-rw-r--r--src/ft_get_skybox.c43
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..47c395e
--- /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_SB);
+ return (-1);
+ }
+ clist->mlist.isskybox = 1;
+ return (0);
+}