From 7e8081d904b5244195011320f0d357c60d47c566 Mon Sep 17 00:00:00 2001 From: jerrrrycho Date: Sat, 10 Oct 2026 15:06:37 +0200 Subject: [PATCH] refactor(sonar): remove redundant casts (cpp:S1905) Co-Authored-By: Claude Opus 5.5 --- model/vertex.h | 2 +- utilities/uart.cpp | 6 +++--- vehicle/Train.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/model/vertex.h b/model/vertex.h index 4c2ff2ad..3bcc7bd5 100644 --- a/model/vertex.h +++ b/model/vertex.h @@ -19,7 +19,7 @@ struct world_vertex { static world_vertex lerp(world_vertex const &a, world_vertex const &b, double factor) { - return static_cast(a * (1.0f - factor) + b * factor); + return a * (1.0f - factor) + b * factor; } // overloads diff --git a/utilities/uart.cpp b/utilities/uart.cpp index ab5060fa..4a07bd2c 100644 --- a/utilities/uart.cpp +++ b/utilities/uart.cpp @@ -467,7 +467,7 @@ void uart_input::poll() } if( true == conf.trainenable ) { // train brake - double const position { (float)( ( (uint16_t)buffer[ 8 ] | (uint16_t)buffer[9] << 8 ) - conf.mainbrakemin ) / ( conf.mainbrakemax - conf.mainbrakemin ) }; + double const position { ( ( (uint16_t)buffer[ 8 ] | (uint16_t)buffer[9] << 8 ) - conf.mainbrakemin ) / ( conf.mainbrakemax - conf.mainbrakemin ) }; relay.post( user_command::trainbrakeset, position, @@ -478,7 +478,7 @@ void uart_input::poll() } if( true == conf.localenable ) { // independent brake - double const position { (float)( ( (uint16_t)buffer[ 10 ] | (uint16_t)buffer[11] << 8 ) - conf.localbrakemin ) / ( conf.localbrakemax - conf.localbrakemin ) }; + double const position { ( ( (uint16_t)buffer[ 10 ] | (uint16_t)buffer[11] << 8 ) - conf.localbrakemin ) / ( conf.localbrakemax - conf.localbrakemin ) }; relay.post( user_command::independentbrakeset, position, @@ -509,7 +509,7 @@ void uart_input::poll() if (true == conf.dynamicenable) { // dynamic brake 8 bit - double const position{(float)(buffer[13] - conf.dynamicbrakemin) / (conf.dynamicbrakemax - conf.dynamicbrakemin)}; + double const position{(buffer[13] - conf.dynamicbrakemin) / (conf.dynamicbrakemax - conf.dynamicbrakemin)}; relay.post( user_command::dynamicbrakecontrollerset, diff --git a/vehicle/Train.cpp b/vehicle/Train.cpp index f2111bf5..ec9ac51a 100644 --- a/vehicle/Train.cpp +++ b/vehicle/Train.cpp @@ -10833,13 +10833,13 @@ void TTrain::DynamicSet(TDynamicObject *d) { // gdy jest człon od sprzęgu 1, a sprzęg łączony // warsztatowo (powiedzmy) if (mvOccupied->Couplers[1].Connected->Power > 1.0) // ten drugi ma moc - mvSecond = (TMoverParameters *)mvOccupied->Couplers[1].Connected; // wskaźnik na drugiego + mvSecond = mvOccupied->Couplers[1].Connected; // wskaźnik na drugiego } else if (mvOccupied->Couplers[0].Connected ? mvOccupied->Couplers[0].AllowedFlag & coupling::control : false) { // gdy jest człon od sprzęgu 0, a sprzęg łączony // warsztatowo (powiedzmy) if (mvOccupied->Couplers[0].Connected->Power > 1.0) // ale ten drugi ma moc - mvSecond = (TMoverParameters *)mvOccupied->Couplers[0].Connected; // wskaźnik na drugiego + mvSecond = mvOccupied->Couplers[0].Connected; // wskaźnik na drugiego } // cache nearest unit equipped with pantographs {