Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathalia Vitoria Buchholz committed Jan 24, 2025
1 parent 2870263 commit 8413c69
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 11 deletions.
14 changes: 7 additions & 7 deletions includes/so_long.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: nbuchhol <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/03 12:15:22 by nbuchhol #+# #+# */
/* Updated: 2025/01/20 16:56:01 by nbuchhol ### ########.fr */
/* Updated: 2025/01/24 14:41:59 by nbuchhol ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -26,16 +26,16 @@
typedef struct s_valid_check
{
size_t first_line_len;
int qnt_player;
int qnt_collectibles;
int qnt_exit;
size_t qnt_player;
size_t qnt_collectibles;
size_t qnt_exit;
} t_valid_check;

typedef struct s_game
{
char **map;
int map_hight;
int map_width;
size_t map_hight;
size_t map_width;
} t_game;

size_t ft_strlen(const char *s);
Expand All @@ -45,7 +45,7 @@ void *ft_calloc(size_t nmemb, size_t size);
char *ft_substr(const char *s, unsigned int start, size_t len);
char *get_next_line(int fd);
void free_map(int map_fd, char *line);
int error_handling(void);
int error_handling(int error_code);
int valid_map(char *map);


Expand Down
2 changes: 1 addition & 1 deletion maps/teste.ber
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
1111111111111
1P0011E000C01
1000000000001
10000C0000001
1111111111111
4 changes: 2 additions & 2 deletions src/error_handling.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/* By: nbuchhol <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/06 11:40:33 by nbuchhol #+# #+# */
/* Updated: 2025/01/06 11:43:18 by nbuchhol ### ########.fr */
/* Updated: 2025/01/23 11:45:45 by nbuchhol ### ########.fr */
/* */
/* ************************************************************************** */

#include "../includes/so_long.h"

int error_handling(void)
int error_handling(int error_code)
{
write(1, "Error\n", 7);
return (1);
Expand Down
52 changes: 52 additions & 0 deletions src/utils_validation_map.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils_validation_map.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nbuchhol <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/24 13:55:48 by nbuchhol #+# #+# */
/* Updated: 2025/01/24 15:15:20 by nbuchhol ### ########.fr */
/* */
/* ************************************************************************** */

#include "../includes/so_long.h"

int is_rectangle(char **map, size_t map_w, size_t map_h)
{
size_t x;

x = 1;
while (x < map_h)
{
if (ft_strlen(map[x]) != map_w)
return (error_handling(1));
x++;
}
return (0);
}

int valid_chars(char **map, size_t map_h, size_t map_w)
{
size_t y;
size_t x;

y = 0;
while (y < map_h)
{
x = 0;
while (x < map_w)
{
if (!ft_strchr("EPC10", map[y][x]))
return (error_handling(1));
x++;
}
y++;
}
return (0);
}

int element_blocked(char **map, size_t map_w, size_t map_h)
{
return (0);
}
12 changes: 11 additions & 1 deletion src/validate_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: nbuchhol <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/09 09:58:46 by nbuchhol #+# #+# */
/* Updated: 2025/01/20 16:54:14 by nbuchhol ### ########.fr */
/* Updated: 2025/01/23 11:49:39 by nbuchhol ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -73,7 +73,17 @@ int valid_map(char *map_file)
game.map = load_map(map_fd, &game);
if (!game.map)
return (free_map(map_fd, NULL), 1);
// flood fill
close(map_fd);
return (0);
}

int flood_fill(char **map)
{
int x;
int y;

x = 0;
y = 0;

}

0 comments on commit 8413c69

Please sign in to comment.