mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-06 20:58:35 +01:00
refactor(sonar): remove redundant casts (cpp:S1905)
This commit is contained in:
@@ -19,7 +19,7 @@ struct world_vertex {
|
|||||||
|
|
||||||
static world_vertex lerp(world_vertex const &a, world_vertex const &b, double factor)
|
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
|
// overloads
|
||||||
|
|||||||
@@ -467,7 +467,7 @@ void uart_input::poll()
|
|||||||
}
|
}
|
||||||
if( true == conf.trainenable ) {
|
if( true == conf.trainenable ) {
|
||||||
// train brake
|
// 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(
|
relay.post(
|
||||||
user_command::trainbrakeset,
|
user_command::trainbrakeset,
|
||||||
position,
|
position,
|
||||||
@@ -478,7 +478,7 @@ void uart_input::poll()
|
|||||||
}
|
}
|
||||||
if( true == conf.localenable ) {
|
if( true == conf.localenable ) {
|
||||||
// independent brake
|
// 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(
|
relay.post(
|
||||||
user_command::independentbrakeset,
|
user_command::independentbrakeset,
|
||||||
position,
|
position,
|
||||||
@@ -509,7 +509,7 @@ void uart_input::poll()
|
|||||||
if (true == conf.dynamicenable)
|
if (true == conf.dynamicenable)
|
||||||
{
|
{
|
||||||
// dynamic brake 8 bit
|
// 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(
|
relay.post(
|
||||||
user_command::dynamicbrakecontrollerset,
|
user_command::dynamicbrakecontrollerset,
|
||||||
|
|||||||
@@ -10833,13 +10833,13 @@ void TTrain::DynamicSet(TDynamicObject *d)
|
|||||||
{ // gdy jest człon od sprzęgu 1, a sprzęg łączony
|
{ // gdy jest człon od sprzęgu 1, a sprzęg łączony
|
||||||
// warsztatowo (powiedzmy)
|
// warsztatowo (powiedzmy)
|
||||||
if (mvOccupied->Couplers[1].Connected->Power > 1.0) // ten drugi ma moc
|
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)
|
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
|
{ // gdy jest człon od sprzęgu 0, a sprzęg łączony
|
||||||
// warsztatowo (powiedzmy)
|
// warsztatowo (powiedzmy)
|
||||||
if (mvOccupied->Couplers[0].Connected->Power > 1.0) // ale ten drugi ma moc
|
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
|
// cache nearest unit equipped with pantographs
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user