clean: norm
This commit is contained in:
parent
7f2a0b4a0e
commit
b95f3ee1af
12
map/map.c
12
map/map.c
@ -1,3 +1,15 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* map.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/05/16 14:50:15 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/05/16 14:50:16 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "map.h"
|
||||
#include "./parsing_private.h"
|
||||
|
||||
|
16
map/map.h
16
map/map.h
@ -1,3 +1,15 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* map.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/05/16 14:50:41 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/05/16 14:50:42 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef MAP_H
|
||||
# define MAP_H
|
||||
# include<sys/types.h>
|
||||
@ -10,8 +22,8 @@ typedef struct s_map
|
||||
char *img_path[4];
|
||||
long long color_bot;
|
||||
long long color_top;
|
||||
int size_x;
|
||||
int size_y;
|
||||
int size_x;
|
||||
int size_y;
|
||||
double ply_x;
|
||||
double ply_y;
|
||||
char direction;
|
||||
|
@ -1,9 +1,21 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* parsing.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/05/16 14:53:00 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/05/16 14:54:02 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "./parsing_private.h"
|
||||
#include "map.h"
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static ssize_t get_nb_line(const char *path)
|
||||
static ssize_t get_nb_line(const char *path)
|
||||
{
|
||||
int fd;
|
||||
char readed[1];
|
||||
@ -93,8 +105,6 @@ int map_parsing(const char *path, t_map *map)
|
||||
}
|
||||
header_freer(header);
|
||||
map->map = get_body((const char **) file_content, header_size);
|
||||
ft_freer_tab_ultimate(1, file_content);
|
||||
if (body_is_valid(map) == 0)
|
||||
return (1);
|
||||
return (0);
|
||||
ft_freer_tab_ultimate(1, file_content);
|
||||
return (body_is_valid(map) == 0);
|
||||
}
|
||||
|
@ -1,3 +1,15 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* parsing.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/05/16 14:54:09 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/05/16 14:54:10 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef PARSING_H
|
||||
# define PARSING_H
|
||||
# include "map.h"
|
||||
|
@ -1,10 +1,22 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* parsing_body.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/05/16 14:51:13 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/05/16 16:34:23 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "parsing_private.h"
|
||||
|
||||
char **get_body(const char **file_content, size_t header_size)
|
||||
{
|
||||
char **body;
|
||||
int i;
|
||||
int len;
|
||||
int i;
|
||||
int len;
|
||||
|
||||
len = 0;
|
||||
while (file_content[header_size + len] != NULL)
|
||||
@ -55,124 +67,3 @@ int get_spawn_position(const char **body, double *spawn_x, double *spawn_y)
|
||||
return (2);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static 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)
|
||||
{
|
||||
int y;
|
||||
int x;
|
||||
|
||||
y = 0;
|
||||
while (body[y] != NULL)
|
||||
{
|
||||
x = 0;
|
||||
while (body[y][x] != '\0')
|
||||
{
|
||||
if (body[y][x] == '0')
|
||||
{
|
||||
if (body[y + 1] == NULL || (y == 0)
|
||||
|| (body[y][x + 1] == '\0') || (x == 0)
|
||||
|| (body[y + 1][x] == ' ' || body[y + 1][x] == '\0')
|
||||
|| (body[y - 1][x] == ' ' || body[y - 1][x] == '\0')
|
||||
|| (body[y][x - 1] == ' ' || body[y][x - 1] == '\0')
|
||||
|| (body[y][x + 1] == ' ' || body[y][x + 1] == '\0'))
|
||||
return (1);
|
||||
}
|
||||
x++;
|
||||
}
|
||||
y++;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int body_contain_normal_char(const char **body)
|
||||
{
|
||||
unsigned int y;
|
||||
unsigned int x;
|
||||
|
||||
y = 0;
|
||||
while (body[y] != NULL)
|
||||
{
|
||||
x = 0;
|
||||
while (body[y][x] != '\0')
|
||||
{
|
||||
if (!ft_is_in(" 01NEWS", body[y][x]))
|
||||
{
|
||||
ft_eprintf("map: %c: invalid character at rows=%u, colums=%u", body[y][x], y, x);
|
||||
return (0);
|
||||
}
|
||||
x++;
|
||||
}
|
||||
y++;
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
void get_size(const char **body, t_map *map)
|
||||
{
|
||||
int y;
|
||||
int x;
|
||||
|
||||
map->size_x = 0;
|
||||
y = 0;
|
||||
while (body[y] != NULL)
|
||||
{
|
||||
x = ft_strlen(body[y]);
|
||||
if (x > map->size_x)
|
||||
map->size_x = x;
|
||||
y++;
|
||||
}
|
||||
map->size_y = y;
|
||||
}
|
||||
|
||||
int body_is_valid(t_map *map)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (map->map == NULL)
|
||||
return (0);
|
||||
error = get_spawn_position((const char **) map->map, &map->ply_x, &map->ply_y);
|
||||
if (error == 1)
|
||||
{
|
||||
ft_eprintf("map: spawn position: multiple definition");
|
||||
return (0);
|
||||
}
|
||||
else if (error == 2)
|
||||
{
|
||||
ft_eprintf("map: spawn position: not defined");
|
||||
return (0);
|
||||
}
|
||||
map->direction = map->map[(int) map->ply_y][(int) map->ply_x];
|
||||
map->map[(int) map->ply_y][(int) map->ply_x] = '0';
|
||||
error = map_is_in_one_part((const char **)map->map);
|
||||
if (error)
|
||||
{
|
||||
ft_eprintf("map: splitted");
|
||||
return (0);
|
||||
}
|
||||
if (body_contain_normal_char((const char **)map->map) == 0)
|
||||
return (0);
|
||||
error = map_surround((const char **)map->map);
|
||||
if (error)
|
||||
{
|
||||
ft_eprintf("map: not surrounded");
|
||||
return (0);
|
||||
}
|
||||
get_size((const char **)map->map, map);
|
||||
return (1);
|
||||
}
|
||||
|
145
map/parsing_body2.c
Normal file
145
map/parsing_body2.c
Normal file
@ -0,0 +1,145 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* parsing_body2.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/05/16 16:30:55 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/05/16 18:59:38 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#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)
|
||||
{
|
||||
int y;
|
||||
int x;
|
||||
|
||||
y = 0;
|
||||
while (body[y] != NULL)
|
||||
{
|
||||
x = 0;
|
||||
while (body[y][x] != '\0')
|
||||
{
|
||||
if (body[y][x] == '0')
|
||||
{
|
||||
if (body[y + 1] == NULL || (y == 0)
|
||||
|| (body[y][x + 1] == '\0') || (x == 0)
|
||||
|| (body[y + 1][x] == ' ' || body[y + 1][x] == '\0')
|
||||
|| (body[y - 1][x] == ' ' || body[y - 1][x] == '\0')
|
||||
|| (body[y][x - 1] == ' ' || body[y][x - 1] == '\0')
|
||||
|| (body[y][x + 1] == ' ' || body[y][x + 1] == '\0'))
|
||||
return (1);
|
||||
}
|
||||
x++;
|
||||
}
|
||||
y++;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int body_contain_normal_char(const char **body)
|
||||
{
|
||||
unsigned int y;
|
||||
unsigned int x;
|
||||
|
||||
y = 0;
|
||||
while (body[y] != NULL)
|
||||
{
|
||||
x = 0;
|
||||
while (body[y][x] != '\0')
|
||||
{
|
||||
if (!ft_is_in(" 01NEWS", body[y][x]))
|
||||
{
|
||||
ft_eprintf("map: %c: invalid character at rows=%u, colums=%u",
|
||||
body[y][x], y, x);
|
||||
return (0);
|
||||
}
|
||||
x++;
|
||||
}
|
||||
y++;
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
void get_size(const char **body, t_map *map)
|
||||
{
|
||||
int y;
|
||||
int x;
|
||||
|
||||
map->size_x = 0;
|
||||
y = 0;
|
||||
while (body[y] != NULL)
|
||||
{
|
||||
x = ft_strlen(body[y]);
|
||||
if (x > map->size_x)
|
||||
map->size_x = x;
|
||||
y++;
|
||||
}
|
||||
map->size_y = y;
|
||||
}
|
||||
|
||||
int body_is_valid2(t_map *map)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = get_spawn_position((const char **) map->map,
|
||||
&map->ply_x, &map->ply_y);
|
||||
if (error == 1)
|
||||
{
|
||||
ft_eprintf("map: spawn position: multiple definition");
|
||||
return (0);
|
||||
}
|
||||
else if (error == 2)
|
||||
{
|
||||
ft_eprintf("map: spawn position: not defined");
|
||||
return (0);
|
||||
}
|
||||
map->direction = map->map[(int) map->ply_y][(int) map->ply_x];
|
||||
map->map[(int) map->ply_y][(int) map->ply_x] = '0';
|
||||
error = map_is_in_one_part((const char **)map->map);
|
||||
if (error)
|
||||
{
|
||||
ft_eprintf("map: splitted");
|
||||
return (0);
|
||||
}
|
||||
if (body_contain_normal_char((const char **)map->map) == 0)
|
||||
return (0);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int body_is_valid(t_map *map)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (map->map == NULL)
|
||||
return (0);
|
||||
if (body_is_valid2(map) == 0)
|
||||
return (0);
|
||||
error = map_surround((const char **)map->map);
|
||||
if (error)
|
||||
{
|
||||
ft_eprintf("map: not surrounded");
|
||||
return (0);
|
||||
}
|
||||
get_size((const char **)map->map, map);
|
||||
return (1);
|
||||
}
|
@ -1,4 +1,17 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* parsing_header.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/05/16 16:28:10 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/05/16 16:54:16 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "./parsing_private.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
int get_token(const char *key)
|
||||
{
|
||||
@ -52,7 +65,7 @@ static size_t get_header_size(const char **file_content, size_t *header_size)
|
||||
while (file_content[++i] != NULL)
|
||||
{
|
||||
if (ft_contain_only(file_content[i], ' '))
|
||||
continue;
|
||||
continue ;
|
||||
if (!is_header(file_content[i]))
|
||||
break ;
|
||||
len++;
|
||||
@ -66,16 +79,16 @@ char ***get_header(const char **file_content, size_t *header_size)
|
||||
char ***header;
|
||||
size_t len;
|
||||
size_t i;
|
||||
size_t y;
|
||||
ssize_t y;
|
||||
|
||||
len = get_header_size(file_content, header_size);
|
||||
header = malloc(sizeof(char *) * (len + 1));
|
||||
if (header == NULL)
|
||||
return (NULL);
|
||||
header[len] = NULL;
|
||||
y = 0;
|
||||
y = -1;
|
||||
i = 0;
|
||||
while (y < len)
|
||||
while (++y < (ssize_t) len)
|
||||
{
|
||||
while (ft_contain_only(file_content[i], ' '))
|
||||
i++;
|
||||
@ -85,7 +98,6 @@ char ***get_header(const char **file_content, size_t *header_size)
|
||||
ft_cancel((void **) header, y);
|
||||
return (NULL);
|
||||
}
|
||||
y++;
|
||||
i++;
|
||||
}
|
||||
return (header);
|
||||
|
@ -1,7 +1,18 @@
|
||||
#include "./parsing_private.h"
|
||||
#include "map.h"
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* parsing_header2.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/05/16 17:28:58 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/05/16 19:02:08 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
static int set_texture(t_map *map, int token, const char *key, char *value)
|
||||
#include "./parsing_private.h"
|
||||
|
||||
int set_texture(t_map *map, int token, const char *key, const char *value)
|
||||
{
|
||||
if (map->img_path[token - 1] != NULL)
|
||||
{
|
||||
@ -14,13 +25,13 @@ static int set_texture(t_map *map, int token, const char *key, char *value)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static unsigned int get_rgb(unsigned char red, unsigned char green,
|
||||
static unsigned int get_rgb(unsigned char red, unsigned char green,
|
||||
unsigned char blue)
|
||||
{
|
||||
return (red << 24 | green << 16 | blue << 8 | 255);
|
||||
}
|
||||
|
||||
static long long get_color(const char **tab)
|
||||
static long long get_color(const char **tab)
|
||||
{
|
||||
long long rgb[3];
|
||||
size_t i;
|
||||
@ -41,10 +52,11 @@ static long long get_color(const char **tab)
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return (get_rgb((unsigned char) rgb[0], (unsigned char) rgb[1], (unsigned char) rgb[2]));
|
||||
return (get_rgb((unsigned char) rgb[0],
|
||||
(unsigned char) rgb[1], (unsigned char) rgb[2]));
|
||||
}
|
||||
|
||||
static int set_color(long long *color, const char *key, char *value)
|
||||
int set_color(long long *color, const char *key, const char *value)
|
||||
{
|
||||
char **tab;
|
||||
|
||||
@ -71,11 +83,11 @@ int check_header_is_complete(t_map *map)
|
||||
{
|
||||
if (map->img_path[0] == NULL)
|
||||
ft_eprintf("map: incomplete: Nord texture is missing");
|
||||
else if (map->img_path[0] == NULL)
|
||||
else if (map->img_path[1] == NULL)
|
||||
ft_eprintf("map: incomplete: WEST texture is missing");
|
||||
else if (map->img_path[0] == NULL)
|
||||
else if (map->img_path[2] == NULL)
|
||||
ft_eprintf("map: incomplete: SOUTH texture is missing");
|
||||
else if (map->img_path[0] == NULL)
|
||||
else if (map->img_path[3] == NULL)
|
||||
ft_eprintf("map: incomplete: EAST texture is missing");
|
||||
else if (map->color_bot == -1)
|
||||
ft_eprintf("map: incomplete: floor color is missing");
|
||||
@ -85,39 +97,3 @@ int check_header_is_complete(t_map *map)
|
||||
return (0);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int header_is_valid(char ***header, t_map *map)
|
||||
{
|
||||
size_t i;
|
||||
int token;
|
||||
|
||||
|
||||
if (header == NULL)
|
||||
return (1);
|
||||
map->color_bot = -1;
|
||||
map->color_top = -1;
|
||||
i = 0;
|
||||
while (i < ft_tablen((const void **) header))
|
||||
{
|
||||
token = get_token(header[i][0]);
|
||||
if (token > 0 && token < 5)
|
||||
{
|
||||
if (set_texture(map, token, header[i][0], header[i][1]))
|
||||
return (1);
|
||||
}
|
||||
else if (token == 5)
|
||||
{
|
||||
if (set_color(&map->color_bot,
|
||||
header[i][0], header[i][1]))
|
||||
return (1);
|
||||
}
|
||||
else if (token == 6)
|
||||
{
|
||||
if (set_color(&map->color_top,
|
||||
header[i][0], header[i][1]))
|
||||
return (1);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return (check_header_is_complete(map));
|
||||
}
|
||||
|
56
map/parsing_header3.c
Normal file
56
map/parsing_header3.c
Normal file
@ -0,0 +1,56 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* parsing_header3.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/05/16 16:41:51 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/05/16 19:07:12 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "./parsing_private.h"
|
||||
|
||||
static int set_header_data(char ***header, size_t i, t_map *map)
|
||||
{
|
||||
int token;
|
||||
|
||||
token = get_token(header[i][0]);
|
||||
if (token > 0 && token < 5)
|
||||
{
|
||||
if (set_texture(map, token, header[i][0], header[i][1]))
|
||||
return (1);
|
||||
}
|
||||
else if (token == 5)
|
||||
{
|
||||
if (set_color(&map->color_bot,
|
||||
header[i][0], header[i][1]))
|
||||
return (1);
|
||||
}
|
||||
else if (token == 6)
|
||||
{
|
||||
if (set_color(&map->color_top,
|
||||
header[i][0], header[i][1]))
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
int header_is_valid(char ***header, t_map *map)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (header == NULL)
|
||||
return (1);
|
||||
map->color_bot = -1;
|
||||
map->color_top = -1;
|
||||
i = 0;
|
||||
while (i < ft_tablen((const void **) header))
|
||||
{
|
||||
if (set_header_data(header, i, map))
|
||||
return (1);
|
||||
i++;
|
||||
}
|
||||
return (check_header_is_complete(map));
|
||||
}
|
@ -1,3 +1,15 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* parsing_meta.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/05/16 16:28:39 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/05/16 16:28:41 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "./parsing_private.h"
|
||||
|
||||
static int name_check(const char *path)
|
||||
|
@ -1,3 +1,15 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* parsing_private.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/05/16 16:27:57 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/05/16 18:46:21 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef PARSING_PRIVATE_H
|
||||
# define PARSING_PRIVATE_H
|
||||
# include <sys/types.h>
|
||||
@ -10,4 +22,9 @@ char ***get_header(const char **file_content, size_t *header_size);
|
||||
int header_is_valid(char ***header, t_map *map);
|
||||
char **get_body(const char **file_content, size_t header_size);
|
||||
int body_is_valid(t_map *map);
|
||||
int get_spawn_position(const char **body, double *x, double *y);
|
||||
int map_is_in_one_part(const char **body);
|
||||
int set_texture(t_map *map, int token, const char *key, const char *value);
|
||||
int set_color(long long *color, const char *key, const char *value);
|
||||
int check_header_is_complete(t_map *map);
|
||||
#endif
|
||||
|
9
maps/body_not_surrond_min.cub
Normal file
9
maps/body_not_surrond_min.cub
Normal file
@ -0,0 +1,9 @@
|
||||
NO ./path_to_the_north_texture
|
||||
SO ./path_to_the_south_texture
|
||||
WE ./path_to_the_west_texture
|
||||
EA ./path_to_the_east_texture
|
||||
|
||||
F 200,100,0
|
||||
C 225,30,0
|
||||
|
||||
N
|
10
maps/header_missing.cub
Normal file
10
maps/header_missing.cub
Normal file
@ -0,0 +1,10 @@
|
||||
NO ./path_to_the_north_texture
|
||||
SO ./path_to_the_south_texture
|
||||
EA ./path_to_the_east_texture
|
||||
|
||||
F 200,100,0
|
||||
C 225,30,0
|
||||
|
||||
1
|
||||
1N1
|
||||
1
|
Loading…
Reference in New Issue
Block a user