Fix argument parsing so as not to ignore input
authorLukas Jiriste <ljiriste@student.42prague.com>
Thu, 25 Apr 2024 07:38:57 +0000 (09:38 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Thu, 25 Apr 2024 07:38:57 +0000 (09:38 +0200)
The -f option did not work, because the fractal was set to mandelbrot
after the option parsing. Other options could have also been affected.

main.c

diff --git a/main.c b/main.c
index 0b9c8c883ca89faaf40b01a8cf4da031a439d2f3..6b236f6ba8d1ebb457b6f7a4952586d2dfe9b51c 100644 (file)
--- a/main.c
+++ b/main.c
@@ -6,7 +6,7 @@
 /*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/10/27 14:29:26 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/04/18 11:49:18 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/04/25 09:36:26 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -205,12 +205,6 @@ void       init_session(t_session *s)
 
 static void    init_view(t_session *s)
 {
-       s->view.fractal = mandelbrot;
-       s->view.palette = tri_color;
-       s->view.pixel_size.x = 0.01;
-       s->view.pixel_size.y = 0.01;
-       s->view.color_shift = 0.7;
-       s->view.color_shift_speed = 0.01;
        s->view.window_coord.x = -s->img.width / 2 * s->view.pixel_size.x;
        s->view.window_coord.y = s->img.height / 2 * s->view.pixel_size.y;
        return ;
@@ -218,6 +212,12 @@ static void        init_view(t_session *s)
 
 void   set_default(t_session *s)
 {
+       s->view.fractal = mandelbrot;
+       s->view.palette = tri_color;
+       s->view.pixel_size.x = 0.01;
+       s->view.pixel_size.y = 0.01;
+       s->view.color_shift = 0.7;
+       s->view.color_shift_speed = 0.01;
        s->set.man.detail = 1000;
        s->set.man.color_stability = 100;
        s->img.width = 1000;