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

passenger exchange calculation tweak, vehicle brakes logic tweak

This commit is contained in:
tmj-fstate
2019-10-23 16:53:48 +02:00
parent bc8b3d72f3
commit fc7b1f2257
2 changed files with 10 additions and 1 deletions

View File

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

View File

@@ -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<float>(
parameters.LoadAmount,
Random( parameters.MaxLoad * 0.15f * stationsizemodifier ) ) );
auto loadcount = static_cast<int>(
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