/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_check_missing.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 17:28:42 by rbousset #+# #+# */ /* Updated: 2020/02/14 17:28:42 by rbousset ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include #include int ft_missing_error(const char *err, t_cub *clist) { 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)); } int ft_check_missing(t_cub *clist) { if (!clist->mlist.no_tex_path[0]) return (ft_missing_error(FT_ERR_MISS_NORTH, clist)); else if (!clist->mlist.so_tex_path[0]) return (ft_missing_error(FT_ERR_MISS_SOUTH, clist)); else if (!clist->mlist.ea_tex_path[0]) 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]) 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)); else if (clist->f_rgb.r == -1 || clist->f_rgb.g == -1 || clist->f_rgb.b == -1) return (ft_missing_error(FT_ERR_MISS_FLOOR_C, clist)); else if (clist->c_rgb.r == -1 || clist->c_rgb.g == -1 || clist->c_rgb.b == -1) return (ft_missing_error(FT_ERR_MISS_CEIL_C, clist)); else if (clist->plist.pos_x == 0 || clist->plist.pos_y == 0) return (ft_missing_error(FT_ERR_MISS_PLAYER_SPAWN, clist)); else if (clist->mlist.isnlvl && !clist->mlist.nl_tex_path[0]) return (ft_missing_error(FT_ERR_MISS_NLVL, clist)); else if (clist->mlist.isnlvl && !clist->mlist.nlevel_path[0]) return (ft_missing_error(FT_ERR_MISS_NLVL_PATH, clist)); return (0); }