diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-01-11 10:38:41 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-01-11 10:39:37 +0100 |
| commit | 0dcba6ff7e68ed13f8e6caadd80b77506b917050 (patch) | |
| tree | 16e1393115941b87ca50f04f1e37511f3f7bbdb5 /parse/parse_resolution.c | |
| parent | 988e058680280e25d345b17d840c3c6d40e30a76 (diff) | |
| download | cub3d-0dcba6ff7e68ed13f8e6caadd80b77506b917050.tar.gz cub3d-0dcba6ff7e68ed13f8e6caadd80b77506b917050.tar.bz2 cub3d-0dcba6ff7e68ed13f8e6caadd80b77506b917050.zip | |
Hardcore refactoring
Diffstat (limited to 'parse/parse_resolution.c')
| -rw-r--r-- | parse/parse_resolution.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/parse/parse_resolution.c b/parse/parse_resolution.c index e63317e..d6c5759 100644 --- a/parse/parse_resolution.c +++ b/parse/parse_resolution.c @@ -6,16 +6,19 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/15 09:29:27 by cacharle #+# #+# */ -/* Updated: 2019/11/15 09:31:47 by cacharle ### ########.fr */ +/* Updated: 2020/01/11 09:44:18 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include "cub3d.h" -t_bool parse_resolution(t_parsing *parsing, char *line) +t_bool parse_resolution(t_state *state, char *line) { - parsing->resolution_width = ft_atoi(line); - line = ft_strrchr(line, ' ') + 1; - parsing->resolution_height = ft_atoi(line); + if ((state->window.width = ft_atoi(line)) < 0) + return (FALSE); + if ((line = ft_strrchr(line, ' ') + 1) == NULL) + return (FALSE); + if ((state->window.height = ft_atoi(line)) < 0) + return (FALSE); return (TRUE); } |
