fix leak isafile
This commit is contained in:
commit
8540ddc1ce
15
srcs/main.c
15
srcs/main.c
@ -6,7 +6,7 @@
|
||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/02/13 16:42:55 by apommier #+# #+# */
|
||||
/* Updated: 2022/06/15 14:37:34 by apommier ### ########.fr */
|
||||
/* Updated: 2022/06/15 15:19:08 by apommier ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -18,6 +18,17 @@ void set_map(t_data *img)
|
||||
img->map.texture.east = 0;
|
||||
img->map.texture.south = 0;
|
||||
img->map.texture.west = 0;
|
||||
img->player.x = 0;
|
||||
img->player.y = 0;
|
||||
img->player.angle = 0;
|
||||
img->player.vx = 0;
|
||||
img->player.vy = 0;
|
||||
img->player.front = 0;
|
||||
img->player.side = 0;
|
||||
img->player.angle_side = 0;
|
||||
img->player.shift = 0;
|
||||
img->to_be_free.one_tab = NULL;
|
||||
img->to_be_free.fd_one = -1;
|
||||
}
|
||||
|
||||
int key_pressed(int type, t_data *img)
|
||||
@ -92,6 +103,6 @@ int main(int argc, char **argv)
|
||||
mlx_hook(img.mlx_win, 3, 1L << 1, key_released, &img);
|
||||
mlx_loop_hook(img.mlx, loop, &img);
|
||||
mlx_hook(img.mlx_win, 17, 0L, &quit_game, &img);
|
||||
|
||||
|
||||
mlx_loop(img.mlx);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/05/10 17:54:25 by sadjigui #+# #+# */
|
||||
/* Updated: 2022/06/15 14:38:17 by apommier ### ########.fr */
|
||||
/* Updated: 2022/06/15 15:19:20 by apommier ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -18,16 +18,32 @@ void ft_exit(char *str)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void verifie_texture_color(t_data *img)
|
||||
{
|
||||
if (img->map.texture.north == NULL)
|
||||
ft_exit("Error\nTexture isn't loaded properly\n");
|
||||
if (img->map.texture.east == NULL)
|
||||
ft_exit("Error\nTexture isn't loaded properly\n");
|
||||
if (img->map.texture.south == NULL)
|
||||
ft_exit("Error\nTexture isn't loaded properly\n");
|
||||
if (img->map.texture.west == NULL)
|
||||
ft_exit("Error\nTexture isn't loaded properly\n");
|
||||
if (img->map.floor.set != 1)
|
||||
ft_exit("Error\nColor not set properly\n");
|
||||
if (img->map.sky.set != 1)
|
||||
ft_exit("Error\nColor not set properly\n");
|
||||
}
|
||||
|
||||
void error_msg(t_data *img)
|
||||
{
|
||||
if (img->map.error == 1)
|
||||
ft_putstr_fd("Error: Map isn't closed\n", 2);
|
||||
ft_exit("Error: Map isn't closed\n");
|
||||
if (img->map.error == 2)
|
||||
ft_putstr_fd("Error: Missing player\n", 2);
|
||||
ft_exit("Error: Missing player\n");
|
||||
if (img->map.error == 3)
|
||||
ft_putstr_fd("Error: Too many players\n", 2);
|
||||
ft_exit("Error: Too many players\n");
|
||||
if (img->map.error == -1)
|
||||
ft_putstr_fd("Error: Bad character in map\n", 2);
|
||||
ft_exit("Error: Bad character in map\n");
|
||||
}
|
||||
|
||||
void size_line(char *str, t_data *img)
|
||||
@ -334,6 +350,7 @@ int check_map(char **av, t_data *img)
|
||||
error_msg(img);
|
||||
exit(1);//surely leak
|
||||
}
|
||||
verifie_texture_color(img);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user