generated from NaBuchholz/ft_template_repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nathalia Vitoria Buchholz
committed
Jan 24, 2025
1 parent
2870263
commit 8413c69
Showing
5 changed files
with
73 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -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); | ||
|
@@ -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); | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
1111111111111 | ||
1P0011E000C01 | ||
1000000000001 | ||
10000C0000001 | ||
1111111111111 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -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; | ||
|
||
} |