diff options
author | Aaron Record <aaronjrecord@gmail.com> | 2022-05-18 17:43:40 -0600 |
---|---|---|
committer | Aaron Record <aaronjrecord@gmail.com> | 2022-05-19 12:09:16 +0200 |
commit | 900c676b0282bed83d00834e3c280ac89c2bc94d (patch) | |
tree | b6bf869a55440a666f4bcc17d5e9cd93ff26dbdc /modules | |
parent | 71c40ff4da85a4770958533cdc65f2c9f7ddeaff (diff) |
Use range iterators for RBSet in most cases
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gdscript.cpp | 12 | ||||
-rw-r--r-- | modules/gdscript/language_server/gdscript_workspace.cpp | 4 | ||||
-rw-r--r-- | modules/gridmap/grid_map.cpp | 12 | ||||
-rw-r--r-- | modules/raycast/lightmap_raycaster.cpp | 8 | ||||
-rw-r--r-- | modules/raycast/raycast_occlusion_cull.cpp | 6 | ||||
-rw-r--r-- | modules/raycast/static_raycaster.cpp | 8 | ||||
-rw-r--r-- | modules/visual_script/editor/visual_script_editor.cpp | 52 | ||||
-rw-r--r-- | modules/visual_script/visual_script.cpp | 118 |
8 files changed, 110 insertions, 110 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index e400d0bf94..25f4823d92 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -764,8 +764,8 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc _update_exports_values(values, propnames); if (changed) { - for (RBSet<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) { - E->get()->update(propnames, values); + for (PlaceHolderScriptInstance *E : placeholders) { + E->update(propnames, values); } } else { p_instance_to_update->update(propnames, values); @@ -790,8 +790,8 @@ void GDScript::update_exports() { RBSet<ObjectID> copy = inheriters_cache; //might get modified - for (RBSet<ObjectID>::Element *E = copy.front(); E; E = E->next()) { - Object *id = ObjectDB::get_instance(E->get()); + for (const ObjectID &E : copy) { + Object *id = ObjectDB::get_instance(E); GDScript *s = Object::cast_to<GDScript>(id); if (!s) { continue; @@ -939,8 +939,8 @@ void GDScript::get_constants(HashMap<StringName, Variant> *p_constants) { void GDScript::get_members(RBSet<StringName> *p_members) { if (p_members) { - for (RBSet<StringName>::Element *E = members.front(); E; E = E->next()) { - p_members->insert(E->get()); + for (const StringName &E : members) { + p_members->insert(E); } } } diff --git a/modules/gdscript/language_server/gdscript_workspace.cpp b/modules/gdscript/language_server/gdscript_workspace.cpp index d9de112bb0..ffd3cfa907 100644 --- a/modules/gdscript/language_server/gdscript_workspace.cpp +++ b/modules/gdscript/language_server/gdscript_workspace.cpp @@ -794,7 +794,7 @@ GDScriptWorkspace::~GDScriptWorkspace() { cached_parsers.insert(E.key); } - for (RBSet<String>::Element *E = cached_parsers.front(); E; E = E->next()) { - remove_cache_parser(E->get()); + for (const String &E : cached_parsers) { + remove_cache_parser(E); } } diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 9da137f9d5..c70a8121e8 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -483,15 +483,15 @@ bool GridMap::_octant_update(const OctantKey &p_key) { HashMap<int, List<Pair<Transform3D, IndexKey>>> multimesh_items; - for (RBSet<IndexKey>::Element *E = g.cells.front(); E; E = E->next()) { - ERR_CONTINUE(!cell_map.has(E->get())); - const Cell &c = cell_map[E->get()]; + for (const IndexKey &E : g.cells) { + ERR_CONTINUE(!cell_map.has(E)); + const Cell &c = cell_map[E]; if (!mesh_library.is_valid() || !mesh_library->has_item(c.item)) { continue; } - Vector3 cellpos = Vector3(E->get().x, E->get().y, E->get().z); + Vector3 cellpos = Vector3(E.x, E.y, E.z); Vector3 ofs = _get_offset(); Transform3D xform; @@ -507,7 +507,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) { Pair<Transform3D, IndexKey> p; p.first = xform * mesh_library->get_item_mesh_transform(c.item); - p.second = E->get(); + p.second = E; multimesh_items[c.item].push_back(p); } } @@ -540,7 +540,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) { nm.region = region; } - g.navmesh_ids[E->get()] = nm; + g.navmesh_ids[E] = nm; } } diff --git a/modules/raycast/lightmap_raycaster.cpp b/modules/raycast/lightmap_raycaster.cpp index 7e7c3f9067..fc9ac416b7 100644 --- a/modules/raycast/lightmap_raycaster.cpp +++ b/modules/raycast/lightmap_raycaster.cpp @@ -153,16 +153,16 @@ void LightmapRaycasterEmbree::commit() { } void LightmapRaycasterEmbree::set_mesh_filter(const RBSet<int> &p_mesh_ids) { - for (RBSet<int>::Element *E = p_mesh_ids.front(); E; E = E->next()) { - rtcDisableGeometry(rtcGetGeometry(embree_scene, E->get())); + for (const int &E : p_mesh_ids) { + rtcDisableGeometry(rtcGetGeometry(embree_scene, E)); } rtcCommitScene(embree_scene); filter_meshes = p_mesh_ids; } void LightmapRaycasterEmbree::clear_mesh_filter() { - for (RBSet<int>::Element *E = filter_meshes.front(); E; E = E->next()) { - rtcEnableGeometry(rtcGetGeometry(embree_scene, E->get())); + for (const int &E : filter_meshes) { + rtcEnableGeometry(rtcGetGeometry(embree_scene, E)); } rtcCommitScene(embree_scene); filter_meshes.clear(); diff --git a/modules/raycast/raycast_occlusion_cull.cpp b/modules/raycast/raycast_occlusion_cull.cpp index c165354c7b..89e75f774e 100644 --- a/modules/raycast/raycast_occlusion_cull.cpp +++ b/modules/raycast/raycast_occlusion_cull.cpp @@ -223,9 +223,9 @@ void RaycastOcclusionCull::occluder_set_mesh(RID p_occluder, const PackedVector3 occluder->vertices = p_vertices; occluder->indices = p_indices; - for (RBSet<InstanceID>::Element *E = occluder->users.front(); E; E = E->next()) { - RID scenario_rid = E->get().scenario; - RID instance_rid = E->get().instance; + for (const InstanceID &E : occluder->users) { + RID scenario_rid = E.scenario; + RID instance_rid = E.instance; ERR_CONTINUE(!scenarios.has(scenario_rid)); Scenario &scenario = scenarios[scenario_rid]; ERR_CONTINUE(!scenario.instances.has(instance_rid)); diff --git a/modules/raycast/static_raycaster.cpp b/modules/raycast/static_raycaster.cpp index f2e944a82d..5d2dedf1a4 100644 --- a/modules/raycast/static_raycaster.cpp +++ b/modules/raycast/static_raycaster.cpp @@ -95,16 +95,16 @@ void StaticRaycasterEmbree::commit() { } void StaticRaycasterEmbree::set_mesh_filter(const RBSet<int> &p_mesh_ids) { - for (RBSet<int>::Element *E = p_mesh_ids.front(); E; E = E->next()) { - rtcDisableGeometry(rtcGetGeometry(embree_scene, E->get())); + for (const int &E : p_mesh_ids) { + rtcDisableGeometry(rtcGetGeometry(embree_scene, E)); } rtcCommitScene(embree_scene); filter_meshes = p_mesh_ids; } void StaticRaycasterEmbree::clear_mesh_filter() { - for (RBSet<int>::Element *E = filter_meshes.front(); E; E = E->next()) { - rtcEnableGeometry(rtcGetGeometry(embree_scene, E->get())); + for (const int &E : filter_meshes) { + rtcEnableGeometry(rtcGetGeometry(embree_scene, E)); } rtcCommitScene(embree_scene); filter_meshes.clear(); diff --git a/modules/visual_script/editor/visual_script_editor.cpp b/modules/visual_script/editor/visual_script_editor.cpp index 4847b24f61..012e0229f3 100644 --- a/modules/visual_script/editor/visual_script_editor.cpp +++ b/modules/visual_script/editor/visual_script_editor.cpp @@ -1625,8 +1625,8 @@ void VisualScriptEditor::_remove_output_port(int p_id, int p_port) { undo_redo->add_do_method(this, "_update_graph", p_id); for (const KeyValue<int, RBSet<int>> &E : conn_map) { - for (const RBSet<int>::Element *F = E.value.front(); F; F = F->next()) { - undo_redo->add_undo_method(script.ptr(), "data_connect", p_id, p_port, E.key, F->get()); + for (const int &F : E.value) { + undo_redo->add_undo_method(script.ptr(), "data_connect", p_id, p_port, E.key, F); } } @@ -1813,14 +1813,14 @@ void VisualScriptEditor::_on_nodes_paste() { undo_redo->add_undo_method(script.ptr(), "remove_node", new_id); } - for (RBSet<VisualScript::SequenceConnection>::Element *E = clipboard->sequence_connections.front(); E; E = E->next()) { - undo_redo->add_do_method(script.ptr(), "sequence_connect", remap[E->get().from_node], E->get().from_output, remap[E->get().to_node]); - undo_redo->add_undo_method(script.ptr(), "sequence_disconnect", remap[E->get().from_node], E->get().from_output, remap[E->get().to_node]); + for (const VisualScript::SequenceConnection &E : clipboard->sequence_connections) { + undo_redo->add_do_method(script.ptr(), "sequence_connect", remap[E.from_node], E.from_output, remap[E.to_node]); + undo_redo->add_undo_method(script.ptr(), "sequence_disconnect", remap[E.from_node], E.from_output, remap[E.to_node]); } - for (RBSet<VisualScript::DataConnection>::Element *E = clipboard->data_connections.front(); E; E = E->next()) { - undo_redo->add_do_method(script.ptr(), "data_connect", remap[E->get().from_node], E->get().from_port, remap[E->get().to_node], E->get().to_port); - undo_redo->add_undo_method(script.ptr(), "data_disconnect", remap[E->get().from_node], E->get().from_port, remap[E->get().to_node], E->get().to_port); + for (const VisualScript::DataConnection &E : clipboard->data_connections) { + undo_redo->add_do_method(script.ptr(), "data_connect", remap[E.from_node], E.from_port, remap[E.to_node], E.to_port); + undo_redo->add_undo_method(script.ptr(), "data_disconnect", remap[E.from_node], E.from_port, remap[E.to_node], E.to_port); } undo_redo->add_do_method(this, "_update_graph"); @@ -1910,17 +1910,17 @@ void VisualScriptEditor::_on_nodes_duplicate() { RBSet<int> to_select; HashMap<int, int> remap; - for (RBSet<int>::Element *F = to_duplicate.front(); F; F = F->next()) { + for (const int &F : to_duplicate) { // Duplicate from the specific function but place it into the default func as it would lack the connections. - Ref<VisualScriptNode> node = script->get_node(F->get()); + Ref<VisualScriptNode> node = script->get_node(F); Ref<VisualScriptNode> dupe = node->duplicate(true); int new_id = idc++; - remap.insert(F->get(), new_id); + remap.insert(F, new_id); to_select.insert(new_id); - undo_redo->add_do_method(script.ptr(), "add_node", new_id, dupe, script->get_node_position(F->get()) + Vector2(20, 20)); + undo_redo->add_do_method(script.ptr(), "add_node", new_id, dupe, script->get_node_position(F) + Vector2(20, 20)); undo_redo->add_undo_method(script.ptr(), "remove_node", new_id); } @@ -4201,9 +4201,9 @@ void VisualScriptEditor::_menu_option(int p_what) { // If we still don't have a start node then, // run through the nodes and select the first tree node, // i.e. node without any input sequence but output sequence. - for (RBSet<int>::Element *E = nodes_from.front(); E; E = E->next()) { - if (!nodes_to.has(E->get())) { - start_node = E->get(); + for (const int &E : nodes_from) { + if (!nodes_to.has(E)) { + start_node = E; } } } @@ -4272,13 +4272,13 @@ void VisualScriptEditor::_menu_option(int p_what) { // Move the nodes. // Handles reconnection of sequence connections on undo, start here in case of issues. - for (RBSet<VisualScript::SequenceConnection>::Element *E = seqext.front(); E; E = E->next()) { - undo_redo->add_do_method(script.ptr(), "sequence_disconnect", E->get().from_node, E->get().from_output, E->get().to_node); - undo_redo->add_undo_method(script.ptr(), "sequence_connect", E->get().from_node, E->get().from_output, E->get().to_node); + for (const VisualScript::SequenceConnection &E : seqext) { + undo_redo->add_do_method(script.ptr(), "sequence_disconnect", E.from_node, E.from_output, E.to_node); + undo_redo->add_undo_method(script.ptr(), "sequence_connect", E.from_node, E.from_output, E.to_node); } - for (RBSet<VisualScript::DataConnection>::Element *E = dataext.front(); E; E = E->next()) { - undo_redo->add_do_method(script.ptr(), "data_disconnect", E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port); - undo_redo->add_undo_method(script.ptr(), "data_connect", E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port); + for (const VisualScript::DataConnection &E : dataext) { + undo_redo->add_do_method(script.ptr(), "data_disconnect", E.from_node, E.from_port, E.to_node, E.to_port); + undo_redo->add_undo_method(script.ptr(), "data_connect", E.from_node, E.from_port, E.to_node, E.to_port); } // I don't really think we need support for non sequenced functions at this moment. @@ -4286,24 +4286,24 @@ void VisualScriptEditor::_menu_option(int p_what) { // Could fail with the new changes, start here when searching for bugs in create function shortcut. int m = 1; - for (RBSet<int>::Element *G = end_nodes.front(); G; G = G->next()) { + for (const int &G : end_nodes) { Ref<VisualScriptReturn> ret_node; ret_node.instantiate(); int ret_id = fn_id + (m++); selections.insert(ret_id); - Vector2 posi = _get_available_pos(false, script->get_node_position(G->get()) + Vector2(80, -100)); + Vector2 posi = _get_available_pos(false, script->get_node_position(G) + Vector2(80, -100)); undo_redo->add_do_method(script.ptr(), "add_node", ret_id, ret_node, posi); undo_redo->add_undo_method(script.ptr(), "remove_node", ret_id); - undo_redo->add_do_method(script.ptr(), "sequence_connect", G->get(), 0, ret_id); + undo_redo->add_do_method(script.ptr(), "sequence_connect", G, 0, ret_id); // Add data outputs from each of the end_nodes. - Ref<VisualScriptNode> vsn = script->get_node(G->get()); + Ref<VisualScriptNode> vsn = script->get_node(G); if (vsn.is_valid() && vsn->get_output_value_port_count() > 0) { ret_node->set_enable_return_value(true); // Use the zeroth data port cause that's the likely one that is planned to be used. ret_node->set_return_type(vsn->get_output_value_port_info(0).type); - undo_redo->add_do_method(script.ptr(), "data_connect", G->get(), 0, ret_id, 0); + undo_redo->add_do_method(script.ptr(), "data_connect", G, 0, ret_id, 0); } } diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index a287b8e69f..7c15651fa2 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -230,12 +230,12 @@ void VisualScript::_node_ports_changed(int p_id) { { List<SequenceConnection> to_remove; - for (RBSet<SequenceConnection>::Element *E = sequence_connections.front(); E; E = E->next()) { - if (E->get().from_node == p_id && E->get().from_output >= vsn->get_output_sequence_port_count()) { - to_remove.push_back(E->get()); + for (const SequenceConnection &E : sequence_connections) { + if (E.from_node == p_id && E.from_output >= vsn->get_output_sequence_port_count()) { + to_remove.push_back(E); } - if (E->get().to_node == p_id && !vsn->has_input_sequence_port()) { - to_remove.push_back(E->get()); + if (E.to_node == p_id && !vsn->has_input_sequence_port()) { + to_remove.push_back(E); } } @@ -248,12 +248,12 @@ void VisualScript::_node_ports_changed(int p_id) { { List<DataConnection> to_remove; - for (RBSet<DataConnection>::Element *E = data_connections.front(); E; E = E->next()) { - if (E->get().from_node == p_id && E->get().from_port >= vsn->get_output_value_port_count()) { - to_remove.push_back(E->get()); + for (const DataConnection &E : data_connections) { + if (E.from_node == p_id && E.from_port >= vsn->get_output_value_port_count()) { + to_remove.push_back(E); } - if (E->get().to_node == p_id && E->get().to_port >= vsn->get_input_value_port_count()) { - to_remove.push_back(E->get()); + if (E.to_node == p_id && E.to_port >= vsn->get_input_value_port_count()) { + to_remove.push_back(E); } } @@ -292,9 +292,9 @@ void VisualScript::remove_node(int p_id) { { List<SequenceConnection> to_remove; - for (RBSet<SequenceConnection>::Element *E = sequence_connections.front(); E; E = E->next()) { - if (E->get().from_node == p_id || E->get().to_node == p_id) { - to_remove.push_back(E->get()); + for (const SequenceConnection &E : sequence_connections) { + if (E.from_node == p_id || E.to_node == p_id) { + to_remove.push_back(E); } } @@ -307,9 +307,9 @@ void VisualScript::remove_node(int p_id) { { List<DataConnection> to_remove; - for (RBSet<DataConnection>::Element *E = data_connections.front(); E; E = E->next()) { - if (E->get().from_node == p_id || E->get().to_node == p_id) { - to_remove.push_back(E->get()); + for (const DataConnection &E : data_connections) { + if (E.from_node == p_id || E.to_node == p_id) { + to_remove.push_back(E); } } @@ -384,8 +384,8 @@ bool VisualScript::has_sequence_connection(int p_from_node, int p_from_output, i } void VisualScript::get_sequence_connection_list(List<SequenceConnection> *r_connection) const { - for (const RBSet<SequenceConnection>::Element *E = sequence_connections.front(); E; E = E->next()) { - r_connection->push_back(E->get()); + for (const SequenceConnection &E : sequence_connections) { + r_connection->push_back(E); } } @@ -426,8 +426,8 @@ bool VisualScript::has_data_connection(int p_from_node, int p_from_port, int p_t } bool VisualScript::is_input_value_port_connected(int p_node, int p_port) const { - for (const RBSet<DataConnection>::Element *E = data_connections.front(); E; E = E->next()) { - if (E->get().to_node == p_node && E->get().to_port == p_port) { + for (const DataConnection &E : data_connections) { + if (E.to_node == p_node && E.to_port == p_port) { return true; } } @@ -435,10 +435,10 @@ bool VisualScript::is_input_value_port_connected(int p_node, int p_port) const { } bool VisualScript::get_input_value_port_connection_source(int p_node, int p_port, int *r_node, int *r_port) const { - for (const RBSet<DataConnection>::Element *E = data_connections.front(); E; E = E->next()) { - if (E->get().to_node == p_node && E->get().to_port == p_port) { - *r_node = E->get().from_node; - *r_port = E->get().from_port; + for (const DataConnection &E : data_connections) { + if (E.to_node == p_node && E.to_port == p_port) { + *r_node = E.from_node; + *r_port = E.from_port; return true; } } @@ -446,8 +446,8 @@ bool VisualScript::get_input_value_port_connection_source(int p_node, int p_port } void VisualScript::get_data_connection_list(List<DataConnection> *r_connection) const { - for (const RBSet<DataConnection>::Element *E = data_connections.front(); E; E = E->next()) { - r_connection->push_back(E->get()); + for (const DataConnection &E : data_connections) { + r_connection->push_back(E); } } @@ -764,8 +764,8 @@ void VisualScript::_update_placeholders() { values[p.name] = variables[E.key].default_value; } - for (RBSet<PlaceHolderScriptInstance *>::Element *E = placeholders.front(); E; E = E->next()) { - E->get()->update(pinfo, values); + for (PlaceHolderScriptInstance *E : placeholders) { + E->update(pinfo, values); } } @@ -1078,19 +1078,19 @@ Dictionary VisualScript::_get_data() const { d["nodes"] = nds; Array seqconns; - for (const RBSet<SequenceConnection>::Element *F = sequence_connections.front(); F; F = F->next()) { - seqconns.push_back(F->get().from_node); - seqconns.push_back(F->get().from_output); - seqconns.push_back(F->get().to_node); + for (const SequenceConnection &F : sequence_connections) { + seqconns.push_back(F.from_node); + seqconns.push_back(F.from_output); + seqconns.push_back(F.to_node); } d["sequence_connections"] = seqconns; Array dataconns; - for (const RBSet<DataConnection>::Element *F = data_connections.front(); F; F = F->next()) { - dataconns.push_back(F->get().from_node); - dataconns.push_back(F->get().from_port); - dataconns.push_back(F->get().to_node); - dataconns.push_back(F->get().to_port); + for (const DataConnection &F : data_connections) { + dataconns.push_back(F.from_node); + dataconns.push_back(F.from_port); + dataconns.push_back(F.to_node); + dataconns.push_back(F.to_port); } d["data_connections"] = dataconns; @@ -1869,23 +1869,23 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o List<int> nd_queue; nd_queue.push_back(function.node); while (!nd_queue.is_empty()) { - for (const RBSet<VisualScript::SequenceConnection>::Element *F = script->sequence_connections.front(); F; F = F->next()) { - if (nd_queue.front()->get() == F->get().from_node && !node_ids.has(F->get().to_node)) { - nd_queue.push_back(F->get().to_node); - node_ids.insert(F->get().to_node); + for (const VisualScript::SequenceConnection &F : script->sequence_connections) { + if (nd_queue.front()->get() == F.from_node && !node_ids.has(F.to_node)) { + nd_queue.push_back(F.to_node); + node_ids.insert(F.to_node); } - if (nd_queue.front()->get() == F->get().from_node && !seqconns.has(F->get())) { - seqconns.insert(F->get()); + if (nd_queue.front()->get() == F.from_node && !seqconns.has(F)) { + seqconns.insert(F); } } nd_queue.pop_front(); } HashMap<int, HashMap<int, Pair<int, int>>> dc_lut; // :: to -> to_port -> (from, from_port) - for (const RBSet<VisualScript::DataConnection>::Element *F = script->data_connections.front(); F; F = F->next()) { - dc_lut[F->get().to_node][F->get().to_port] = Pair<int, int>(F->get().from_node, F->get().from_port); + for (const VisualScript::DataConnection &F : script->data_connections) { + dc_lut[F.to_node][F.to_port] = Pair<int, int>(F.from_node, F.from_port); } - for (const RBSet<int>::Element *F = node_ids.front(); F; F = F->next()) { - nd_queue.push_back(F->get()); + for (const int &F : node_ids) { + nd_queue.push_back(F); } List<int> dc_keys; while (!nd_queue.is_empty()) { @@ -1907,15 +1907,15 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o //Multiple passes are required to set up this complex thing.. //First create the nodes. - for (const RBSet<int>::Element *F = node_ids.front(); F; F = F->next()) { - Ref<VisualScriptNode> node = script->nodes[F->get()].node; + for (const int &F : node_ids) { + Ref<VisualScriptNode> node = script->nodes[F].node; VisualScriptNodeInstance *instance = node->instantiate(this); // Create instance. ERR_FAIL_COND(!instance); instance->base = node.ptr(); - instance->id = F->get(); + instance->id = F; instance->input_port_count = node->get_input_value_port_count(); instance->input_ports = nullptr; instance->output_port_count = node->get_output_value_port_count(); @@ -1975,14 +1975,14 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o max_input_args = MAX(max_input_args, instance->input_port_count); max_output_args = MAX(max_output_args, instance->output_port_count); - instances[F->get()] = instance; + instances[F] = instance; } function.trash_pos = function.max_stack++; // create pos for trash // Second pass, do data connections. - for (const RBSet<VisualScript::DataConnection>::Element *F = dataconns.front(); F; F = F->next()) { - VisualScript::DataConnection dc = F->get(); + for (const VisualScript::DataConnection &F : dataconns) { + VisualScript::DataConnection dc = F; ERR_CONTINUE(!instances.has(dc.from_node)); VisualScriptNodeInstance *from = instances[dc.from_node]; ERR_CONTINUE(!instances.has(dc.to_node)); @@ -2008,8 +2008,8 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o } // Third pass, do sequence connections. - for (const RBSet<VisualScript::SequenceConnection>::Element *F = seqconns.front(); F; F = F->next()) { - VisualScript::SequenceConnection sc = F->get(); + for (const VisualScript::SequenceConnection &F : seqconns) { + VisualScript::SequenceConnection sc = F; ERR_CONTINUE(!instances.has(sc.from_node)); VisualScriptNodeInstance *from = instances[sc.from_node]; ERR_CONTINUE(!instances.has(sc.to_node)); @@ -2022,11 +2022,11 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o //fourth pass: // 1) unassigned input ports to default values // 2) connect unassigned output ports to trash - for (const RBSet<int>::Element *F = node_ids.front(); F; F = F->next()) { - ERR_CONTINUE(!instances.has(F->get())); + for (const int &F : node_ids) { + ERR_CONTINUE(!instances.has(F)); - Ref<VisualScriptNode> node = script->nodes[F->get()].node; - VisualScriptNodeInstance *instance = instances[F->get()]; + Ref<VisualScriptNode> node = script->nodes[F].node; + VisualScriptNodeInstance *instance = instances[F]; // Connect to default values. for (int i = 0; i < instance->input_port_count; i++) { |