summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-02-25 11:50:16 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-02-25 11:50:16 +0100
commit81f3d43cc1ba01136795fb2059bbaa55bc514a16 (patch)
tree37f4b68edbb0725266569d2d6cf9488a1eb52429
parentec901ae16eecc921393d477aa61ca8ec49a8801d (diff)
parent75ba837612babd37d40e65d4e545205c502b654d (diff)
downloadredot-engine-81f3d43cc1ba01136795fb2059bbaa55bc514a16.tar.gz
Merge pull request #88785 from KoBeWi/list_cringe
Fix inefficient list iteration in Node
-rw-r--r--scene/main/node.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index f827f68def..67f8a97212 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());