summaryrefslogtreecommitdiff
path: root/editor/groups_editor.cpp
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2021-07-15 23:45:57 -0400
committerAaron Franke <arnfranke@yahoo.com>2021-07-23 17:38:28 -0400
commit4e6efd1b07f1c6d53d226977ddc729333b74306a (patch)
treea52f672e7f622bb65e3b65f2a2edc9d19b1ecdcf /editor/groups_editor.cpp
parentb918c4c3ce84af1f8af2d06ef31784f48a15551a (diff)
Use C++ iterators for Lists in many situations
Diffstat (limited to 'editor/groups_editor.cpp')
-rw-r--r--editor/groups_editor.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp
index 0a39768b9a..deedbe104c 100644
--- a/editor/groups_editor.cpp
+++ b/editor/groups_editor.cpp
@@ -240,8 +240,7 @@ void GroupDialog::_group_renamed() {
List<Node *> nodes;
scene_tree->get_nodes_in_group(selected_group, &nodes);
bool removed_all = true;
- for (List<Node *>::Element *E = nodes.front(); E; E = E->next()) {
- Node *node = E->get();
+ for (Node *node : nodes) {
if (_can_edit(node, selected_group)) {
undo_redo->add_do_method(node, "remove_from_group", selected_group);
undo_redo->add_undo_method(node, "remove_from_group", name);
@@ -286,11 +285,11 @@ void GroupDialog::_load_groups(Node *p_current) {
List<Node::GroupInfo> gi;
p_current->get_groups(&gi);
- for (List<Node::GroupInfo>::Element *E = gi.front(); E; E = E->next()) {
- if (!E->get().persistent) {
+ for (Node::GroupInfo &E : gi) {
+ if (!E.persistent) {
continue;
}
- _add_group(E->get().name);
+ _add_group(E.name);
}
for (int i = 0; i < p_current->get_child_count(); i++) {
@@ -311,10 +310,10 @@ void GroupDialog::_delete_group_pressed(Object *p_item, int p_column, int p_id)
List<Node *> nodes;
scene_tree->get_nodes_in_group(name, &nodes);
bool removed_all = true;
- for (List<Node *>::Element *E = nodes.front(); E; E = E->next()) {
- if (_can_edit(E->get(), name)) {
- undo_redo->add_do_method(E->get(), "remove_from_group", name);
- undo_redo->add_undo_method(E->get(), "add_to_group", name, true);
+ for (Node *E : nodes) {
+ if (_can_edit(E, name)) {
+ undo_redo->add_do_method(E, "remove_from_group", name);
+ undo_redo->add_undo_method(E, "add_to_group", name, true);
} else {
removed_all = false;
}
@@ -628,8 +627,7 @@ void GroupsEditor::update_tree() {
TreeItem *root = tree->create_item();
- for (List<GroupInfo>::Element *E = groups.front(); E; E = E->next()) {
- Node::GroupInfo gi = E->get();
+ for (GroupInfo &gi : groups) {
if (!gi.persistent) {
continue;
}