From 58b408a130b2bec0d401b43d77ded34c9a8d34f9 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Wed, 25 Mar 2020 18:46:15 +0100 Subject: Fixed sprite parse --- src/ft_get_map.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/ft_get_map.c') 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 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); } -- cgit v1.2.3