avant d'aller bosser a carreouf

This commit is contained in:
Theo Champion 2025-06-24 00:17:33 +02:00
parent b185cddbf0
commit 321ef3db7c
7 changed files with 393 additions and 288 deletions

View file

@ -1,7 +1,20 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* maputils.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/06/21 19:34:43 by tchampio #+# #+# */
/* Updated: 2025/06/21 19:47:07 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef MAPUTILS_H
# define MAPUTILS_H
# include <stdbool.h>
# include "structs.h"
// TODO: mettre ca dans un autre fichier
# define RESET "\033[0m"
@ -13,25 +26,22 @@
# define CYAN "\033[36m"
# define BOLD "\033[1m"
typedef struct s_mapdata
{
char *filename;
char *NO_texture;
char *SO_texture;
char *WE_texture;
char *EA_texture;
int f_color;
int c_color;
int mapheight;
char **map;
char **mapflood;
int skipped_lines;
bool isvalid;
int startx;
int starty;
char error[1024];
} t_mapdata;
bool check_cubfile(char *filename, t_mapdata *map);
bool check_cubfile(char *filename, t_mapdata *map);
bool check_filename(t_mapdata *map, char *file);
void populate_maps(t_mapdata *map, int fd);
bool check_walls(t_mapdata *map);
bool check_bare_minimum(t_mapdata *map);
bool has_forbidden_characters(char *line);
void print_mapdata(const t_mapdata *data);
unsigned long set_color(const char *s, t_mapdata *map);
bool set_textures(char *line, t_mapdata *map);
bool add_textures(int fd, t_mapdata *map);
void free_tab_length(char **tab, int length);
int copy_old_map(t_mapdata *map, char **newmap,
char **newmapflood, int length);
void add_map_line(const char *line, t_mapdata *map);
void print_map(char **map);
bool check_cubfile(char *file, t_mapdata *map);
#endif