aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_parse_map.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-04 00:17:54 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-04 00:17:54 +0100
commit46ed1046b3d8e9dfbb9438552582898c3c79a9f5 (patch)
treefd1d0c451944d55945375cceeda800ac6664cf27 /src/ft_parse_map.c
parentMap update (diff)
download42-cub3d-46ed1046b3d8e9dfbb9438552582898c3c79a9f5.tar.gz
42-cub3d-46ed1046b3d8e9dfbb9438552582898c3c79a9f5.tar.bz2
42-cub3d-46ed1046b3d8e9dfbb9438552582898c3c79a9f5.tar.xz
42-cub3d-46ed1046b3d8e9dfbb9438552582898c3c79a9f5.tar.zst
42-cub3d-46ed1046b3d8e9dfbb9438552582898c3c79a9f5.zip
Chelou maps work, now sides check
Diffstat (limited to 'src/ft_parse_map.c')
-rw-r--r--src/ft_parse_map.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ft_parse_map.c b/src/ft_parse_map.c
index 256d131..0d54c6f 100644
--- a/src/ft_parse_map.c
+++ b/src/ft_parse_map.c
@@ -29,9 +29,11 @@ static void
while (ml->map[i])
i++;
j = 0;
- while (ml->map[i - 1][j])
+ i -= 1;
+ while (ml->map[i][j])
{
- if (ml->map[i - 1][j] != '1' && ml->map[i - 1][j] != '\0')
+ if (ml->map[i][j] != '1' && ml->map[i][j] != ' ' &&
+ ml->map[i][j] != '\0')
ft_map_error(FT_ERR_MAP_L_L, clist);
j++;
}
@@ -112,11 +114,11 @@ void
if (ft_get_map_core(fd, clist) < 0)
ft_map_error(clist->errmsg, clist);
ft_check_map_last_line(clist);
+ ft_print_map(&clist->mlist);
ft_get_player_spawn(&clist->plist, clist);
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);
}