Connected parsing to rest of the game

This commit is contained in:
Philippe BLAGOJEVIC
2022-04-23 20:12:13 +02:00
parent fac1f78230
commit f53e66556b
19 changed files with 1010 additions and 23 deletions

View File

@@ -26,8 +26,18 @@ int main(int ac, char **av)
{
t_game *game;
game = init_game();
init_parsing(ac, av, game);
if ((ac != 2 || check_extension(av[1], ".cub")) && \
write(2, "Error\nPlease use a valid .cub file as single argument.\n", 53))
return (EXIT_FAILURE);
game = init_struct();
if (init_parsing(game, av[1]) && write(2, "The .cub file is invalid.\n", 26))
return (EXIT_FAILURE);
if (check_map(&(game->map)) && write(2, "The map is invalid.\n", 20))
return (EXIT_FAILURE);
// init game variables
init_game(game);
mb_init(destroy_mlx, game);
// draw game a first time before it start