aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_map.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-25 18:46:15 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-25 18:46:15 +0100
commit58b408a130b2bec0d401b43d77ded34c9a8d34f9 (patch)
tree9eb665f259a98a834a777272b2683a0cb2bc5a57 /src/ft_get_map.c
parentMerge branch 'better_m_s' (diff)
download42-cub3d-58b408a130b2bec0d401b43d77ded34c9a8d34f9.tar.gz
42-cub3d-58b408a130b2bec0d401b43d77ded34c9a8d34f9.tar.bz2
42-cub3d-58b408a130b2bec0d401b43d77ded34c9a8d34f9.tar.xz
42-cub3d-58b408a130b2bec0d401b43d77ded34c9a8d34f9.tar.zst
42-cub3d-58b408a130b2bec0d401b43d77ded34c9a8d34f9.zip
Fixed sprite parse
Diffstat (limited to '')
-rw-r--r--src/ft_get_map.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ft_get_map.c b/src/ft_get_map.c
index 4cb4941..d2f0a31 100644
--- a/src/ft_get_map.c
+++ b/src/ft_get_map.c
@@ -17,7 +17,7 @@
#include <stdint.h>
static void
- ft_linecpy(char *line, char *mapl, size_t start)
+ ft_linecpy(char *line, char *mapl, size_t start, t_cub *cl)
{
size_t i;
size_t j;
@@ -29,6 +29,9 @@ static void
while (i < slen && line[i])
{
mapl[j] = line[i];
+ if (mapl[j] - 48 > 2 && mapl[j] - 48 < 10
+ && mapl[j] - 48 > cl->mlist.topsp)
+ ft_error(FT_RET_MAP_ERR, FT_ERR_UNDEF_SPRITE, cl);
i++;
j++;
}
@@ -47,7 +50,7 @@ static int8_t
return (-1);
}
ft_linecpy(line, clist->mlist.mapl,
- clist->mlist.mapl_len);
+ clist->mlist.mapl_len, clist);
clist->mlist.mapl_len += ft_strlen(line) + 1;
return (0);
}