Switch parsing order
authorLukas Jiriste <ljiriste@student.42prague.com>
Fri, 10 Jan 2025 14:38:10 +0000 (15:38 +0100)
committerLukas Jiriste <ljiriste@student.42prague.com>
Fri, 10 Jan 2025 14:43:24 +0000 (15:43 +0100)
This is done so cycling through lights and cameras starts with
the topmost element one (instead of the bottommost one).

src/parsing.c
test_scene.rt

index 38c2a888a167221fd86924cfb3a0226728c7307f..70645f304ab8852052db1af93d80547a64078c93 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/11/28 12:34:20 by ljiriste          #+#    #+#             */
-/*   Updated: 2025/01/08 14:53:13 by ljiriste         ###   ########.fr       */
+/*   Updated: 2025/01/10 15:36:56 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -325,10 +325,10 @@ int       parse_tree_to_scene(const t_parse_tree_node *tree, t_scene *scene)
 {
        if (tree->children.size == 2)
        {
-               if (add_element_to_scene(ft_cget_node_child(tree, 1), scene))
-                       return (1);
                if (parse_tree_to_scene(ft_cget_node_child(tree, 0), scene))
                        return (1);
+               if (add_element_to_scene(ft_cget_node_child(tree, 1), scene))
+                       return (1);
        }
        return (0);
 }
index 3ade7e9a9fbfe62c9559840127a4c74839996bf9..fccc072a4b1017992ff77d4ff4ecc3b90f251adb 100644 (file)
@@ -1,7 +1,7 @@
 L 3,0,0 0.4 255,0,0
 L 3,1,0 0.4 0,0,255
-C 2,0,0 1,0,-1 70
 C 0,0,0 1,0,0 90
+C 2,0,0 1,0,-1 70
 sp 3,0.5,-0.7 0.6 255,255,255
 L  3,0.5,-0.5 0.01 0,255,0
 L  3,0.5,-0.9 0.01 255,0,0