github to gitea

This commit is contained in:
Leo Firmin
2025-10-27 23:12:49 +01:00
parent cd1882c3cc
commit 0c0d28ab36
134 changed files with 9850 additions and 338 deletions
+35
View File
@@ -0,0 +1,35 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* init.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lfirmin <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/08/22 18:57:21 by lfirmin #+# #+# */
/* Updated: 2025/10/08 16:21:46 by lfirmin ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub.h"
int init_data(t_data *data, char *path)
{
if (!data)
return (ft_error(ERROR_INIT_DATA), 1);
data->texture = malloc(sizeof(t_textures));
if (!data->texture)
return (ft_error(ERROR_INIT_TEX), 1);
init_parsing(&data->parsing);
init_textures(data->texture);
data->map = NULL;
data->map_path = path;
return (0);
}
void free_data(t_data *data)
{
if (!data)
return ;
if (data->texture)
free(data->texture);
free_char_array(data->map);
}
+70
View File
@@ -0,0 +1,70 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lfirmin <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/08/22 14:56:25 by lfirmin #+# #+# */
/* Updated: 2025/10/07 12:14:42 by lfirmin ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub.h"
void ft_error(char *message)
{
int len;
len = 0;
while (message[len])
len++;
write(2, ERROR_PREFIX, 6);
write(2, message, len);
write(2, "\n", 1);
}
void free_char_array(char **array)
{
int i;
if (!array)
return ;
i = 0;
while (array[i])
free(array[i++]);
free(array);
}
int ft_arrlen(char **arr)
{
int i;
while (arr[i])
i++;
return (i);
}
void print_array(char **array)
{
int i;
i = 0;
if (!array)
return ;
while (array[i])
{
printf("%s", array[i]);
i++;
}
}
int ft_strlen_2d(char **str)
{
int i;
i = 0;
while (str[i])
++i;
return (i);
}