From 7dc1b6b32f045649492f633f3edf1afa9d9fe0d3 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Sat, 22 Feb 2020 23:19:52 +0100 Subject: Secured weird screen size % 10 bug --- Makefile | 1 + map/map_one.cub | 2 +- src/ft_get_res.c | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f667190..c5c20e2 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ MLX_DIR = minilibx/ #---------------------------------------------- Files ---------------------------------------------# #==================================================================================================# INCS = cub3d.h +INCS += cub3d_defines.h INCS += cub3d_structs.h #--------------------------------------------------------------------------------------------------# SRCS_NAME = main.c diff --git a/map/map_one.cub b/map/map_one.cub index 9269e32..a079238 100644 --- a/map/map_one.cub +++ b/map/map_one.cub @@ -1,4 +1,4 @@ -R 1400 900 +R 1400 10000 NO ./media/img/BRIQUASSES.xpm SO ./media/img/BRIQUASSE_3.xpm diff --git a/src/ft_get_res.c b/src/ft_get_res.c index dece00f..26853be 100644 --- a/src/ft_get_res.c +++ b/src/ft_get_res.c @@ -31,6 +31,15 @@ static int8_t return (0); } +static void + ft_securize_scr(t_win *wl) +{ + while (wl->x_size % 10) + wl->x_size -= 1; + while (wl->y_size % 10) + wl->y_size -= 1; +} + int8_t ft_get_res(char **words, t_cub *clist) { @@ -57,5 +66,6 @@ int8_t } if (ft_get_screen_size(wlist) < 0) return (-1); + ft_securize_scr(wlist); return (0); } -- cgit v1.2.3