mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
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:
parent
34db19c1a2
commit
5c1d469cac
7 changed files with 93 additions and 27 deletions
55
src/map/forbidden_characters.c
Normal file
55
src/map/forbidden_characters.c
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue