「🚧」 test: testing things, might broke.
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: madumerg <madumerg@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/04 21:33:35 by madumerg #+# #+# */
|
||||
/* Updated: 2024/09/11 11:11:05 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/09/11 11:19:25 by madumerg ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -0,0 +1,74 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* check_map.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: madumerg <madumerg@42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/11 11:24:13 by madumerg #+# #+# */
|
||||
/* Updated: 2024/09/11 15:24:53 by madumerg ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "cub3d.h"
|
||||
|
||||
int verif_all_map(char **map)
|
||||
{
|
||||
if (check_char_map(map) == 1)
|
||||
return (err_mess(WRONG_CHAR));
|
||||
return (0);
|
||||
}
|
||||
|
||||
int verif_char(char c)
|
||||
{
|
||||
if (c != '1' && c != '0' && c != 'N' && c != 'S' && c != 'W' && c != 'E' && c != ' ')
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int check_char_map(char **map)
|
||||
{
|
||||
int y;
|
||||
int x;
|
||||
|
||||
y = 0;
|
||||
while (map[y])
|
||||
{
|
||||
x = 0;
|
||||
convert_white_s(map[y]);
|
||||
while (map[y][x])
|
||||
{
|
||||
if (verif_char(map[y][x]) == 1)
|
||||
return (1);
|
||||
x++;
|
||||
}
|
||||
y++;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
char **parse_map(char *map)
|
||||
{
|
||||
int fd;
|
||||
char **parse_map;
|
||||
char *save;
|
||||
char *join;
|
||||
|
||||
fd = open(map, O_RDONLY);
|
||||
save = get_next_line(fd);
|
||||
join = ft_calloc(1, 1);
|
||||
if (!join)
|
||||
return (NULL);
|
||||
while (save != NULL)
|
||||
{
|
||||
join = ft_strjoin(join, save);
|
||||
free(save);
|
||||
save = get_next_line(fd);
|
||||
}
|
||||
parse_map = ft_split(join, '\n');
|
||||
free(join);
|
||||
close(fd);
|
||||
return (parse_map);
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,7 +12,12 @@
|
||||
//envoyer de 4 a 5 inclus dans check rgb format
|
||||
//envoyer de 6 a jusqu a la fin dans check map
|
||||
|
||||
// convertir tt les whites spaces en simple espace
|
||||
|
||||
struct typedef s_pars
|
||||
{
|
||||
|
||||
} t_pars;
|
||||
|
||||
//faire struct de coor
|
||||
utiliser la ft pour couleur
|
||||
|
Reference in New Issue
Block a user