cub3d/src/map/forbidden_characters.c
2025-10-01 14:13:20 +02:00

65 lines
1.8 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* forbidden_characters.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/17 14:18:13 by kcolin #+# #+# */
/* Updated: 2025/10/01 14:08:45 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */
#include "../../libft/includes/libft.h"
#ifdef BONUS
/*
* 10NSEW are from mandatory part
* M - Mystery box
* Q - Quick Revive perk
* J - Juggernog perk
* D - Double tap perk
* 2345678 - barricade and it's levels starting from 2 (every planks) to 8
* z - beware of zombies
* d - closed door
* i - open dooro
* P - payable door
*/
bool has_forbidden_characters(char *line)
{
static const char *allowedchars = " 10234567NSEWMQJDzdiP\n";
size_t strsize;
int i;
strsize = ft_strlen(line);
i = 0;
while (i < (int)strsize)
{
if (!ft_strchr(allowedchars, line[i]))
return (true);
i++;
}
return (false);
}
#else
bool has_forbidden_characters(char *line)
{
static const char *allowedchars = " 10NSEW\n";
size_t strsize;
int i;
strsize = ft_strlen(line);
i = 0;
while (i < (int)strsize)
{
if (!ft_strchr(allowedchars, line[i]))
return (true);
i++;
}
return (false);
}
#endif