Fix:added check on ressources (aka textures)
This commit is contained in:
parent
85cd0d2989
commit
eda859f200
4 changed files with 32 additions and 22 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/11/28 13:53:54 by bgoulard #+# #+# */
|
||||
/* Updated: 2024/12/16 14:15:43 by bgoulard ### ########.fr */
|
||||
/* Updated: 2024/12/17 16:52:53 by bgoulard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -138,6 +138,7 @@ typedef enum e_error
|
|||
ERROR_CLI,
|
||||
ERROR_MLX,
|
||||
ERROR_TEXTURE_FORMAT,
|
||||
ERROR_TEXTURE_MISSING,
|
||||
ERROR_IMPLEM,
|
||||
} t_error;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/01 17:46:52 by bgoulard #+# #+# */
|
||||
/* Updated: 2024/12/16 14:25:52 by bgoulard ### ########.fr */
|
||||
/* Updated: 2024/12/17 16:58:30 by bgoulard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -68,5 +68,13 @@ void *load_textures(void *data)
|
|||
return (NULL);
|
||||
i++;
|
||||
}
|
||||
i = 0;
|
||||
errno = 0;
|
||||
while (i < sizeof(info->map.texture_) / sizeof(info->map.texture_[0]))
|
||||
{
|
||||
if (info->map.texture_[i].img == NULL || info->map.texture[i] == NULL)
|
||||
return (sv_errno(info, ERROR_TEXTURE_MISSING), NULL);
|
||||
i++;
|
||||
}
|
||||
return (info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/31 11:09:00 by rparodi #+# #+# */
|
||||
/* Updated: 2024/12/16 15:17:33 by bgoulard ### ########.fr */
|
||||
/* Updated: 2024/12/17 17:06:42 by bgoulard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -37,6 +37,7 @@ const char **get_error_message(void)
|
|||
[ERROR_MLX] = "mlx error",
|
||||
[ERROR_TEXTURE_FORMAT] = "texture format error",
|
||||
[ERROR_IMPLEM] = "not implemented",
|
||||
[ERROR_TEXTURE_MISSING] = "texture missing",
|
||||
};
|
||||
|
||||
return (error_messages);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/30 16:30:03 by rparodi #+# #+# */
|
||||
/* Updated: 2024/12/16 15:20:34 by bgoulard ### ########.fr */
|
||||
/* Updated: 2024/12/17 16:55:25 by bgoulard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ void run_cub3d(t_info *info)
|
|||
if (info->cli_ctx.debug)
|
||||
ft_putstr_fd("no debug mod on production run", STDERR_FILENO);
|
||||
if (info->last_error != NO_ERROR)
|
||||
return (c3_perror(info));
|
||||
return ;
|
||||
if (info->cli_ctx.no_graphics == true)
|
||||
return ;
|
||||
info->camera.screen_buff = mlx_new_image(info->mlx_ptr, info->screen_size.x,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue