aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_map.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r5p2.le-101.fr>2020-01-27 19:30:30 +0100
committerRudy Bousset <rbousset@z2r5p2.le-101.fr>2020-01-27 19:30:30 +0100
commitce577fcdf0afe74c06aaa359f26ab69535057916 (patch)
treecee77ab2663e3f1b4bb6c319dfbac8ec878b64c1 /src/ft_get_map.c
parentNot normed but ok (diff)
download42-cub3d-ce577fcdf0afe74c06aaa359f26ab69535057916.tar.gz
42-cub3d-ce577fcdf0afe74c06aaa359f26ab69535057916.tar.bz2
42-cub3d-ce577fcdf0afe74c06aaa359f26ab69535057916.tar.xz
42-cub3d-ce577fcdf0afe74c06aaa359f26ab69535057916.tar.zst
42-cub3d-ce577fcdf0afe74c06aaa359f26ab69535057916.zip
Cleaner
Diffstat (limited to 'src/ft_get_map.c')
-rw-r--r--src/ft_get_map.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ft_get_map.c b/src/ft_get_map.c
index a57e32e..735e31e 100644
--- a/src/ft_get_map.c
+++ b/src/ft_get_map.c
@@ -27,7 +27,8 @@ ft_check_err(char *line, size_t size)
size_t i;
i = 1;
- if (ft_strlen(line) != size)
+ if (ft_strlen(line) != size || line[0] != '1'
+ || line[ft_strlen(line) - 1] != '1')
return (-1);
while (i < ft_strlen(line) && line[i])
{
@@ -83,7 +84,7 @@ ft_get_map(int fd, t_cub *clist)
return (-1);
}
mapl = (char*)ft_nrealloc(mapl, (((len / 2) + 2) * i) * sizeof(char),
- ((((len / 2) + 2) * i) + (ft_strlen(line) / 2) + 2) * sizeof(char));
+ ((((len / 2) + 2) * i) + (len / 2) + 2) * sizeof(char));
ft_linecpy(line, mapl, ((len / 2) + 2) * i);
ft_memdel(line);
i++;