1
0

fix problem with map

This commit is contained in:
Maelys
2024-10-07 11:48:47 +02:00
parent 1fca28f5e0
commit bb49c8f99b
4 changed files with 30 additions and 10 deletions

View File

@ -6,7 +6,7 @@
/* By: madumerg <madumerg@42angouleme.fr> +#+ +:+ +#+ */ /* By: madumerg <madumerg@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/11 11:24:13 by madumerg #+# #+# */ /* Created: 2024/09/11 11:24:13 by madumerg #+# #+# */
/* Updated: 2024/09/29 20:37:16 by madumerg ### ########.fr */ /* Updated: 2024/10/07 11:45:16 by madumerg ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -58,15 +58,37 @@ int check_map_close(char **map)
return (0); return (0);
} }
int last_no_null_line(char **map)
{
int i;
int j;
i = 0;
j = 0;
while (map[j])
{
if (space_line(map[j]) == 1)
i = j;
j++;
}
return (i);
}
int check_char_map(char **map) int check_char_map(char **map)
{ {
int y; int y;
int x; int x;
int l;
y = 0; y = 0;
l = last_no_null_line(map);
while (map[y]) while (map[y])
{ {
x = 0; x = 0;
if (y == l)
break ;
if (space_line(map[y]) == 0)
return (1);
while (map[y][x]) while (map[y][x])
{ {
if (verif_char(map[y][x]) == 1) if (verif_char(map[y][x]) == 1)

View File

@ -6,7 +6,7 @@
/* By: madumerg <madumerg@42angouleme.fr> +#+ +:+ +#+ */ /* By: madumerg <madumerg@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/12 12:44:52 by madumerg #+# #+# */ /* Created: 2024/09/12 12:44:52 by madumerg #+# #+# */
/* Updated: 2024/10/05 18:35:52 by madumerg ### ########.fr */ /* Updated: 2024/10/07 11:28:45 by madumerg ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: madumerg <madumerg@42angouleme.fr> +#+ +:+ +#+ */ /* By: madumerg <madumerg@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/11 14:20:54 by madumerg #+# #+# */ /* Created: 2024/09/11 14:20:54 by madumerg #+# #+# */
/* Updated: 2024/09/29 20:35:22 by madumerg ### ########.fr */ /* Updated: 2024/10/07 11:42:09 by madumerg ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: madumerg <madumerg@42angouleme.fr> +#+ +:+ +#+ */ /* By: madumerg <madumerg@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/17 15:12:28 by madumerg #+# #+# */ /* Created: 2024/09/17 15:12:28 by madumerg #+# #+# */
/* Updated: 2024/09/29 20:35:50 by madumerg ### ########.fr */ /* Updated: 2024/10/07 11:47:14 by madumerg ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -19,17 +19,20 @@ int ft_count_line_map(char **file, int y)
return (y); return (y);
} }
void replace_nl(char *l) int replace_nl(char *l)
{ {
int i; int i;
i = 0; i = 0;
while (l[i]) while (l[i])
{ {
if (l[0] == '\n')
return (err_mess(WRONG_CHAR));
if (l[i] == '\n') if (l[i] == '\n')
l[i] = '\0'; l[i] = '\0';
i++; i++;
} }
return (0);
} }
int recup_map(char **old_map, int i, t_pars *pars) int recup_map(char **old_map, int i, t_pars *pars)
@ -37,11 +40,6 @@ int recup_map(char **old_map, int i, t_pars *pars)
int k; int k;
k = i; k = i;
while (old_map[i])
{
replace_nl(old_map[i]);
i++;
}
if (verif_all_map(&old_map[k], pars) == 1) if (verif_all_map(&old_map[k], pars) == 1)
return (1); return (1);
return (0); return (0);