From 75ba837612babd37d40e65d4e545205c502b654d Mon Sep 17 00:00:00 2001 From: kobewi Date: Sat, 24 Feb 2024 23:18:44 +0100 Subject: [PATCH] Fix inefficient list iteration in Node --- scene/main/node.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scene/main/node.cpp b/scene/main/node.cpp index f827f68def0f..67f8a97212ea 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2963,12 +2963,12 @@ void Node::replace_by(Node *p_node, bool p_keep_groups) { } p_node->set_owner(owner); - for (int i = 0; i < owned.size(); i++) { - owned[i]->set_owner(p_node); + for (Node *E : owned) { + E->set_owner(p_node); } - for (int i = 0; i < owned_by_owner.size(); i++) { - owned_by_owner[i]->set_owner(owner); + for (Node *E : owned_by_owner) { + E->set_owner(owner); } p_node->set_scene_file_path(get_scene_file_path());