Started bonus part

- added bonus rules in makefile
- added a BONUS define for bonus
- added a conditional check for characters
This commit is contained in:
Theo Champion 2025-07-02 15:35:05 +02:00
parent 34db19c1a2
commit 5c1d469cac
7 changed files with 93 additions and 27 deletions

View file

@ -0,0 +1,55 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* forbidden_characters.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/06/30 17:19:16 by tchampio #+# #+# */
/* Updated: 2025/07/02 15:33:37 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */
#include "../../includes/libft.h"
#include "../../includes/maputils.h"
#ifdef BONUS
bool has_forbidden_characters(char *line)
{
static const char *allowedchars = " 10NSEWDdZzsM\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