cub3d/src/map/forbidden_characters.c

61 lines
1.6 KiB
C
Raw Normal View History

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* forbidden_characters.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/17 14:18:13 by kcolin #+# #+# */
2025-08-18 13:21:52 +02:00
/* Updated: 2025/08/18 13:46:15 by kcolin ### ########.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
*/
bool has_forbidden_characters(char *line)
{
2025-08-18 13:21:52 +02:00
static const char *allowedchars = " 10NSEWMQJDz\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