16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-17 22:39:17 +02:00

Specify auto as reference where possible

This commit is contained in:
docentYT
2026-05-12 19:16:33 +02:00
parent 4fa148e230
commit 2bb8a64877
3 changed files with 10 additions and 10 deletions

View File

@@ -125,7 +125,7 @@ void network::server::handle_message(std::shared_ptr<connection> conn, const mes
}
if (msg.type == message::CLIENT_HELLO) {
auto cmd = dynamic_cast<const client_hello&>(msg);
const auto& cmd = dynamic_cast<const client_hello&>(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<connection> conn, const mes
WriteLog("net: client accepted", logtype::net);
}
else if (msg.type == message::REQUEST_COMMAND) {
auto cmd = dynamic_cast<const request_command&>(msg);
const auto& cmd = dynamic_cast<const request_command&>(msg);
for (auto const &kv : cmd.commands)
client_commands_queue.emplace(kv);
@@ -189,7 +189,7 @@ std::tuple<double, double, command_queue::commands_map> 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<std::chrono::duration<float>>(frame_time).count();
if (counter == 1 && size < MAX_BUFFER_SIZE * 2.0f) {
@@ -241,7 +241,7 @@ void network::client::handle_message(std::shared_ptr<connection> conn, const mes
}
if (msg.type == message::SERVER_HELLO) {
auto cmd = dynamic_cast<const server_hello&>(msg);
const auto& cmd = dynamic_cast<const server_hello&>(msg);
conn->state = connection::ACTIVE;
if (!Global.ready_to_load) {

View File

@@ -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();

View File

@@ -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<gfx::basic_vertex> 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) {