mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 11:39:19 +02:00
brake delay command propagation, vehicle controller state command fixes
This commit is contained in:
@@ -9574,6 +9574,7 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
|
|||||||
else {
|
else {
|
||||||
OK = false;
|
OK = false;
|
||||||
}
|
}
|
||||||
|
SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
}
|
}
|
||||||
else if (Command == "Sandbox")
|
else if (Command == "Sandbox")
|
||||||
{
|
{
|
||||||
|
|||||||
32
Train.cpp
32
Train.cpp
@@ -740,12 +740,22 @@ void TTrain::OnCommand_mastercontrollerdecreasefast( TTrain *Train, command_data
|
|||||||
|
|
||||||
void TTrain::OnCommand_mastercontrollerset( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_mastercontrollerset( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
auto const targetposition { std::min<int>( Command.param1, Train->mvControlled->MainCtrlPosNo ) };
|
auto positionchange {
|
||||||
while( targetposition < Train->mvControlled->MainCtrlPos ) {
|
std::min<int>(
|
||||||
Train->mvControlled->DecMainCtrl( 1 );
|
Command.param1,
|
||||||
|
( Train->mvControlled->CoupledCtrl ?
|
||||||
|
Train->mvControlled->MainCtrlPosNo + Train->mvControlled->ScndCtrlPosNo :
|
||||||
|
Train->mvControlled->MainCtrlPosNo ) )
|
||||||
|
- ( Train->mvControlled->CoupledCtrl ?
|
||||||
|
Train->mvControlled->MainCtrlPos + Train->mvControlled->ScndCtrlPos :
|
||||||
|
Train->mvControlled->MainCtrlPos ) };
|
||||||
|
while( ( positionchange < 0 )
|
||||||
|
&& ( true == Train->mvControlled->DecMainCtrl( 1 ) ) ) {
|
||||||
|
++positionchange;
|
||||||
}
|
}
|
||||||
while( targetposition > Train->mvControlled->MainCtrlPos ) {
|
while( ( positionchange > 0 )
|
||||||
Train->mvControlled->IncMainCtrl( 1 );
|
&& ( true == Train->mvControlled->IncMainCtrl( 1 ) ) ) {
|
||||||
|
--positionchange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -850,11 +860,15 @@ void TTrain::OnCommand_secondcontrollerdecreasefast( TTrain *Train, command_data
|
|||||||
void TTrain::OnCommand_secondcontrollerset( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_secondcontrollerset( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
auto const targetposition { std::min<int>( Command.param1, Train->mvControlled->ScndCtrlPosNo ) };
|
auto const targetposition { std::min<int>( Command.param1, Train->mvControlled->ScndCtrlPosNo ) };
|
||||||
while( targetposition < Train->mvControlled->ScndCtrlPos ) {
|
while( ( targetposition < Train->mvControlled->ScndCtrlPos )
|
||||||
Train->mvControlled->DecScndCtrl( 1 );
|
&& ( true == Train->mvControlled->DecScndCtrl( 1 ) ) ) {
|
||||||
|
// all work is done in the header
|
||||||
|
;
|
||||||
}
|
}
|
||||||
while( targetposition > Train->mvControlled->ScndCtrlPos ) {
|
while( ( targetposition > Train->mvControlled->ScndCtrlPos )
|
||||||
Train->mvControlled->IncScndCtrl( 1 );
|
&& ( true == Train->mvControlled->IncScndCtrl( 1 ) ) ) {
|
||||||
|
// all work is done in the header
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
12
uilayer.cpp
12
uilayer.cpp
@@ -283,11 +283,17 @@ ui_layer::update() {
|
|||||||
|
|
||||||
if( Global.iScreenMode[ Global.iTextMode - GLFW_KEY_F1 ] == 1 ) {
|
if( Global.iScreenMode[ Global.iTextMode - GLFW_KEY_F1 ] == 1 ) {
|
||||||
// detail mode on second key press
|
// detail mode on second key press
|
||||||
|
auto const speedlimit { static_cast<int>( std::floor( driver->VelDesired ) ) };
|
||||||
uitextline2 +=
|
uitextline2 +=
|
||||||
" Speed: " + std::to_string( static_cast<int>( std::floor( mover->Vel ) ) ) + " km/h"
|
" Speed: " + std::to_string( static_cast<int>( std::floor( mover->Vel ) ) ) + " km/h"
|
||||||
+ " (limit: " + std::to_string( static_cast<int>( std::floor( driver->VelDesired ) ) ) + " km/h"
|
+ " (limit: " + std::to_string( speedlimit ) + " km/h";
|
||||||
+ ", next limit: " + std::to_string( static_cast<int>( std::floor( controlled->Mechanik->VelNext ) ) ) + " km/h"
|
auto const nextspeedlimit { static_cast<int>( std::floor( controlled->Mechanik->VelNext ) ) };
|
||||||
+ " in " + to_string( controlled->Mechanik->ActualProximityDist * 0.001, 1 ) + " km)";
|
if( nextspeedlimit != speedlimit ) {
|
||||||
|
uitextline2 +=
|
||||||
|
", new limit: " + std::to_string( nextspeedlimit ) + " km/h"
|
||||||
|
+ " in " + to_string( controlled->Mechanik->ActualProximityDist * 0.001, 1 ) + " km";
|
||||||
|
}
|
||||||
|
uitextline2 += ")";
|
||||||
uitextline3 +=
|
uitextline3 +=
|
||||||
" Pressure: " + to_string( mover->BrakePress * 100.0, 2 ) + " kPa"
|
" Pressure: " + to_string( mover->BrakePress * 100.0, 2 ) + " kPa"
|
||||||
+ " (train pipe: " + to_string( mover->PipePress * 100.0, 2 ) + " kPa)";
|
+ " (train pipe: " + to_string( mover->PipePress * 100.0, 2 ) + " kPa)";
|
||||||
|
|||||||
Reference in New Issue
Block a user