aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_check_missing.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-09 02:46:24 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-09 02:46:24 +0100
commit85fd7ecfbcc4abaf55e0d302471571b6a8f54f16 (patch)
tree5d45657b800966c91b16eeaafd61c9a22bc6305f /src/ft_check_missing.c
parentReparse, may not compile (diff)
download42-cub3d-85fd7ecfbcc4abaf55e0d302471571b6a8f54f16.tar.gz
42-cub3d-85fd7ecfbcc4abaf55e0d302471571b6a8f54f16.tar.bz2
42-cub3d-85fd7ecfbcc4abaf55e0d302471571b6a8f54f16.tar.xz
42-cub3d-85fd7ecfbcc4abaf55e0d302471571b6a8f54f16.tar.zst
42-cub3d-85fd7ecfbcc4abaf55e0d302471571b6a8f54f16.zip
the smartest that every lived
Diffstat (limited to 'src/ft_check_missing.c')
-rw-r--r--src/ft_check_missing.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/ft_check_missing.c b/src/ft_check_missing.c
index 02893bf..80edf83 100644
--- a/src/ft_check_missing.c
+++ b/src/ft_check_missing.c
@@ -23,6 +23,30 @@ int
return (ft_exit(1, clist));
}
+static int
+ ft_check_missing_norme(t_cub *clist)
+{
+ if (!clist->mlist.isftex)
+ {
+ 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));
+ }
+ if (!clist->mlist.isctex)
+ {
+ 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));
+ }
+ 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);
+}
+
int
ft_check_missing(t_cub *clist)
{
@@ -38,17 +62,5 @@ int
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);
+ return (ft_check_missing_norme(clist));
}