diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-02-29 00:29:17 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-02-29 00:29:17 +0100 |
commit | 4fccd597e3c5c97144e4324c1371db9f7f039967 (patch) | |
tree | 25cb40e9a022ca66fa038864b771e6b0fb15fc05 /src/ft_get_res.c | |
parent | All works but one thing is not ok (diff) | |
download | 42-cub3d-4fccd597e3c5c97144e4324c1371db9f7f039967.tar.gz 42-cub3d-4fccd597e3c5c97144e4324c1371db9f7f039967.tar.bz2 42-cub3d-4fccd597e3c5c97144e4324c1371db9f7f039967.tar.xz 42-cub3d-4fccd597e3c5c97144e4324c1371db9f7f039967.tar.zst 42-cub3d-4fccd597e3c5c97144e4324c1371db9f7f039967.zip |
Works fine, preparing small map
Diffstat (limited to 'src/ft_get_res.c')
-rw-r--r-- | src/ft_get_res.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/ft_get_res.c b/src/ft_get_res.c index 9bcf4ef..e7b38c9 100644 --- a/src/ft_get_res.c +++ b/src/ft_get_res.c @@ -24,7 +24,7 @@ static int8_t i++; if (i != ft_strlen(word)) { - ft_sprintf(clist->errmsg, "%s", FT_ERR_RES_ALPHA); + ft_sprintf(clist->errmsg, FT_ERR_RES_ALPHA); return (-1); } return (0); @@ -39,18 +39,28 @@ static void wl->y_size -= 1; } +static int8_t +ft_check_res_args(char **words, t_cub *clist) +{ + if (!(*words + 0) || !(*(words + 1)) || + !(*(words + 2)) || (*(words + 3))) + { + ft_sprintf(clist->errmsg, FT_ERR_ARGS); + return (-1); + } + return (0); +} + int8_t ft_get_res(char **words, t_cub *clist) { t_win *wlist; wlist = clist->wlist; - if (!(*words + 0) || !(*(words + 1)) || - !(*(words + 2)) || (*(words + 3))) - { - ft_sprintf(clist->errmsg, "%s", FT_ERR_ARGS); + if (clist->currlvl > 0) + return (0); + if (ft_check_res_args(words, clist) < 0) return (-1); - } if ((ft_checkdigit(words[1], clist) < 0) || (ft_checkdigit(words[2], clist) < 0)) return (-1); @@ -59,7 +69,7 @@ int8_t if (wlist->x_size <= 10 || wlist->y_size <= 10) { - ft_sprintf(clist->errmsg, "%s", FT_ERR_RES_SMALL); + ft_sprintf(clist->errmsg, FT_ERR_RES_SMALL); return (-1); } if (ft_get_screen_size(wlist) < 0) |