From 2bb8a6487707de6adaae6178f69a7900b6a35b17 Mon Sep 17 00:00:00 2001 From: docentYT <63965954+docentYT@users.noreply.github.com> Date: Tue, 12 May 2026 19:16:33 +0200 Subject: [PATCH] Specify auto as reference where possible --- network/network.cpp | 8 ++++---- rendering/openglrenderer.cpp | 4 ++-- scene/scene.cpp | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/network/network.cpp b/network/network.cpp index 342db5a3..ae83bf78 100644 --- a/network/network.cpp +++ b/network/network.cpp @@ -125,7 +125,7 @@ void network::server::handle_message(std::shared_ptr conn, const mes } if (msg.type == message::CLIENT_HELLO) { - auto cmd = dynamic_cast(msg); + const auto& cmd = dynamic_cast(msg); if (cmd.version != EU07_NETWORK_VERSION // wrong version || !Global.ready_to_load) { // not ready yet @@ -148,7 +148,7 @@ void network::server::handle_message(std::shared_ptr conn, const mes WriteLog("net: client accepted", logtype::net); } else if (msg.type == message::REQUEST_COMMAND) { - auto cmd = dynamic_cast(msg); + const auto& cmd = dynamic_cast(msg); for (auto const &kv : cmd.commands) client_commands_queue.emplace(kv); @@ -189,7 +189,7 @@ std::tuple network::client::get_nex float size = delta_queue.size() - consume_counter; - auto entry = delta_queue.front(); + const auto& entry = delta_queue.front(); float mult = entry.render_dt / std::chrono::duration_cast>(frame_time).count(); if (counter == 1 && size < MAX_BUFFER_SIZE * 2.0f) { @@ -241,7 +241,7 @@ void network::client::handle_message(std::shared_ptr conn, const mes } if (msg.type == message::SERVER_HELLO) { - auto cmd = dynamic_cast(msg); + const auto& cmd = dynamic_cast(msg); conn->state = connection::ACTIVE; if (!Global.ready_to_load) { diff --git a/rendering/openglrenderer.cpp b/rendering/openglrenderer.cpp index b8d041a9..d159c31a 100644 --- a/rendering/openglrenderer.cpp +++ b/rendering/openglrenderer.cpp @@ -4085,7 +4085,7 @@ opengl_renderer::Update_Pick_Control() { #endif m_pickcontrolitem = control; // return control; - for( auto callback : m_control_pick_requests ) { + for( auto& callback : m_control_pick_requests ) { callback( m_pickcontrolitem, glm::vec2() ); } m_control_pick_requests.clear(); @@ -4134,7 +4134,7 @@ opengl_renderer::Update_Pick_Node() { #endif m_picksceneryitem = node; // return node; - for( auto callback : m_node_pick_requests ) { + for( auto& callback : m_node_pick_requests ) { callback( m_picksceneryitem ); } m_node_pick_requests.clear(); diff --git a/scene/scene.cpp b/scene/scene.cpp index 1bc8674a..24d1d7c5 100644 --- a/scene/scene.cpp +++ b/scene/scene.cpp @@ -1021,7 +1021,7 @@ basic_region::on_click( TAnimModel const *Instance ) { if( Instance->name().empty() || ( Instance->name() == "none" ) ) { return; } - auto const location { Instance->location() }; + auto const& location { Instance->location() }; if( point_inside( location ) ) { section( location ).on_click( Instance ); @@ -1296,7 +1296,7 @@ basic_region::insert( shape_node Shape, scratch_data &Scratchpad, bool const Tra if( ( false == Scratchpad.location.offset.empty() ) && ( Scratchpad.location.offset.top() != glm::dvec3( 0, 0, 0 ) ) ) { // ...and move - auto const offset = Scratchpad.location.offset.top(); + auto const& offset = Scratchpad.location.offset.top(); for( auto &vertex : shape.m_data.vertices ) { vertex.position += offset; } @@ -1350,7 +1350,7 @@ basic_region::insert( lines_node Lines, scratch_data &Scratchpad ) { if( ( false == Scratchpad.location.offset.empty() ) && ( Scratchpad.location.offset.top() != glm::dvec3( 0, 0, 0 ) ) ) { // ...and move - auto const offset = Scratchpad.location.offset.top(); + auto const &offset = Scratchpad.location.offset.top(); for( auto &vertex : Lines.m_data.vertices ) { vertex.position += offset; } @@ -1726,7 +1726,7 @@ void basic_region::update_poi_geometry() { std::vector vertices; gfx::userdata_array userdata; - for (const auto sem : map::Objects.entries) + for (const auto &sem : map::Objects.entries) vertices.push_back(std::move(sem->vertex())); if (!m_map_poipoints) {