2025-07-02 15:35:05 +02:00
|
|
|
/* ************************************************************************** */
|
|
|
|
|
/* */
|
|
|
|
|
/* ::: :::::::: */
|
|
|
|
|
/* forbidden_characters.c :+: :+: :+: */
|
|
|
|
|
/* +:+ +:+ +:+ */
|
2025-07-17 14:11:30 +02:00
|
|
|
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
2025-07-02 15:35:05 +02:00
|
|
|
/* +#+#+#+#+#+ +#+ */
|
2025-07-17 14:11:30 +02:00
|
|
|
/* Created: 2025/07/17 14:18:13 by kcolin #+# #+# */
|
2025-10-01 14:13:08 +02:00
|
|
|
/* Updated: 2025/10/01 14:08:45 by tchampio ### ########.fr */
|
2025-07-02 15:35:05 +02:00
|
|
|
/* */
|
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
2025-07-17 14:11:30 +02:00
|
|
|
#include "../../libft/includes/libft.h"
|
2025-07-17 14:33:55 +02:00
|
|
|
|
2025-07-02 15:35:05 +02:00
|
|
|
#ifdef BONUS
|
|
|
|
|
|
2025-08-11 13:07:52 +02:00
|
|
|
/*
|
|
|
|
|
* 10NSEW are from mandatory part
|
|
|
|
|
* M - Mystery box
|
|
|
|
|
* Q - Quick Revive perk
|
|
|
|
|
* J - Juggernog perk
|
|
|
|
|
* D - Double tap perk
|
2025-09-09 10:17:28 +02:00
|
|
|
* 2345678 - barricade and it's levels starting from 2 (every planks) to 8
|
2025-09-30 17:50:49 +02:00
|
|
|
* z - beware of zombies
|
|
|
|
|
* d - closed door
|
|
|
|
|
* i - open dooro
|
2025-10-01 14:13:08 +02:00
|
|
|
* P - payable door
|
2025-08-11 13:07:52 +02:00
|
|
|
*/
|
2025-07-02 15:35:05 +02:00
|
|
|
bool has_forbidden_characters(char *line)
|
|
|
|
|
{
|
2025-10-01 14:13:08 +02:00
|
|
|
static const char *allowedchars = " 10234567NSEWMQJDzdiP\n";
|
2025-07-02 15:35:05 +02:00
|
|
|
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
|