diff options
Diffstat (limited to '')
-rw-r--r-- | src/ft_get_map.c | 7 | ||||
-rw-r--r-- | src/ft_get_sprite.c | 2 | ||||
-rw-r--r-- | src/ft_tex_sprites_extra_init.c | 1 |
3 files changed, 7 insertions, 3 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); } diff --git a/src/ft_get_sprite.c b/src/ft_get_sprite.c index 05b13b2..9e84e93 100644 --- a/src/ft_get_sprite.c +++ b/src/ft_get_sprite.c @@ -46,6 +46,8 @@ static int8_t return (-1); i++; } + if (i + 2 > clist->mlist.topsp) + clist->mlist.topsp = i + 2; return (0); } diff --git a/src/ft_tex_sprites_extra_init.c b/src/ft_tex_sprites_extra_init.c index 9ff7612..84684be 100644 --- a/src/ft_tex_sprites_extra_init.c +++ b/src/ft_tex_sprites_extra_init.c @@ -31,5 +31,4 @@ void &cl->tlist[i + 7].endian); i++; } - cl->mlist.topsp = i + 1; } |