aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-02-22 23:19:52 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-02-22 23:19:52 +0100
commit7dc1b6b32f045649492f633f3edf1afa9d9fe0d3 (patch)
tree1effc3afde21c3015de2b6dc309e6ee0200b5a13
parentPerfect (diff)
download42-cub3d-7dc1b6b32f045649492f633f3edf1afa9d9fe0d3.tar.gz
42-cub3d-7dc1b6b32f045649492f633f3edf1afa9d9fe0d3.tar.bz2
42-cub3d-7dc1b6b32f045649492f633f3edf1afa9d9fe0d3.tar.xz
42-cub3d-7dc1b6b32f045649492f633f3edf1afa9d9fe0d3.tar.zst
42-cub3d-7dc1b6b32f045649492f633f3edf1afa9d9fe0d3.zip
Secured weird screen size % 10 bug
-rw-r--r--Makefile1
-rw-r--r--map/map_one.cub2
-rw-r--r--src/ft_get_res.c10
3 files changed, 12 insertions, 1 deletions
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);
}