Fix: no longer launch window in case of parse error, catch error on multiple player in map

This commit is contained in:
Baptiste Goulard coderc de lacam 2024-12-20 16:02:08 +01:00
parent b26a84b9bb
commit 4d2b8cb60b
7 changed files with 70 additions and 21 deletions

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/31 11:09:00 by rparodi #+# #+# */
/* Updated: 2024/12/20 14:43:52 by bgoulard ### ########.fr */
/* Updated: 2024/12/20 15:52:43 by bgoulard ### ########.fr */
/* */
/* ************************************************************************** */
@ -41,6 +41,7 @@ const char **get_error_message(void)
err_msg[ERROR_TEXTURE_MISSING] = "texture missing";
err_msg[ERROR_PARSE_NO_BG_COLOR] = "no background color provided";
err_msg[ERROR_PARSE_META_IN_MAP] = "meta data in map (should be above)";
err_msg[ERROR_PARSE_MULTIPLE_PLAYER] = "multiple player in map";
return (err_msg);
}

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/30 16:30:03 by rparodi #+# #+# */
/* Updated: 2024/12/17 17:17:12 by bgoulard ### ########.fr */
/* Updated: 2024/12/20 15:54:59 by bgoulard ### ########.fr */
/* */
/* ************************************************************************** */
@ -41,12 +41,12 @@ void run_cub3d(t_info *info)
if (!info->mlx_ptr)
return (sv_errno(info, ERROR_MLX), (void)0);
parse_map(info);
if (info->last_error != NO_ERROR)
return ;
if (init_mlx_env(info) != NO_ERROR)
return (c3_perror(info));
if (info->cli_ctx.debug)
ft_putstr_fd("no debug mod on production run", STDERR_FILENO);
if (info->last_error != NO_ERROR)
return ;
if (info->cli_ctx.no_graphics == true)
return ;
info->camera.screen_buff = mlx_new_image(info->mlx_ptr, info->screen_size.x,