From 0dcba6ff7e68ed13f8e6caadd80b77506b917050 Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 11 Jan 2020 10:38:41 +0100 Subject: Hardcore refactoring --- parse/parse_resolution.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'parse/parse_resolution.c') 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 +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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); } -- cgit