17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 05:09:20 +02:00

refactor(sonar): remove redundant casts (cpp:S1905)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jerrrrycho
2026-10-10 15:06:37 +02:00
parent c831bb543c
commit 7e8081d904
3 changed files with 6 additions and 6 deletions

View File

@@ -19,7 +19,7 @@ struct world_vertex {
static world_vertex lerp(world_vertex const &a, world_vertex const &b, double factor)
{
return static_cast<world_vertex>(a * (1.0f - factor) + b * factor);
return a * (1.0f - factor) + b * factor;
}
// overloads

View File

@@ -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,

View File

@@ -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
{