testing with bonus rules

This commit is contained in:
Theo Champion 2025-06-30 16:16:45 +02:00
parent de740ad418
commit 34db19c1a2
2 changed files with 13 additions and 4 deletions

View file

@ -1,6 +1,5 @@
CC=cc CC=cc
SANITIZERS= SANITIZERS=-fsanitize=address -fno-omit-frame-pointer
#-fsanitize=address -fno-omit-frame-pointer
CFLAGS=-Wall -Wextra -Werror -ggdb $(SANITIZERS) -I mlx CFLAGS=-Wall -Wextra -Werror -ggdb $(SANITIZERS) -I mlx
SOURCEFILES=src/main.c \ SOURCEFILES=src/main.c \
src/map/map_checker.c \ src/map/map_checker.c \
@ -28,6 +27,13 @@ clean:
fclean: clean fclean: clean
rm -f $(NAME) rm -f $(NAME)
bonus: CFLAGS += -D BONUS=1
bonus: fclean $(OBJECTS)
$(MAKE) -C mlx/
$(MAKE) -C libft/
cp libft/libft.a .
$(CC) $(CFLAGS) $(OBJECTS) -D BONUS=1 -o $(NAME) -L. -lft -Lmlx -lmlx -lz -lXext -lX11
re: fclean all re: fclean all
.PHONY: all clean fclean re .PHONY: all clean fclean re

View file

@ -6,7 +6,7 @@
/* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */ /* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/06 13:16:11 by tchampio #+# #+# */ /* Created: 2025/05/06 13:16:11 by tchampio #+# #+# */
/* Updated: 2025/06/25 18:07:40 by tchampio ### ########.fr */ /* Updated: 2025/06/30 16:12:19 by tchampio ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -92,9 +92,9 @@ int main(int argc, char **argv)
{ {
t_cub3d_data data; t_cub3d_data data;
data.map = ft_calloc(sizeof(t_mapdata), 1);
if (argc < 2) if (argc < 2)
return (ft_printf("Error: Missing cub3d file\n"), 1); return (ft_printf("Error: Missing cub3d file\n"), 1);
data.map = ft_calloc(sizeof(t_mapdata), 1);
if (!check_cubfile(argv[1], data.map)) if (!check_cubfile(argv[1], data.map))
return (ft_printf("Error: Wrong map file. Reason: %s\n", data.map->error), 1); return (ft_printf("Error: Wrong map file. Reason: %s\n", data.map->error), 1);
data.mlx = mlx_init(); data.mlx = mlx_init();
@ -106,5 +106,8 @@ int main(int argc, char **argv)
draw_map(data.map, data.mlx_data); draw_map(data.map, data.mlx_data);
mlx_key_hook(data.mlx_win, key_destroy, &data); mlx_key_hook(data.mlx_win, key_destroy, &data);
mlx_put_image_to_window(data.mlx, data.mlx_win, data.mlx_data->img, 0, 0); mlx_put_image_to_window(data.mlx, data.mlx_win, data.mlx_data->img, 0, 0);
#ifdef BONUS
mlx_string_put(data.mlx, data.mlx_win, 100, 100, 0x00FFFFFF, "compiled with bonuses");
#endif
mlx_loop(data.mlx); mlx_loop(data.mlx);
} }