From c63b18507d21b8a213c073bced9057b571cdcd7a Mon Sep 17 00:00:00 2001 From: Lightning_A Date: Mon, 9 Aug 2021 14:13:42 -0600 Subject: Use range iterators for `Map` --- modules/visual_script/visual_script_editor.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'modules/visual_script/visual_script_editor.cpp') diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 0a6bcedf31..8cb701ea20 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -3632,17 +3632,17 @@ void VisualScriptEditor::_notification(int p_what) { node_colors["constants"] = Color(0.94, 0.18, 0.49); } - for (Map::Element *E = node_colors.front(); E; E = E->next()) { + for (const KeyValue &E : node_colors) { const Ref sb = tm->get_stylebox(SNAME("frame"), SNAME("GraphNode")); if (!sb.is_null()) { Ref frame_style = sb->duplicate(); // Adjust the border color to be close to the GraphNode's background color. // This keeps the node's title area from being too distracting. - Color color = dark_theme ? E->get().darkened(0.75) : E->get().lightened(0.75); + Color color = dark_theme ? E.value.darkened(0.75) : E.value.lightened(0.75); color.a = 0.9; frame_style->set_border_color(color); - node_styles[E->key()] = frame_style; + node_styles[E.key] = frame_style; } } @@ -3813,15 +3813,15 @@ void VisualScriptEditor::_menu_option(int p_what) { } } - for (Map>::Element *E = clipboard->nodes.front(); E; E = E->next()) { - Ref node = E->get()->duplicate(); + for (KeyValue> &E : clipboard->nodes) { + Ref node = E.value->duplicate(); int new_id = idc++; to_select.insert(new_id); - remap[E->key()] = new_id; + remap[E.key] = new_id; - Vector2 paste_pos = clipboard->nodes_positions[E->key()]; + Vector2 paste_pos = clipboard->nodes_positions[E.key]; while (existing_positions.has(paste_pos.snapped(Vector2(2, 2)))) { paste_pos += Vector2(20, 20) * EDSCALE; @@ -3906,16 +3906,16 @@ void VisualScriptEditor::_menu_option(int p_what) { // the user wants to connect the nodes. int top_nd = -1; Vector2 top; - for (Map>::Element *E = nodes.front(); E; E = E->next()) { - Ref nd = script->get_node(E->key()); + for (const KeyValue> &E : nodes) { + Ref nd = script->get_node(E.key); if (nd.is_valid() && nd->has_input_sequence_port()) { if (top_nd < 0) { - top_nd = E->key(); + top_nd = E.key; top = script->get_node_position(top_nd); } - Vector2 pos = script->get_node_position(E->key()); + Vector2 pos = script->get_node_position(E.key); if (top.y > pos.y) { - top_nd = E->key(); + top_nd = E.key; top = pos; } } -- cgit v1.2.3