-
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.
add:(vSKAH): file extension are now checked
- Loading branch information
Showing
5 changed files
with
72 additions
and
30 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
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
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
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: jbadaire <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/10/02 17:59:52 by jbadaire #+# #+# */ | ||
/* Updated: 2023/10/12 20:15:13 by jbadaire ### ########.fr */ | ||
/* Updated: 2023/10/14 16:22:10 by jbadaire ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -16,8 +16,6 @@ | |
# include "libft/libft.h" | ||
# include "minilibx-linux/mlx.h" | ||
|
||
# include <stdlib.h> | ||
|
||
typedef struct s_location { | ||
int x; | ||
int y; | ||
|
@@ -72,7 +70,7 @@ typedef struct s_game | |
// ** UTILS ** // | ||
t_boolean loc_equals(t_location loc_1, t_location loc_2); | ||
t_boolean is_inside_world(int y, int x, t_world world); | ||
int handle_launch_error(char *argv[], t_world *world); | ||
t_boolean ft_endwith(char *src, char *pattern); | ||
|
||
// ** ERRORS **// | ||
int handle_file_error(char *argv[]); | ||
|
@@ -85,6 +83,8 @@ t_boolean has_good_shape(t_world world); | |
t_boolean is_closed(t_world world); | ||
t_boolean has_illegal_character(t_world world); | ||
t_location find_element(t_world world, char type); | ||
t_boolean handle_map_solve(char *path, t_game game); | ||
int map_size(int fd); | ||
int count_element(t_world world, char type); | ||
int valid_elements(t_world world); | ||
void is_solvable(char **map, int x, int y, int length_y); | ||
|
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: jbadaire <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2023/10/03 10:24:01 by jbadaire #+# #+# */ | ||
/* Updated: 2023/10/05 15:02:04 by jbadaire ### ########.fr */ | ||
/* Updated: 2023/10/14 16:21:39 by jbadaire ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -62,3 +62,26 @@ int count_element(t_world world, char type) | |
} | ||
return (count); | ||
} | ||
|
||
t_boolean ft_endwith(char *src, char *pattern) | ||
{ | ||
int pattern_size; | ||
int src_size; | ||
|
||
if (!pattern || !src) | ||
return (_false); | ||
pattern_size = (int) ft_strlen(pattern); | ||
src_size = (int) ft_strlen(src); | ||
if (pattern_size > src_size) | ||
return (_false); | ||
--pattern_size; | ||
--src_size; | ||
while (src_size > 0 && pattern_size > 0) | ||
{ | ||
if (src[src_size] != pattern[pattern_size]) | ||
return (_false); | ||
pattern_size--; | ||
src_size--; | ||
} | ||
return (_true); | ||
} |