aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_select_get.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r5p2.le-101.fr>2020-02-28 18:55:45 +0100
committerRudy Bousset <rbousset@z2r5p2.le-101.fr>2020-02-28 18:55:45 +0100
commitcbb47afbbcc9b42f3094df620bbc0ef02aa7f3d2 (patch)
tree1e0aa232748e071c10779ed7dbf641178d85664e /src/ft_select_get.c
parentIn progress (diff)
download42-cub3d-cbb47afbbcc9b42f3094df620bbc0ef02aa7f3d2.tar.gz
42-cub3d-cbb47afbbcc9b42f3094df620bbc0ef02aa7f3d2.tar.bz2
42-cub3d-cbb47afbbcc9b42f3094df620bbc0ef02aa7f3d2.tar.xz
42-cub3d-cbb47afbbcc9b42f3094df620bbc0ef02aa7f3d2.tar.zst
42-cub3d-cbb47afbbcc9b42f3094df620bbc0ef02aa7f3d2.zip
Parsed
Diffstat (limited to '')
-rw-r--r--src/ft_select_get.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/ft_select_get.c b/src/ft_select_get.c
index b5df1bc..4ec1a45 100644
--- a/src/ft_select_get.c
+++ b/src/ft_select_get.c
@@ -42,10 +42,22 @@ static int8_t
}
static int8_t
+ ft_check_exists_two(const int8_t ret, t_cub *clist)
+{
+ if (ret == 12)
+ return (12);
+ if (ret == 8 && (clist->mlist->nlevel_path[0]))
+ return (-1);
+ if (ret == 9 && (clist->mlist->nl_tex_path[0]))
+ return (-1);
+ return (ret);
+}
+
+static int8_t
ft_get_id(char **words, t_cub *clist)
{
int8_t ret;
- char ref[9][3];
+ char ref[11][3];
ft_memcpy(ref[0], "R\0", 3);
ft_memcpy(ref[1], "NO", 3);
@@ -55,13 +67,17 @@ static int8_t
ft_memcpy(ref[5], "S\0", 3);
ft_memcpy(ref[6], "F\0", 3);
ft_memcpy(ref[7], "C\0", 3);
- ft_memcpy(ref[8], "", 1);
+ ft_memcpy(ref[8], "L\0", 3);
+ ft_memcpy(ref[9], "LT\0", 3);
+ ft_memcpy(ref[10], "", 1);
ret = 0;
while (ft_strncmp(words[0], ref[ret], 3) && ref[ret][0])
ret++;
- if (ret == 8)
+ if (ret == 10)
ret = 12;
- return (ret = ft_check_exists(ret, clist));
+ ret = ft_check_exists(ret, clist);
+ ret = ft_check_exists_two(ret, clist);
+ return (ret);
}
int8_t