Add map checks *

add:
- check if map is surronded by walls
- check file extension
dev:
- Makefile: now can include libraries
- add library libft
- add testmaps
- norm
This commit is contained in:
mcolonna 2024-10-10 13:34:24 +02:00
parent 5bad24dcee
commit 40d8462689
64 changed files with 1786 additions and 72 deletions

View file

@ -6,7 +6,7 @@
/* By: mcolonna <mcolonna@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/01 13:59:04 by mcolonna #+# #+# */
/* Updated: 2024/10/04 13:13:04 by mcolonna ### ########.fr */
/* Updated: 2024/10/10 11:59:39 by mcolonna ### ########.fr */
/* */
/* ************************************************************************** */
@ -50,6 +50,9 @@ typedef struct s_object
/// @brief Represents a case of the map.
typedef struct s_map_case
{
/// @brief 'true' if the case is inside of the room (false with ' ' char)
bool inside;
/// @brief Is the case empty or a wall?
t_map_wall wall;
@ -103,4 +106,10 @@ bool map_from_file(t_map *dest, const char *file);
/// @brief Destroy the map to avoid leaks.
void map_destroy(t_map *map);
/// @brief Return true if the map is valid. Write an error message on stderr.
///
/// @param map The map to check.
/// @return true if the map is valid, false if not.
bool check_map(const t_map *map);
#endif

View file

@ -6,16 +6,13 @@
/* By: mcolonna <mcolonna@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/03 14:19:03 by mc #+# #+# */
/* Updated: 2024/10/04 15:27:07 by mcolonna ### ########.fr */
/* Updated: 2024/10/10 12:37:34 by mcolonna ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef UTIL_H
# define UTIL_H
/// @brief Get the length of a string.
int getlen(const char *str);
/// @brief Write an error message on stderr.
///
/// @param str... All the strings to write. The last parameter MUST BE NULL.