diff options
Diffstat (limited to '')
-rw-r--r-- | src/ft_check_missing.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/ft_check_missing.c b/src/ft_check_missing.c index 51c0c23..d01a77f 100644 --- a/src/ft_check_missing.c +++ b/src/ft_check_missing.c @@ -20,7 +20,22 @@ int ft_dprintf(STDERR_FILENO, "Error\n"); ft_dprintf(STDERR_FILENO, "\033[1;31m%s %s\033[0m\n", FT_ERR_MISS_ELEMENT, err); - return (ft_exit(1, clist)); + return (ft_exit(FT_ERR_MISSING, clist)); +} + +static int + ft_check_missing_sprites(t_cub *clist) +{ + int8_t i; + + i = 0; + while ((i + 2) <= clist->mlist.topsp) + { + if (!clist->mlist.sprite_path[i][0]) + return (ft_missing_error(FT_ERR_MISS_SPRITE, clist)); + i++; + } + return (0); } static int @@ -46,7 +61,7 @@ static int return (ft_missing_error(FT_ERR_MISS_NLVL_PATH, clist)); if (clist->mlist.istraps && !clist->mlist.traps_path[0]) return (ft_missing_error(FT_ERR_MISS_TRAP, clist)); - return (0); + return (ft_check_missing_sprites(clist)); } int @@ -60,7 +75,7 @@ int return (ft_missing_error(FT_ERR_MISS_EAST, clist)); else if (!clist->mlist.we_tex_path[0]) return (ft_missing_error(FT_ERR_MISS_WEST, clist)); - else if (!clist->mlist.sprite_path[0]) + else if (!clist->mlist.sprite_path[0][0]) return (ft_missing_error(FT_ERR_MISS_SPRITE, clist)); else if (clist->wlist.x_size == 0 || clist->wlist.y_size == 0) return (ft_missing_error(FT_ERR_MISS_RESOLUTION, clist)); |