aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-07 22:34:38 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-07 22:34:38 +0100
commit684c8a8d416fafec52b5dcba81453789b53b8391 (patch)
tree653145d30484a075b93c666273296e7c90b3a825
parentGot secret door bonus (diff)
download42-cub3d-684c8a8d416fafec52b5dcba81453789b53b8391.tar.gz
42-cub3d-684c8a8d416fafec52b5dcba81453789b53b8391.tar.bz2
42-cub3d-684c8a8d416fafec52b5dcba81453789b53b8391.tar.xz
42-cub3d-684c8a8d416fafec52b5dcba81453789b53b8391.tar.zst
42-cub3d-684c8a8d416fafec52b5dcba81453789b53b8391.zip
defines are bav
Diffstat (limited to '')
-rw-r--r--inc/cub3d_defines.h9
-rw-r--r--src/ft_check_map_line.c4
-rw-r--r--src/ft_check_map_surrounds.c2
-rw-r--r--src/ft_get_player_spawn.c2
-rw-r--r--src/ft_parse_map.c2
5 files changed, 14 insertions, 5 deletions
diff --git a/inc/cub3d_defines.h b/inc/cub3d_defines.h
index 1153225..66105fd 100644
--- a/inc/cub3d_defines.h
+++ b/inc/cub3d_defines.h
@@ -111,6 +111,15 @@ enum
# endif
/*
+** ====== CHARSET ======
+*/
+
+# define FT_CHRST_VALID_PARSE "RNSEWFCLMD"
+# define FT_CHRST_MAP_ENTRY "012NSEWLD "
+# define FT_CHRST_SPAWN "NSEW"
+# define FT_CHRST_MAP_NON_WALL "02NESWLD"
+
+/*
** ====== BMP ======
*/
diff --git a/src/ft_check_map_line.c b/src/ft_check_map_line.c
index 213d75c..7fa68b7 100644
--- a/src/ft_check_map_line.c
+++ b/src/ft_check_map_line.c
@@ -18,12 +18,12 @@
static int8_t
ft_first_checks(char *line, size_t i, t_cub *clist)
{
- if (!ft_ischarset("012NSEWLD ", line[i]))
+ if (!ft_ischarset(FT_CHRST_MAP_ENTRY, line[i]))
{
ft_sprintf(clist->errmsg, FT_ERR_ILL_MAP);
return (-1);
}
- if (ft_ischarset("NSEW", line[i]))
+ if (ft_ischarset(FT_CHRST_SPAWN, line[i]))
clist->mlist.isspawn += 1;
if (clist->mlist.isspawn > 1)
{
diff --git a/src/ft_check_map_surrounds.c b/src/ft_check_map_surrounds.c
index 07c9540..8122cc3 100644
--- a/src/ft_check_map_surrounds.c
+++ b/src/ft_check_map_surrounds.c
@@ -42,7 +42,7 @@ void
{
while (ml->map[y][x])
{
- if (ft_ischarset("02NESWLD", ml->map[y][x]))
+ if (ft_ischarset(FT_CHRST_MAP_NON_WALL, ml->map[y][x]))
{
if (ft_wall_check(y, x, ml->map) < 0)
ft_map_error(FT_ERR_MAP_WALLS, cl);
diff --git a/src/ft_get_player_spawn.c b/src/ft_get_player_spawn.c
index fabcba8..c506775 100644
--- a/src/ft_get_player_spawn.c
+++ b/src/ft_get_player_spawn.c
@@ -75,7 +75,7 @@ void
{
while (clist->mlist.map[y][x])
{
- if (ft_ischarset("NSEW", clist->mlist.map[y][x]))
+ if (ft_ischarset(FT_CHRST_SPAWN, clist->mlist.map[y][x]))
{
plist->pos_x = x + 0.5;
plist->pos_y = y + 0.5;
diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c
index 38ce686..8878719 100644
--- a/src/ft_parse_map.c
+++ b/src/ft_parse_map.c
@@ -65,7 +65,7 @@ static int8_t
}
if (ft_ischarset("1 ", line[0]))
return ((ft_get_map_first_line(line, clist) < 0) ? (-1) : (12));
- if (!ft_ischarset("RNSEWFCLMD", line[0])
+ if (!ft_ischarset(FT_CHRST_VALID_PARSE, line[0])
|| !(words = ft_split(line, ' ')))
return (ft_error_here(FT_ERR_ILL_ENTRY, line, clist));
if ((ret = ft_select_get(words, clist)) == 12)