aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_res.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_get_res.c')
-rw-r--r--src/ft_get_res.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/ft_get_res.c b/src/ft_get_res.c
index 8607f62..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)
{
@@ -48,8 +57,8 @@ int8_t
return (-1);
wlist->x_size = ft_atoi(words[1]);
wlist->y_size = ft_atoi(words[2]);
- if (wlist->x_size <= 1
- || wlist->y_size <= 1)
+ if (wlist->x_size <= 10
+ || wlist->y_size <= 10)
{
ft_strlcpy(clist->errmsg, FT_ERR_RES_SMALL,
ft_strlen(FT_ERR_RES_SMALL) + 1);
@@ -57,5 +66,6 @@ int8_t
}
if (ft_get_screen_size(wlist) < 0)
return (-1);
+ ft_securize_scr(wlist);
return (0);
}