aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/ft_check_missing.c38
-rw-r--r--src/ft_get_colors.c4
-rw-r--r--src/ft_get_tex_extra.c4
-rw-r--r--src/ft_init_map.c4
4 files changed, 32 insertions, 18 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));
}
diff --git a/src/ft_get_colors.c b/src/ft_get_colors.c
index 47b8265..0f79a7b 100644
--- a/src/ft_get_colors.c
+++ b/src/ft_get_colors.c
@@ -75,7 +75,7 @@ int8_t
return (-1);
}
if (!ft_check_ext(words[1], ".xpm"))
- return (ft_get_f_tex(words, clist))
+ return (ft_get_f_tex(words, clist));
if (!(num = ft_split(words[1], ',')))
{
ft_sprintf(clist->errmsg, FT_ERR_ALLOCATE);
@@ -104,6 +104,8 @@ int8_t
ft_sprintf(clist->errmsg, FT_ERR_ARGS);
return (-1);
}
+ if (!ft_check_ext(words[1], ".xpm"))
+ return (ft_get_c_tex(words, clist));
if (!(num = ft_split(words[1], ',')))
{
ft_sprintf(clist->errmsg, FT_ERR_ALLOCATE);
diff --git a/src/ft_get_tex_extra.c b/src/ft_get_tex_extra.c
index acb7495..25f9c23 100644
--- a/src/ft_get_tex_extra.c
+++ b/src/ft_get_tex_extra.c
@@ -37,7 +37,7 @@ int8_t
ft_sprintf(clist->errmsg, FT_ERR_RD_NL_TEX);
return (-1);
}
- clist->isftex = 1;
+ clist->mlist.isftex = 1;
return (0);
}
@@ -65,6 +65,6 @@ int8_t
ft_sprintf(clist->errmsg, FT_ERR_RD_NL_TEX);
return (-1);
}
- clist->isctex = 1;
+ clist->mlist.isctex = 1;
return (0);
}
diff --git a/src/ft_init_map.c b/src/ft_init_map.c
index 457f241..3daa3b7 100644
--- a/src/ft_init_map.c
+++ b/src/ft_init_map.c
@@ -54,8 +54,8 @@ int8_t
mlist->line_chk = 0;
mlist->map_start = 0;
mlist->isspawn = 0;
- mlist->iftex = 0;
- mlist->ictex = 0;
+ mlist->isftex = 0;
+ mlist->isctex = 0;
mlist->isnlvl = 0;
mlist->ismusic = 0;
mlist->scale = 0;