clean: norm

This commit is contained in:
Camille Chauvet 2023-06-12 14:31:59 +02:00
parent ab4e7e7034
commit 45521211b0
30 changed files with 315 additions and 23 deletions

30
TestParsing/..cub Normal file
View File

@ -0,0 +1,30 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
F 220,100,0
C 0,0,255
111111111111111111111111
1000000000110000000000001
1011000001110000000000001
1001000001 1000000000001
111111111011000001110000000000001
100000000011000001110111111111111
11110111111111011100000010001
11110111111111011101010010001
11000000110101011100000010001
10000000E00000100000000100011
10000000000000001101010010001
11000001110101011111011110001
11110111 1110101 101111010001
11111111 1111111111111111111

0
TestParsing/.cub Normal file
View File

View File

@ -0,0 +1,12 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
WE ./assets/W.xpm
F 200,100,0
C 0,0,255
11111111
10000001
10N011111
11111

0
TestParsing/Empty.cub Normal file
View File

View File

@ -0,0 +1,13 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
F 200,100,0
C 0,0,255
11111111
10000001
10N011111
11111

1
TestParsing/EmptyNL.cub Normal file
View File

@ -0,0 +1 @@

View File

@ -0,0 +1,9 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
F 200,100,0
C 0,0,255

View File

@ -0,0 +1,12 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
F 200,100,0
11111111
10000001
10N011111
11111

View File

@ -0,0 +1,11 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
F 200,100,0
C 0,0,255
11111111
10000001
10N011111
11111

View File

@ -0,0 +1,12 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/NotAFile
F 200,100,0
C 0,0,255
11111111
10000001
10N011111
11111

12
TestParsing/NoPos.cub Normal file
View File

@ -0,0 +1,12 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
F 200,100,0
C 0,0,255
11111111
10000001
100011111
11111

View File

@ -0,0 +1,12 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/ENoRight.xpm
F 200,100,0
C 0,0,255
11111111
10000001
10N011111
11111

View File

@ -0,0 +1,12 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
F 200,100,0
C 0,0,255
11111111
10000001
10N011111
11011

View File

@ -0,0 +1,12 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
F 200,100,0
C 0,0,255
11111100
10000001
10N011111
11111

View File

@ -0,0 +1,12 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
F 200,100,0
C 0,0,255
11111111
10000001
00N011111
11111

View File

@ -0,0 +1,13 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
F 200,100,0
C 0,0,255
11111111
10000001
100 00001
10N011111
11111

View File

@ -0,0 +1,12 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
F 200,100,0
C 0,0,255
11111111
10000000
10N011111
11111

12
TestParsing/NoWallTop.cub Normal file
View File

@ -0,0 +1,12 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
F 200,100,0
C 0,0,255
11101111
10000001
10N011111
11111

View File

@ -0,0 +1,13 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
EA ./assets/E.xpm
F 200,100,0
C 0,0,255
11111111
10000001
10N011111
11111

12
TestParsing/TwoPos.cub Normal file
View File

@ -0,0 +1,12 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
F 200,100,0
C 0,0,255
11111111
100000E1
10N011111
11111

View File

@ -0,0 +1,12 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
F 200,100,0
C 0,0,255
11111111
10008001
10N011111
11111

12
TestParsing/WrongArg.cub Normal file
View File

@ -0,0 +1,12 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EW ./assets/E.xpm
F 200,100,0
C 0,0,255
11111111
10000001
10N011111
11111

View File

@ -0,0 +1,12 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
F 200,100,0
C 0,0,255
11111111
10000001
10N011111
11111

View File

@ -0,0 +1,12 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
F 200,100,0
C 0,0,255
11111111
10000001
10N011111
11111

12
TestParsing/WrongRGB.cub Normal file
View File

@ -0,0 +1,12 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
F 200,100,0
C 0,0,256
11111111
10000001
10N011111
11111

10
TestParsing/map_empty.cub Normal file
View File

@ -0,0 +1,10 @@
NO ./assets/N.xpm
SO ./assets/S.xpm
WE ./assets/W.xpm
EA ./assets/E.xpm
F 200,100,0
C 0,0,255

View File

@ -6,7 +6,7 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */ /* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/26 12:34:04 by erey-bet #+# #+# */ /* Created: 2023/04/26 12:34:04 by erey-bet #+# #+# */
/* Updated: 2023/05/05 11:37:41 by cchauvet ### ########.fr */ /* Updated: 2023/06/12 14:31:28 by cchauvet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -24,7 +24,6 @@
# include <stdio.h> # include <stdio.h>
# include <unistd.h> # include <unistd.h>
/*INIT*/ /*INIT*/
int start_game(t_map map); int start_game(t_map map);

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/04 14:03:10 by cchauvet #+# #+# */ /* Created: 2023/01/04 14:03:10 by cchauvet #+# #+# */
/* Updated: 2023/05/03 11:02:33 by cchauvet ### ########.fr */ /* Updated: 2023/06/12 14:17:50 by cchauvet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -31,7 +31,8 @@ char *ft_strgen(char c, size_t len);
char *ft_strfjoin(char *s1, char *s2); char *ft_strfjoin(char *s1, char *s2);
char *ft_strmerger(size_t arg_len, ...); char *ft_strmerger(size_t arg_len, ...);
int ft_is_in(const char *str, char c); int ft_is_in(const char *str, char c);
char **ft_tabrealloc(char **tab, size_t current_size, size_t new_size); char **ft_tabrealloc(char **tab, size_t current_size,
size_t new_size);
char *ft_strndup(const char *src, size_t n); char *ft_strndup(const char *src, size_t n);
ssize_t ft_strchri(char *str, char c); ssize_t ft_strchri(char *str, char c);
int ft_contain_only_str(const char *str, const char *to_find); int ft_contain_only_str(const char *str, const char *to_find);

View File

@ -6,7 +6,7 @@
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */ /* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/16 14:51:13 by cchauvet #+# #+# */ /* Created: 2023/05/16 14:51:13 by cchauvet #+# #+# */
/* Updated: 2023/05/16 16:34:23 by cchauvet ### ########.fr */ /* Updated: 2023/05/17 16:29:12 by cchauvet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -67,3 +67,19 @@ int get_spawn_position(const char **body, double *spawn_x, double *spawn_y)
return (2); return (2);
return (0); return (0);
} }
int map_is_in_one_part(const char **body)
{
int y;
y = ft_tablen((const void **) body) - 1;
while (body[y][0] == '\0' || ft_contain_only(body[y], ' '))
y--;
while (y > 0)
{
if (body[y][0] == '\0' || ft_contain_only(body[y], ' '))
return (1);
y--;
}
return (0);
}

View File

@ -6,28 +6,12 @@
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/16 16:30:55 by cchauvet #+# #+# */ /* Created: 2023/05/16 16:30:55 by cchauvet #+# #+# */
/* Updated: 2023/05/16 18:59:38 by cchauvet ### ########.fr */ /* Updated: 2023/06/12 14:29:44 by cchauvet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "parsing_private.h" #include "parsing_private.h"
int map_is_in_one_part(const char **body)
{
int y;
y = ft_tablen((const void **) body) - 1;
while (body[y][0] == '\0' || ft_contain_only(body[y], ' '))
y--;
while (y > 0)
{
if (body[y][0] == '\0' || ft_contain_only(body[y], ' '))
return (1);
y--;
}
return (0);
}
static int map_surround(const char **body) static int map_surround(const char **body)
{ {
int y; int y;