Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

minor fix: missing validation #41

Merged
merged 1 commit into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified cub3D
Binary file not shown.
4 changes: 2 additions & 2 deletions maps/valid/test.cub
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ EA assets/texture/east.xpm
111111111111
100E00E000001111
1000000000000001
1000100000001111
10001000000E1111
100000001111
10000001
100W0001
100W00E1
11111111
6 changes: 3 additions & 3 deletions srcs/checker/flood_fill.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ bool flood_fill(char **grid, int height, int width, t_vector_i start)
{
if (!recursive_flood_fill(grid, start, height, width))
{
printf("Error: Map is not fully enclosed.\n");
printf("Error\nMap is not fully enclosed.\n");
return (false);
}
return (true);
Expand All @@ -99,13 +99,13 @@ bool is_map_valid(t_game *game)
map_copy = copy_map(game->map.grid, game->map.height);
if (!map_copy)
{
printf("Error:\n Failed to create map copy.\n");
printf("Error\nFailed to create map copy.\n");
return (cleanup_game(game), exit(1), false);
}
if (!find_start_position(map_copy,
game->map.height, game->map.width, &start))
{
printf("Error:\n Player starting position not found.\n");
printf("Error\nPlayer starting position not found.\n");
free_map_copy(map_copy, game->map.height);
return (cleanup_game(game), exit(1), false);
}
Expand Down
5 changes: 3 additions & 2 deletions srcs/error/cleanup.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ void cleanup_gun(t_game *game)
i = 0;
while (i < 4)
{
if (game->p1.gun_anim[i].img)
if (game->p1.gun_anim && game->p1.gun_anim[i].img)
{
mlx_destroy_image(game->mlx, game->p1.gun_anim[i].img);
}
i++;
}
free(game->p1.gun_anim);
if (game->p1.gun_anim)
free(game->p1.gun_anim);
game->p1.gun_anim = NULL;
}

Expand Down
Loading