aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_map.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-03 14:47:33 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-03 14:47:33 +0100
commit8866ef5699150d0549096efa94fc311ff7a48dc7 (patch)
tree4a03267f7e7f9b399a9ad0536b50ba6a90407e47 /src/ft_get_map.c
parentMusic is pretty bav (diff)
download42-cub3d-8866ef5699150d0549096efa94fc311ff7a48dc7.tar.gz
42-cub3d-8866ef5699150d0549096efa94fc311ff7a48dc7.tar.bz2
42-cub3d-8866ef5699150d0549096efa94fc311ff7a48dc7.tar.xz
42-cub3d-8866ef5699150d0549096efa94fc311ff7a48dc7.tar.zst
42-cub3d-8866ef5699150d0549096efa94fc311ff7a48dc7.zip
Changing stuff
Diffstat (limited to '')
-rw-r--r--src/ft_get_map.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/ft_get_map.c b/src/ft_get_map.c
index f609c50..6a73e54 100644
--- a/src/ft_get_map.c
+++ b/src/ft_get_map.c
@@ -50,35 +50,35 @@ static void
static int8_t
ft_cat_mapl(char *line, size_t i, t_cub *clist)
{
- 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))))
+ 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))))
{
- ft_sprintf(clist->errmsg, "%s", FT_ERR_ALLOCATE);
+ ft_sprintf(clist.errmsg, "%s", FT_ERR_ALLOCATE);
return (-1);
}
- ft_linecpy(line, clist->mlist->mapl, (clist->mlist->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->mlist->map_start = clist->mlist->line_chk;
+ clist.mlist.map_start = clist.mlist.line_chk;
if (!line[0])
{
ft_memdel((void**)&line);
- ft_sprintf(clist->errmsg, "%s", FT_ERR_READ);
+ ft_sprintf(clist.errmsg, "%s", FT_ERR_READ);
return (-1);
}
- clist->mlist->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);
- ft_sprintf(clist->errmsg, "%s", FT_ERR_READ);
+ ft_sprintf(clist.errmsg, "%s", FT_ERR_READ);
return (-1);
}
- ft_memdel((void**)&clist->mlist->mapl);
+ ft_memdel((void**)&clist.mlist.mapl);
if (ft_cat_mapl(line, 0, clist) < 0)
{
ft_memdel((void**)&line);
@@ -99,7 +99,7 @@ int
ret = 1;
while ((ret = get_next_line(fd, &line)) > 0)
{
- clist->mlist->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)
{
@@ -110,10 +110,10 @@ int
i++;
}
ft_memdel((void**)&line);
- 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);
+ 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);
}