Cub3D
 
Loading...
Searching...
No Matches
Map verification functions

All the functions used to verify the map. More...

Functions

t_map ft_map_check_dimensions (t_map *map, char *map_name)
 Check the map structure and try to open the map file. sets error to -1 if an error occurred.
 
t_map ft_check_config (t_map *map)
 Check if the config is properly formatted or not.
 
t_map ft_check_floor_ceiling (t_map *map)
 Check the floor and ceiling colors.
 
size_t is_config_line (char *line)
 Return a positive number if a config line is detected.
 
t_map check_map_chars_borders (t_map *map)
 Check if the map has only acceptable characters and if there is borders everywhere, as it should be.
 
t_coordinates find_position (t_map *map, const char *charset)
 Find the position of the player with charset in the map.
 
int validate_map (t_map *map)
 Validate if the map has unclosed holes or an unfinished outer layer.
 
bool is_only_whitespace (const char *str)
 Check if the string contains only whitespace characters.
 
void suppress_newlines (char **lines)
 Suppress newlines in the given lines.
 
int is_walkable (char c)
 Check if a character is walkable or not.
 
int is_in_bounds (char **map, size_t y, size_t x)
 Check if a position is in bounds of map or not.
 

Detailed Description

All the functions used to verify the map.

Function Documentation

◆ check_map_chars_borders()

t_map check_map_chars_borders ( t_map * map)

Check if the map has only acceptable characters and if there is borders everywhere, as it should be.

Parameters
mapmap structure
Returns
t_map map structure
Here is the call graph for this function:

◆ find_position()

t_coordinates find_position ( t_map * map,
const char * charset )

Find the position of the player with charset in the map.

Parameters
mapmap structure
charsetstrings of autorized characters for player
Returns
t_coordinates coordinates of player
Here is the call graph for this function:

◆ ft_check_config()

t_map ft_check_config ( t_map * map)

Check if the config is properly formatted or not.

Parameters
mapmap structure
Returns
t_map map structure
Here is the call graph for this function:

◆ ft_check_floor_ceiling()

t_map ft_check_floor_ceiling ( t_map * map)

Check the floor and ceiling colors.

Parameters
mapmap structure
Returns
t_map map structure

◆ ft_map_check_dimensions()

t_map ft_map_check_dimensions ( t_map * map,
char * map_name )

Check the map structure and try to open the map file. sets error to -1 if an error occurred.

Parameters
mapmap structure to check and initialize
map_namename of the map file.
Returns
t_map Structure containing the map dimensions and metadata.
Here is the call graph for this function:

◆ is_config_line()

size_t is_config_line ( char * line)

Return a positive number if a config line is detected.

Parameters
lineline to check
Returns
int 0 not config line, positive number otherwise

◆ is_in_bounds()

int is_in_bounds ( char ** map,
size_t y,
size_t x )

Check if a position is in bounds of map or not.

Parameters
maparray of strings representing map
yy axis (number of lines)
xx axis (length of line)
Returns
int 1 OK, error otherwise
Here is the call graph for this function:

◆ is_only_whitespace()

bool is_only_whitespace ( const char * str)

Check if the string contains only whitespace characters.

Parameters
[in]strstring to check
Returns
bool 1 all whitespace, 0 otherwise

◆ is_walkable()

int is_walkable ( char c)

Check if a character is walkable or not.

Parameters
ccharacter
Returns
int 1 OK, error otherwise

◆ suppress_newlines()

void suppress_newlines ( char ** lines)

Suppress newlines in the given lines.

Parameters
[in,out]linesArray of strings to modify

◆ validate_map()

int validate_map ( t_map * map)

Validate if the map has unclosed holes or an unfinished outer layer.

Parameters
mapmap structure
Returns
int 1 OK, error otherwise
Here is the call graph for this function: