New folder structure
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* frees.c :+: :+: :+: */
|
||||
/* clean.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/11/28 20:03:22 by aortigos #+# #+# */
|
||||
/* Updated: 2025/12/11 19:57:55 by aortigos ### ########.fr */
|
||||
/* Updated: 2025/12/15 10:27:21 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -26,7 +26,7 @@ void free_map(t_data *data)
|
||||
{
|
||||
free2d(data->sq_map);
|
||||
free2d(data->map2d);
|
||||
free2d(data->ture2d);
|
||||
free2d(data->texture2d);
|
||||
if (data->ff)
|
||||
free2d(data->ff);
|
||||
if (data->cc)
|
||||
@@ -39,8 +39,8 @@ void free_m(t_mlx *mlx)
|
||||
free2d(mlx->dt->sq_map);
|
||||
if (mlx->dt->map2d)
|
||||
free2d(mlx->dt->map2d);
|
||||
if (mlx->dt->ture2d)
|
||||
free2d(mlx->dt->ture2d);
|
||||
if (mlx->dt->texture2d)
|
||||
free2d(mlx->dt->texture2d);
|
||||
if (mlx->dt->ff)
|
||||
free2d(mlx->dt->ff);
|
||||
if (mlx->dt->cc)
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/12/04 09:28:05 by aortigos #+# #+# */
|
||||
/* Updated: 2025/12/09 19:52:54 by aortigos ### ########.fr */
|
||||
/* Updated: 2025/12/15 10:27:21 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -67,7 +67,7 @@ int read_map_(t_data *map, int count)
|
||||
if (!map->map2d)
|
||||
return (ft_memfree(map->map), 0);
|
||||
ft_memfree(map->map);
|
||||
if (!check_tures_space_tab(map->ture2d, count) || !parse_rgb(map->ture2d)
|
||||
if (!check_tures_space_tab(map->texture2d, count) || !parse_rgb(map->texture2d)
|
||||
|| !check_dup(map) || !check_first_last_line(map->map2d)
|
||||
|| !surrounded_by_one(map->map2d))
|
||||
return (free2d(map->map2d), 0);
|
||||
@@ -6,13 +6,13 @@
|
||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/12/04 10:07:52 by aortigos #+# #+# */
|
||||
/* Updated: 2025/12/09 19:51:28 by aortigos ### ########.fr */
|
||||
/* Updated: 2025/12/15 10:27:21 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../includes/cub3d.h"
|
||||
|
||||
int check_tures_space_tab(char **ture2d, int count)
|
||||
int check_tures_space_tab(char **texture2d, int count)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -20,20 +20,20 @@ int check_tures_space_tab(char **ture2d, int count)
|
||||
if (count != 6)
|
||||
return (0);
|
||||
while (++i < count)
|
||||
if (!is_valid_texture(ture2d[i]))
|
||||
if (!is_valid_texture(texture2d[i]))
|
||||
return (ft_putstr_fd("texture error\n", 2), 0);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int parse_rgb(char **ture2d)
|
||||
int parse_rgb(char **texture2d)
|
||||
{
|
||||
int i;
|
||||
char *ptr;
|
||||
|
||||
i = 0;
|
||||
while (ture2d[i])
|
||||
while (texture2d[i])
|
||||
{
|
||||
ptr = ture2d[i];
|
||||
ptr = texture2d[i];
|
||||
while (ft_isspace(*ptr))
|
||||
ptr++;
|
||||
if (ptr[0] == 'F' || ptr[0] == 'C')
|
||||
@@ -50,12 +50,12 @@ int check_dup(t_data *m)
|
||||
int j;
|
||||
|
||||
i = 0;
|
||||
while (m->ture2d[i])
|
||||
while (m->texture2d[i])
|
||||
{
|
||||
j = i + 1;
|
||||
while (m->ture2d[j])
|
||||
while (m->texture2d[j])
|
||||
{
|
||||
if (!ft_strncmp(m->ture2d[i], m->ture2d[j], 2))
|
||||
if (!ft_strncmp(m->texture2d[i], m->texture2d[j], 2))
|
||||
return (ft_putstr_fd(ERR_MAP_DUP, 2), 0);
|
||||
j++;
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/12/05 16:30:33 by aortigos #+# #+# */
|
||||
/* Updated: 2025/12/10 12:25:34 by aortigos ### ########.fr */
|
||||
/* Updated: 2025/12/15 10:27:21 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -109,6 +109,6 @@ int valid_map(t_data *m)
|
||||
m->h_map = ft_arraylen(m->sq_map);
|
||||
m->w_map = ft_strlen(m->sq_map[0]);
|
||||
if (!h_map(m->sq_map) || !v_map(m->sq_map))
|
||||
return (free2d(m->sq_map), free2d(m->map2d), free2d(m->ture2d), 0);
|
||||
return (free2d(m->sq_map), free2d(m->map2d), free2d(m->texture2d), 0);
|
||||
return (1);
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/12/01 08:48:55 by aortigos #+# #+# */
|
||||
/* Updated: 2025/12/11 19:57:55 by aortigos ### ########.fr */
|
||||
/* Updated: 2025/12/15 10:27:21 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -64,9 +64,9 @@ int lst_ture(t_data *m, t_texture_list **l_ture)
|
||||
t_texture_list *tmp;
|
||||
|
||||
i = 0;
|
||||
while (m->ture2d[i])
|
||||
while (m->texture2d[i])
|
||||
{
|
||||
tmp = new_texture(m->ture2d[i++]);
|
||||
tmp = new_texture(m->texture2d[i++]);
|
||||
if (!tmp)
|
||||
return (0);
|
||||
lst_back_ture(l_ture, tmp);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/11/25 19:47:38 by aortigos #+# #+# */
|
||||
/* Updated: 2025/12/09 19:47:13 by aortigos ### ########.fr */
|
||||
/* Updated: 2025/12/15 10:27:21 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -24,11 +24,11 @@ int read_map(char *av, t_data *map, int *count)
|
||||
process_map(map, count);
|
||||
if (!check_count_textures(map, *count))
|
||||
return (freetl(map->ture, map->line, map->fd), 0);
|
||||
map->ture2d = ft_split(map->ture, '\n');
|
||||
if (!map->ture2d)
|
||||
map->texture2d = ft_split(map->ture, '\n');
|
||||
if (!map->texture2d)
|
||||
return (freetl(map->ture, map->line, map->fd), 0);
|
||||
if (!read_map_(map, *count))
|
||||
return (freetl(map->ture, map->line, map->fd), free2d(map->ture2d), 0);
|
||||
return (freetl(map->ture, map->line, map->fd), free2d(map->texture2d), 0);
|
||||
return (freetl(map->ture, map->line, map->fd), 1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user