intra to gitea

This commit is contained in:
root
2025-11-15 22:16:13 +00:00
parent 0c0d28ab36
commit 50b45e597f
27 changed files with 888 additions and 624 deletions
+2
View File
@@ -31,6 +31,8 @@ int check_extension(char *map_path)
{
int len_map_path;
if (!map_path)
return (1);
len_map_path = ft_strlen(map_path);
if (len_map_path < 4)
return (ft_error(ERROR_EXT), 1);
+5 -1
View File
@@ -6,7 +6,7 @@
/* By: lfirmin <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/08/23 13:29:28 by lfirmin #+# #+# */
/* Updated: 2025/10/07 10:13:07 by lfirmin ### ########.fr */
/* Updated: 2025/11/03 09:02:55 by lfirmin ### ########.fr */
/* */
/* ************************************************************************** */
@@ -20,6 +20,8 @@ int get_map(t_data *data)
if (nb_line <= 0)
return (ft_error(ERROR_EMPTY), 1);
data->parsing.raw_map = ft_calloc(nb_line + 1, sizeof(char *));
if (!data->parsing.raw_map)
return (1);
if (put_map_on_array(data))
{
free_char_array(data->parsing.raw_map);
@@ -60,5 +62,7 @@ char *clean_line(char *raw_line)
if (!raw_line)
return (NULL);
cleaned = ft_strtrim(raw_line, " \t\n\r");
if (!cleaned)
return (NULL);
return (cleaned);
}
+2
View File
@@ -16,6 +16,8 @@ static int process_config_line(char *line, t_data *data, int *j)
char *cleaned;
cleaned = clean_line(line);
if (!cleaned)
return (-1);
if (get_texture_path(cleaned, data->texture, j))
{
free(line);
+17 -4
View File
@@ -11,18 +11,31 @@
/* ************************************************************************** */
#include "cub.h"
static int assign_texture(char *line, char **dest)
{
char *path;
path = ft_strtrim(line + 2, " \t\n\r");
if (!path)
return (ft_error("Memory allocation failed"), -1);
*dest = path;
return (0);
}
int get_texture_path(char *line, t_textures *texture, int *j)
{
if (!line)
return (-1);
if (check_extension_2(line) && !is_color_line(line))
return (ft_error(ERROR_NOT_XMP), 1);
else if (is_texture_line(line) == 1 && j[0]++ == 0)
texture->north = ft_strtrim(line + 2, " \t\n\r");
return (assign_texture(line, &texture->north));
else if (is_texture_line(line) == 2 && j[1]++ == 0)
texture->south = ft_strtrim(line + 2, " \t\n\r");
return (assign_texture(line, &texture->south));
else if (is_texture_line(line) == 3 && j[2]++ == 0)
texture->west = ft_strtrim(line + 2, " \t\n\r");
return (assign_texture(line, &texture->west));
else if (is_texture_line(line) == 4 && j[3]++ == 0)
texture->east = ft_strtrim(line + 2, " \t\n\r");
return (assign_texture(line, &texture->east));
else if (is_color_line(line) == 1 && j[4]++ == 0)
get_rgb_values(line, texture->floor);
else if (is_color_line(line) == 2 && j[5]++ == 0)
+4 -2
View File
@@ -6,7 +6,7 @@
/* By: lfirmin <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/08/24 11:58:39 by lfirmin #+# #+# */
/* Updated: 2025/10/08 14:05:47 by lfirmin ### ########.fr */
/* Updated: 2025/11/03 09:03:03 by lfirmin ### ########.fr */
/* */
/* ************************************************************************** */
@@ -16,6 +16,8 @@ int check_extension_2(char *str)
{
size_t len;
if (!str)
return (1);
len = strlen(str);
if (len < 4)
return (1);
@@ -39,7 +41,7 @@ int is_config_line(char *line)
|| ft_strncmp(trimmed, "EA ", 3) == 0
|| ft_strncmp(trimmed, "F ", 2) == 0
|| ft_strncmp(trimmed, "C ", 2) == 0)
result = 1;
result = 1;
free(trimmed);
return (result);
}