16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-20 19:29:18 +02:00

brake delay command propagation, vehicle controller state command fixes

This commit is contained in:
tmj-fstate
2018-06-04 00:05:36 +02:00
parent ca07dfad72
commit 45fc26c596
3 changed files with 33 additions and 12 deletions

View File

@@ -9574,6 +9574,7 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
else {
OK = false;
}
SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
}
else if (Command == "Sandbox")
{

View File

@@ -740,12 +740,22 @@ void TTrain::OnCommand_mastercontrollerdecreasefast( TTrain *Train, command_data
void TTrain::OnCommand_mastercontrollerset( TTrain *Train, command_data const &Command ) {
auto const targetposition { std::min<int>( Command.param1, Train->mvControlled->MainCtrlPosNo ) };
while( targetposition < Train->mvControlled->MainCtrlPos ) {
Train->mvControlled->DecMainCtrl( 1 );
auto positionchange {
std::min<int>(
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 ) {
Train->mvControlled->IncMainCtrl( 1 );
while( ( positionchange > 0 )
&& ( 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 ) {
auto const targetposition { std::min<int>( Command.param1, Train->mvControlled->ScndCtrlPosNo ) };
while( targetposition < Train->mvControlled->ScndCtrlPos ) {
Train->mvControlled->DecScndCtrl( 1 );
while( ( targetposition < Train->mvControlled->ScndCtrlPos )
&& ( true == Train->mvControlled->DecScndCtrl( 1 ) ) ) {
// all work is done in the header
;
}
while( targetposition > Train->mvControlled->ScndCtrlPos ) {
Train->mvControlled->IncScndCtrl( 1 );
while( ( targetposition > Train->mvControlled->ScndCtrlPos )
&& ( true == Train->mvControlled->IncScndCtrl( 1 ) ) ) {
// all work is done in the header
;
}
}

View File

@@ -283,11 +283,17 @@ ui_layer::update() {
if( Global.iScreenMode[ Global.iTextMode - GLFW_KEY_F1 ] == 1 ) {
// detail mode on second key press
auto const speedlimit { static_cast<int>( std::floor( driver->VelDesired ) ) };
uitextline2 +=
" 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"
+ ", next limit: " + std::to_string( static_cast<int>( std::floor( controlled->Mechanik->VelNext ) ) ) + " km/h"
+ " in " + to_string( controlled->Mechanik->ActualProximityDist * 0.001, 1 ) + " km)";
+ " (limit: " + std::to_string( speedlimit ) + " km/h";
auto const nextspeedlimit { static_cast<int>( std::floor( controlled->Mechanik->VelNext ) ) };
if( nextspeedlimit != speedlimit ) {
uitextline2 +=
", new limit: " + std::to_string( nextspeedlimit ) + " km/h"
+ " in " + to_string( controlled->Mechanik->ActualProximityDist * 0.001, 1 ) + " km";
}
uitextline2 += ")";
uitextline3 +=
" Pressure: " + to_string( mover->BrakePress * 100.0, 2 ) + " kPa"
+ " (train pipe: " + to_string( mover->PipePress * 100.0, 2 ) + " kPa)";