61 lines
1.8 KiB
C
61 lines
1.8 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* :::::::: */
|
|
/* map_entries_present.c :+: :+: */
|
|
/* +:+ */
|
|
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
|
/* +#+ */
|
|
/* Created: 2025/05/29 12:38:19 by whaffman #+# #+# */
|
|
/* Updated: 2025/06/03 13:25:11 by whaffman ######## odam.nl */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "cub3d.h"
|
|
|
|
int wall_texture_present(t_map *map)
|
|
{
|
|
if (!map->textures[0] || !map->textures[1]
|
|
|| !map->textures[2] || !map->textures[3])
|
|
{
|
|
ft_putstr_fd("Error: Missing wall textures\n", 2);
|
|
return (FAILURE);
|
|
}
|
|
return (SUCCESS);
|
|
}
|
|
|
|
int floor_ceiling_color_present(t_map *map)
|
|
{
|
|
if (map->floor_color == 0 || map->ceiling_color == 0)
|
|
{
|
|
ft_putstr_fd("Error: Missing floor or ceiling color\n", 2);
|
|
return (FAILURE);
|
|
}
|
|
return (SUCCESS);
|
|
}
|
|
|
|
int player_present(t_game *game)
|
|
{
|
|
if (game->player->pos.x == -1 || game->player->pos.y == -1)
|
|
{
|
|
ft_putstr_fd("Error: Missing player position\n", 2);
|
|
return (FAILURE);
|
|
}
|
|
return (SUCCESS);
|
|
}
|
|
|
|
int map_entries_present(t_game *game)
|
|
{
|
|
t_map *map;
|
|
|
|
if (!game || !game->map)
|
|
return (FAILURE);
|
|
map = game->map;
|
|
if (!wall_texture_present(map))
|
|
return (FAILURE);
|
|
if (!floor_ceiling_color_present(map))
|
|
return (FAILURE);
|
|
if (!player_present(game))
|
|
return (FAILURE);
|
|
return (SUCCESS);
|
|
}
|