From ac3322b0af8f23e8e2dac8111200bc69b5604c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sat, 24 Jul 2021 15:46:25 +0200 Subject: Use const references where possible for List range iterators --- modules/gridmap/grid_map.cpp | 2 +- modules/gridmap/grid_map_editor_plugin.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'modules/gridmap') diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index ca461566d3..fea513c820 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -519,7 +519,7 @@ bool GridMap::_octant_update(const OctantKey &p_key) { RS::get_singleton()->multimesh_set_mesh(mm, mesh_library->get_item_mesh(E->key())->get_rid()); int idx = 0; - for (Pair &F : E->get()) { + for (const Pair &F : E->get()) { RS::get_singleton()->multimesh_instance_set_transform(mm, idx, F.first); #ifdef TOOLS_ENABLED diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index 9530122e04..989c2d295c 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -497,7 +497,7 @@ void GridMapEditor::_fill_selection() { } void GridMapEditor::_clear_clipboard_data() { - for (ClipboardItem &E : clipboard_items) { + for (const ClipboardItem &E : clipboard_items) { RenderingServer::get_singleton()->free(E.instance); } @@ -552,7 +552,7 @@ void GridMapEditor::_update_paste_indicator() { RenderingServer::get_singleton()->instance_set_transform(paste_instance, node->get_global_transform() * xf); - for (ClipboardItem &item : clipboard_items) { + for (const ClipboardItem &item : clipboard_items) { xf = Transform3D(); xf.origin = (paste_indicator.begin + (paste_indicator.current - paste_indicator.click) + center) * node->get_cell_size(); xf.basis = rot * xf.basis; @@ -576,7 +576,7 @@ void GridMapEditor::_do_paste() { Vector3 ofs = paste_indicator.current - paste_indicator.click; undo_redo->create_action(TTR("GridMap Paste Selection")); - for (ClipboardItem &item : clipboard_items) { + for (const ClipboardItem &item : clipboard_items) { Vector3 position = rot.xform(item.grid_offset) + paste_indicator.begin + ofs; Basis orm; @@ -659,7 +659,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Refget_button_index() == MOUSE_BUTTON_RIGHT && input_action == INPUT_ERASE) || (mb->get_button_index() == MOUSE_BUTTON_LEFT && input_action == INPUT_PAINT)) { if (set_items.size()) { undo_redo->create_action(TTR("GridMap Paint")); - for (SetItem &si : set_items) { + for (const SetItem &si : set_items) { undo_redo->add_do_method(node, "set_cell_item", si.position, si.new_value, si.new_orientation); } for (List::Element *E = set_items.back(); E; E = E->prev()) { -- cgit v1.2.3