From fc7b1f22572e3968e749d9e5ca1d4efd155630a9 Mon Sep 17 00:00:00 2001 From: tmj-fstate Date: Wed, 23 Oct 2019 16:53:48 +0200 Subject: [PATCH] passenger exchange calculation tweak, vehicle brakes logic tweak --- McZapkie/Mover.cpp | 7 ++++++- station.cpp | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 4640d8b1..7e91325d 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -4013,6 +4013,9 @@ void TMoverParameters::UpdatePipePressure(double dt) } // ulepszony hamulec bezp. + auto const securitysystempresent { SecuritySystem.RadioStop || ( SecuritySystem.SystemType > 0 ) }; + auto const lowvoltagepower { Battery || ConverterFlag }; + if( ( true == RadioStopFlag ) || ( true == AlarmChainFlag ) || ( true == TestFlag( SecuritySystem.Status, s_SHPebrake ) ) @@ -4022,7 +4025,9 @@ void TMoverParameters::UpdatePipePressure(double dt) // (if it's supposed to be broken coupler, such event sets alarmchainflag instead when appropriate) || ( true == TestFlag( EngDmgFlag, 32 ) ) */ - || ( true == s_CAtestebrake ) ) { + || ( true == s_CAtestebrake ) + || ( ( true == securitysystempresent ) + && ( false == lowvoltagepower ) ) ) { dpMainValve = dpMainValve + PF( 0, PipePress, 0.15 ) * dt; } // 0.2*Spg diff --git a/station.cpp b/station.cpp index 359785b1..328ee4ce 100644 --- a/station.cpp +++ b/station.cpp @@ -23,6 +23,7 @@ basic_station Station; double basic_station::update_load( TDynamicObject *First, Mtable::TTrainParameters &Schedule, int const Platform ) { + // TODO: filter out maintenance stops when determining first and last stop auto const firststop { Schedule.StationIndex == 1 }; auto const laststop { Schedule.StationIndex == Schedule.StationCount }; // HACK: determine whether current station is a (small) stop from the presence of "po" at the name end @@ -31,6 +32,7 @@ basic_station::update_load( TDynamicObject *First, Mtable::TTrainParameters &Sch auto const trainstop { ( ( ( stationname.size() >= 2 ) && ( stationname.substr( stationname.size() - 2 ) == "po" ) ) || ( stationequipment.find( "po" ) != std::string::npos ) ) }; + auto const maintenancestop { ( stationequipment.find( "pt" ) != std::string::npos ) }; // train stops exchange smaller groups than regular stations // NOTE: this is crude and unaccurate, but for now will do auto const stationsizemodifier { ( trainstop ? 1.0 : 2.0 ) }; @@ -59,12 +61,14 @@ basic_station::update_load( TDynamicObject *First, Mtable::TTrainParameters &Sch TestFlag( parameters.DamageFlag, dtrain_out ) ? parameters.LoadAmount : laststop ? parameters.LoadAmount : firststop ? 0 : + maintenancestop ? 0 : std::min( parameters.LoadAmount, Random( parameters.MaxLoad * 0.15f * stationsizemodifier ) ) ); auto loadcount = static_cast( TestFlag( parameters.DamageFlag, dtrain_out ) ? 0 : laststop ? 0 : + maintenancestop ? 0 : Random( parameters.MaxLoad * 0.15f * stationsizemodifier ) ); if( true == firststop ) { // larger group at the initial station