aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_parse_map.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_parse_map.c')
-rw-r--r--src/ft_parse_map.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c
index e54b53c..256d131 100644
--- a/src/ft_parse_map.c
+++ b/src/ft_parse_map.c
@@ -61,7 +61,9 @@ static int8_t
ft_memdel((void**)&line);
return (ft_parse_it(fd, clist));
}
- if (!ft_ischarset("RNSEWFCLM1\0", line[0])
+ if (ft_ischarset("1 ", line[0]))
+ return ((ft_get_map_first_line(line, clist) < 0) ? (-1) : (12));
+ if (!ft_ischarset("RNSEWFCLM\0", line[0])
|| !(words = ft_split(line, ' ')))
return (ft_error_here(FT_ERR_ILL_ENTRY, line, clist));
if ((ret = ft_select_get(words, clist)) == 12)
@@ -78,6 +80,19 @@ static void
ft_exit(FT_RET_NO_MAP, clist);
}
+static void
+ ft_print_map(t_map *ml)
+{
+ size_t i;
+
+ i = 0;
+ while (ml->map[i])
+ {
+ ft_printf("[%s]\n", ml->map[i]);
+ i++;
+ }
+}
+
void
ft_parse_map(const char *map_path, t_cub *clist)
{
@@ -101,6 +116,7 @@ void
ft_get_nlvl_pos(&clist->mlist);
ft_check_missing(clist);
ft_set_minimap_scale(clist);
+ ft_print_map(&clist->mlist);
clist->currlvl += 1;
close(fd);
}