aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_map.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z3r8p1.le-101.fr>2020-02-13 19:42:05 +0100
committerRudy Bousset <rbousset@z3r8p1.le-101.fr>2020-02-13 19:42:05 +0100
commite29dd2fa3688e1e96a25af3b651da574af08aa90 (patch)
treecb6486fc91f1b93e61e4dcda25d359095e6aa108 /src/ft_get_map.c
parentBetter code structure (diff)
download42-cub3d-e29dd2fa3688e1e96a25af3b651da574af08aa90.tar.gz
42-cub3d-e29dd2fa3688e1e96a25af3b651da574af08aa90.tar.bz2
42-cub3d-e29dd2fa3688e1e96a25af3b651da574af08aa90.tar.xz
42-cub3d-e29dd2fa3688e1e96a25af3b651da574af08aa90.tar.zst
42-cub3d-e29dd2fa3688e1e96a25af3b651da574af08aa90.zip
Splited structs
Diffstat (limited to '')
-rw-r--r--src/ft_get_map.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/ft_get_map.c b/src/ft_get_map.c
index 720f412..9148964 100644
--- a/src/ft_get_map.c
+++ b/src/ft_get_map.c
@@ -51,30 +51,30 @@ static void
static int8_t
ft_cat_mapl(char *line, size_t i, t_cub *clist)
{
- if (!(clist->mapl = (char *)ft_nrealloc(clist->mapl,
- ((clist->map_w + 1) * i) * sizeof(char),
- ((clist->map_w + 1) * (i + 1)) * sizeof(char))))
+ if (!(clist->mlist->mapl = (char *)ft_nrealloc(clist->mlist->mapl,
+ ((clist->mlist->map_w + 1) * i) * sizeof(char),
+ ((clist->mlist->map_w + 1) * (i + 1)) * sizeof(char))))
return (-1);
- ft_linecpy(line, clist->mapl, (clist->map_w + 1) * i);
+ ft_linecpy(line, clist->mlist->mapl, (clist->mlist->map_w + 1) * i);
return (0);
}
int
ft_get_map_first_line(char *line, t_cub *clist)
{
- clist->map_start = clist->line_chk;
+ clist->mlist->map_start = clist->mlist->line_chk;
if (!line[0])
{
ft_memdel((void**)&line);
return (-1);
}
- clist->map_w = ft_get_line_len(line);
+ clist->mlist->map_w = ft_get_line_len(line);
if (ft_check_map_line(line, 1, clist) < 0)
{
ft_memdel((void**)&line);
return (-1);
}
- ft_memdel((void**)&clist->mapl);
+ ft_memdel((void**)&clist->mlist->mapl);
if (ft_cat_mapl(line, 0, clist) < 0)
{
ft_memdel((void**)&line);
@@ -95,7 +95,7 @@ int
ret = 1;
while ((ret = get_next_line(fd, &line)) > 0)
{
- clist->line_chk += 1;
+ clist->mlist->line_chk += 1;
if (!line[0] || ft_check_map_line(line, 0, clist) < 0
|| ft_cat_mapl(line, i, clist) < 0)
{
@@ -106,10 +106,10 @@ int
i++;
}
ft_memdel((void**)&line);
- clist->mapl[((clist->map_w + 1) * i) - 1] = '\0';
- ft_free_words(clist->map);
- clist->map = ft_split(clist->mapl, '\n');
- clist->map_h = ft_get_map_h(clist->map);
- ft_memdel((void**)&clist->mapl);
+ clist->mlist->mapl[((clist->mlist->map_w + 1) * i) - 1] = '\0';
+ ft_free_words(clist->mlist->map);
+ clist->mlist->map = ft_split(clist->mlist->mapl, '\n');
+ clist->mlist->map_h = ft_get_map_h(clist->mlist->map);
+ ft_memdel((void**)&clist->mlist->mapl);
return (0);
}