mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Merge branch 'milek-dev' into gfx-work
This commit is contained in:
139
Driver.cpp
139
Driver.cpp
@@ -1410,16 +1410,24 @@ TController::braking_distance_multiplier( float const Targetvelocity ) const {
|
||||
|
||||
if( Targetvelocity > 65.f ) { return 1.f; }
|
||||
if( Targetvelocity < 5.f ) {
|
||||
|
||||
// HACK: engaged automatic transmission means extra/earlier braking effort is needed for the last leg before full stop
|
||||
if( ( mvOccupied->TrainType == dt_DMU )
|
||||
&& ( mvOccupied->Vel < 40.0 )
|
||||
&& ( Targetvelocity == 0.f ) ) {
|
||||
// HACK: engaged automatic transmission means extra/earlier braking effort is needed for the last leg before full stop
|
||||
return interpolate( 2.f, 1.f, static_cast<float>( mvOccupied->Vel / 40.0 ) );
|
||||
}
|
||||
else {
|
||||
return 1.f;
|
||||
// HACK: cargo trains or trains going downhill with high braking threshold need more distance to come to a full stop
|
||||
if( ( fBrake_a0[ 0 ] > 0.2 )
|
||||
&& ( ( mvOccupied->BrakeDelayFlag & bdelay_G ) != 0 )
|
||||
|| ( fAccGravity > 0.025 ) ) {
|
||||
return interpolate(
|
||||
1.f, 2.f,
|
||||
clamp(
|
||||
( fBrake_a0[ 0 ] - 0.2 ) / 0.2,
|
||||
0.0, 1.0 ) );
|
||||
}
|
||||
|
||||
return 1.f;
|
||||
}
|
||||
// stretch the braking distance up to 3 times; the lower the speed, the greater the stretch
|
||||
return interpolate( 3.f, 1.f, ( Targetvelocity - 5.f ) / 60.f );
|
||||
@@ -1546,7 +1554,7 @@ TController::TController(bool AI, TDynamicObject *NewControll, bool InitPsyche,
|
||||
// fAccThreshold może podlegać uczeniu się - hamowanie powinno być rejestrowane, a potem analizowane
|
||||
// próg opóźnienia dla zadziałania hamulca
|
||||
fAccThreshold = (
|
||||
mvOccupied->TrainType == dt_EZT ? -0.6 :
|
||||
mvOccupied->TrainType == dt_EZT ? -0.55 :
|
||||
mvOccupied->TrainType == dt_DMU ? -0.45 :
|
||||
-0.2 );
|
||||
}
|
||||
@@ -1868,7 +1876,7 @@ void TController::AutoRewident()
|
||||
fBrake_a1[i+1] /= (12*fMass);
|
||||
}
|
||||
if( mvOccupied->TrainType == dt_EZT ) {
|
||||
fAccThreshold = std::max(-fBrake_a0[BrakeAccTableSize] - 8 * fBrake_a1[BrakeAccTableSize], -0.6);
|
||||
fAccThreshold = std::max(-fBrake_a0[BrakeAccTableSize] - 8 * fBrake_a1[BrakeAccTableSize], -0.55);
|
||||
fBrakeReaction = 0.25;
|
||||
}
|
||||
else if( mvOccupied->TrainType == dt_DMU ) {
|
||||
@@ -2672,7 +2680,7 @@ bool TController::DecBrake()
|
||||
}
|
||||
}
|
||||
if (!OK)
|
||||
OK = mvOccupied->DecLocalBrakeLevel(LocalBrakePosNo);
|
||||
OK = mvOccupied->DecLocalBrakeLevel(2);
|
||||
if (mvOccupied->PipePress < 3.0)
|
||||
Need_BrakeRelease = true;
|
||||
break;
|
||||
@@ -2696,7 +2704,7 @@ bool TController::DecBrake()
|
||||
else
|
||||
OK = false;
|
||||
if (!OK)
|
||||
OK = mvOccupied->DecLocalBrakeLevel(LocalBrakePosNo);
|
||||
OK = mvOccupied->DecLocalBrakeLevel(2);
|
||||
break;
|
||||
}
|
||||
return OK;
|
||||
@@ -2744,12 +2752,12 @@ bool TController::IncSpeed()
|
||||
// na pozycji 0 przejdzie, a na pozostałych będzie czekać, aż się załączą liniowe (zgaśnie DelayCtrlFlag)
|
||||
if (Ready || (iDrivigFlags & movePress)) {
|
||||
// use series mode:
|
||||
// to build up speed to 30/40 km/h for passenger/cargo train,
|
||||
// to build up speed to 30/40 km/h for passenger/cargo train (10 km/h less if going uphill)
|
||||
// if high threshold is set for motor overload relay,
|
||||
// if the power station is heavily burdened
|
||||
auto const useseriesmodevoltage { 0.80 * mvControlling->EnginePowerSource.CollectorParameters.MaxV };
|
||||
auto const useseriesmode = (
|
||||
( mvOccupied->Vel <= ( ( mvOccupied->BrakeDelayFlag & bdelay_G ) != 0 ? 35 : 25 ) + ( mvControlling->ScndCtrlPos == 0 ? 0 : 5 ) )
|
||||
( mvOccupied->Vel <= ( ( mvOccupied->BrakeDelayFlag & bdelay_G ) != 0 ? 35 : 25 ) + ( mvControlling->ScndCtrlPos == 0 ? 0 : 5 ) - ( ( fAccGravity < -0.025 ) ? 10 : 0 ) )
|
||||
|| ( mvControlling->Imax > mvControlling->ImaxLo )
|
||||
|| ( fVoltage < useseriesmodevoltage ) );
|
||||
// when not in series mode use the first available parallel mode configuration until 50/60 km/h for passenger/cargo train
|
||||
@@ -3731,13 +3739,14 @@ TController::UpdateSituation(double dt) {
|
||||
if( ( dy = p->VectorFront().y ) != 0.0 ) {
|
||||
// istotne tylko dla pojazdów na pochyleniu
|
||||
// ciężar razy składowa styczna grawitacji
|
||||
fAccGravity -= p->DirectionGet() * p->MoverParameters->TotalMassxg * dy;
|
||||
fAccGravity -= p->MoverParameters->TotalMassxg * dy * ( p->DirectionGet() == iDirection ? 1 : -1 );
|
||||
}
|
||||
p = p->Next(); // pojazd podłączony z tyłu (patrząc od czoła)
|
||||
}
|
||||
if( iDirection ) {
|
||||
// siłę generują pojazdy na pochyleniu ale działa ona całość składu, więc a=F/m
|
||||
fAccGravity /= iDirection * fMass;
|
||||
fAccGravity *= iDirection;
|
||||
fAccGravity /= fMass;
|
||||
}
|
||||
if (!Ready) // v367: jeśli wg powyższych warunków skład nie jest odhamowany
|
||||
if (fAccGravity < -0.05) // jeśli ma pod górę na tyle, by się stoczyć
|
||||
@@ -4292,6 +4301,10 @@ TController::UpdateSituation(double dt) {
|
||||
// additional safety margin for cargo consists
|
||||
fMinProximityDist *= 2.0;
|
||||
fMaxProximityDist *= 2.0;
|
||||
if( fBrake_a0[ 0 ] >= 0.35 ) {
|
||||
// cargo trains with high braking threshold may require even larger safety margin
|
||||
fMaxProximityDist += 20.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
fVelPlus = 2.0; // dopuszczalne przekroczenie prędkości na ograniczeniu bez hamowania
|
||||
@@ -4326,7 +4339,11 @@ TController::UpdateSituation(double dt) {
|
||||
if( mvOccupied->BrakeDelayFlag == bdelay_G ) {
|
||||
// increase distances for cargo trains to take into account slower reaction to brakes
|
||||
fMinProximityDist += 10.0;
|
||||
fMaxProximityDist += 10.0;
|
||||
fMaxProximityDist += 15.0;
|
||||
if( fBrake_a0[ 0 ] >= 0.35 ) {
|
||||
// cargo trains with high braking threshold may require even larger safety margin
|
||||
fMaxProximityDist += 20.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -4924,30 +4941,29 @@ TController::UpdateSituation(double dt) {
|
||||
// decisions based on current speed
|
||||
if( mvOccupied->CategoryFlag == 1 ) {
|
||||
|
||||
if( fAccGravity < 0.025 ) {
|
||||
// on flats on uphill we can be less careful
|
||||
if( vel > VelDesired ) {
|
||||
// jesli jedzie za szybko do AKTUALNEGO
|
||||
if( VelDesired == 0.0 ) {
|
||||
// jesli stoj, to hamuj, ale i tak juz za pozno :)
|
||||
AccDesired = std::min( AccDesired, -0.85 ); // hamuj solidnie
|
||||
// on flats or uphill we can be less careful
|
||||
if( vel > VelDesired ) {
|
||||
// jesli jedzie za szybko do AKTUALNEGO
|
||||
if( VelDesired == 0.0 ) {
|
||||
// jesli stoj, to hamuj, ale i tak juz za pozno :)
|
||||
AccDesired = std::min( AccDesired, -0.85 ); // hamuj solidnie
|
||||
}
|
||||
else {
|
||||
// slow down, not full stop
|
||||
if( vel > ( VelDesired + fVelPlus ) ) {
|
||||
// hamuj tak średnio
|
||||
AccDesired = std::min( AccDesired, -0.25 );
|
||||
}
|
||||
else {
|
||||
// slow down, not full stop
|
||||
if( vel > ( VelDesired + fVelPlus ) ) {
|
||||
// hamuj tak średnio
|
||||
AccDesired = std::min( AccDesired, -0.25 );
|
||||
}
|
||||
else {
|
||||
// o 5 km/h to olej (zacznij luzować)
|
||||
AccDesired = std::min(
|
||||
AccDesired, // but don't override decceleration for VelNext
|
||||
std::max( 0.0, AccPreferred ) );
|
||||
}
|
||||
// o 5 km/h to olej (zacznij luzować)
|
||||
AccDesired = std::min(
|
||||
AccDesired, // but don't override decceleration for VelNext
|
||||
std::max( 0.0, AccPreferred ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if( fAccGravity > 0.025 ) {
|
||||
// going sharply downhill we may need to start braking sooner than usual
|
||||
// try to estimate increase of current velocity before engaged brakes start working
|
||||
auto const speedestimate = vel + ( 1.0 - fBrake_a0[ 0 ] ) * 30.0 * AbsAccS;
|
||||
@@ -4958,20 +4974,39 @@ TController::UpdateSituation(double dt) {
|
||||
AccDesired = std::min( AccDesired, -0.85 ); // hamuj solidnie
|
||||
}
|
||||
else {
|
||||
if( speedestimate > ( VelDesired + fVelPlus ) ) {
|
||||
// if it looks like we'll exceed maximum allowed speed start thinking about slight slowing down
|
||||
AccDesired = std::min( AccDesired, -0.25 );
|
||||
}
|
||||
else {
|
||||
// close enough to target to stop accelerating
|
||||
AccDesired = std::min(
|
||||
AccDesired, // but don't override decceleration for VelNext
|
||||
interpolate( // ease off as you close to the target velocity
|
||||
-0.06, AccPreferred,
|
||||
clamp( speedestimate - vel, 0.0, fVelPlus ) / fVelPlus ) );
|
||||
// if it looks like we'll exceed maximum speed start thinking about slight slowing down
|
||||
AccDesired = std::min( AccDesired, -0.25 );
|
||||
// HACK: for cargo trains with high braking threshold ensure we cross that threshold
|
||||
if( ( ( mvOccupied->BrakeDelayFlag & bdelay_G ) != 0 )
|
||||
&& ( fBrake_a0[ 0 ] > 0.2 ) ) {
|
||||
AccDesired -= clamp( fBrake_a0[ 0 ] - 0.2, 0.0, 0.15 );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// stop accelerating when close enough to target speed
|
||||
AccDesired = std::min(
|
||||
AccDesired, // but don't override decceleration for VelNext
|
||||
interpolate( // ease off as you close to the target velocity
|
||||
-0.06, AccPreferred,
|
||||
clamp( VelDesired - speedestimate, 0.0, fVelMinus ) / fVelMinus ) );
|
||||
}
|
||||
// final tweaks
|
||||
if( vel > 0.1 ) {
|
||||
// going downhill also take into account impact of gravity
|
||||
AccDesired -= fAccGravity;
|
||||
// HACK: if the max allowed speed was exceeded something went wrong; brake harder
|
||||
AccDesired -= 0.15 * clamp( vel - VelDesired, 0.0, 5.0 );
|
||||
/*
|
||||
if( ( vel > VelDesired )
|
||||
&& ( ( mvOccupied->BrakeDelayFlag & bdelay_G ) != 0 )
|
||||
&& ( fBrake_a0[ 0 ] > 0.2 ) ) {
|
||||
AccDesired = clamp(
|
||||
AccDesired - clamp( fBrake_a0[ 0 ] - 0.2, 0.0, 0.15 ),
|
||||
-0.9, 0.9 );
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -5001,14 +5036,7 @@ TController::UpdateSituation(double dt) {
|
||||
|
||||
// last step sanity check, until the whole calculation is straightened out
|
||||
AccDesired = std::min( AccDesired, AccPreferred );
|
||||
|
||||
if( ( mvOccupied->CategoryFlag == 1 )
|
||||
&& ( fAccGravity > 0.025 ) ) {
|
||||
// going downhill also take into account impact of gravity
|
||||
AccDesired = clamp( AccDesired - fAccGravity, -0.9, 0.9 );
|
||||
}
|
||||
|
||||
|
||||
AccDesired = clamp( AccDesired, -0.9, 0.9 );
|
||||
|
||||
if (AIControllFlag) {
|
||||
// część wykonawcza tylko dla AI, dla człowieka jedynie napisy
|
||||
@@ -5214,7 +5242,12 @@ TController::UpdateSituation(double dt) {
|
||||
if( mvOccupied->TrainType == dt_EZT ) {
|
||||
// właściwie, to warunek powinien być na działający EP
|
||||
// Ra: to dobrze hamuje EP w EZT
|
||||
if( ( AccDesired <= fAccThreshold ) // jeśli hamować - u góry ustawia się hamowanie na fAccThreshold
|
||||
// HACK: when going downhill be more responsive to desired deceleration
|
||||
auto const accthreshold { (
|
||||
fAccGravity < 0.025 ?
|
||||
fAccThreshold :
|
||||
std::max( -0.2, fAccThreshold ) ) };
|
||||
if( ( AccDesired <= accthreshold ) // jeśli hamować - u góry ustawia się hamowanie na fAccThreshold
|
||||
&& ( ( AbsAccS > AccDesired )
|
||||
|| ( mvOccupied->BrakeCtrlPos < 0 ) ) ) {
|
||||
// hamować bardziej, gdy aktualne opóźnienie hamowania mniejsze niż (AccDesired)
|
||||
@@ -5242,7 +5275,7 @@ TController::UpdateSituation(double dt) {
|
||||
} // type & dt_ezt
|
||||
else {
|
||||
// a stara wersja w miarę dobrze działa na składy wagonowe
|
||||
if( ( ( fAccGravity < -0.05 ) && ( vel < 0.0 ) )
|
||||
if( ( ( fAccGravity < -0.05 ) && ( vel < -0.1 ) ) // brake if uphill and slipping back
|
||||
|| ( ( AccDesired < fAccGravity - 0.1 ) && ( AbsAccS > AccDesired + fBrake_a1[ 0 ] ) ) ) {
|
||||
// u góry ustawia się hamowanie na fAccThreshold
|
||||
if( ( fBrakeTime < 0.0 )
|
||||
|
||||
10
DynObj.cpp
10
DynObj.cpp
@@ -3204,20 +3204,20 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
p->MoverParameters->Hamulec->GetFC(
|
||||
Nmax / (p->MoverParameters->NAxles * p->MoverParameters->NBpA), VelC) *
|
||||
1000; // sila hamowania pn
|
||||
p->MoverParameters->LocalBrakePosA = (p->MoverParameters->SlippingWheels ? 0 : FzEP[i] / FmaxPoj);
|
||||
if (p->MoverParameters->LocalBrakePosA>0.009)
|
||||
p->MoverParameters->LocalBrakePosAEIM = (p->MoverParameters->SlippingWheels ? 0 : FzEP[i] / FmaxPoj);
|
||||
if (p->MoverParameters->LocalBrakePosAEIM>0.009)
|
||||
if (p->MoverParameters->P2FTrans * p->MoverParameters->BrakeCylMult[0] *
|
||||
p->MoverParameters->MaxBrakePress[0] != 0)
|
||||
{
|
||||
float x = (p->MoverParameters->BrakeSlckAdj / p->MoverParameters->BrakeCylMult[0] +
|
||||
p->MoverParameters->BrakeCylSpring) / (p->MoverParameters->P2FTrans *
|
||||
p->MoverParameters->MaxBrakePress[0]);
|
||||
p->MoverParameters->LocalBrakePosA = x + (1 - x) * p->MoverParameters->LocalBrakePosA;
|
||||
p->MoverParameters->LocalBrakePosAEIM = x + (1 - x) * p->MoverParameters->LocalBrakePosAEIM;
|
||||
}
|
||||
else
|
||||
p->MoverParameters->LocalBrakePosA = p->MoverParameters->LocalBrakePosA;
|
||||
p->MoverParameters->LocalBrakePosAEIM = p->MoverParameters->LocalBrakePosAEIM;
|
||||
else
|
||||
p->MoverParameters->LocalBrakePosA = 0;
|
||||
p->MoverParameters->LocalBrakePosAEIM = 0;
|
||||
++i;
|
||||
}
|
||||
|
||||
|
||||
4
DynObj.h
4
DynObj.h
@@ -568,12 +568,12 @@ private:
|
||||
inline double ABuGetDirection() const { // ABu.
|
||||
return (Axle1.GetTrack() == MyTrack ? Axle1.GetDirection() : Axle0.GetDirection()); };
|
||||
// zwraca kierunek pojazdu na torze z aktywną osą
|
||||
inline double RaDirectionGet() {
|
||||
inline double RaDirectionGet() const {
|
||||
return iAxleFirst ?
|
||||
Axle1.GetDirection() :
|
||||
Axle0.GetDirection(); };
|
||||
// zwraca przesunięcie wózka względem Point1 toru z aktywną osią
|
||||
inline double RaTranslationGet() {
|
||||
inline double RaTranslationGet() const {
|
||||
return iAxleFirst ?
|
||||
Axle1.GetTranslation() :
|
||||
Axle0.GetTranslation(); };
|
||||
|
||||
@@ -1025,7 +1025,8 @@ public:
|
||||
double BrakeCtrlPosR = 0.0; /*nastawa hamulca zespolonego - plynna dla FV4a*/
|
||||
double BrakeCtrlPos2 = 0.0; /*nastawa hamulca zespolonego - kapturek dla FV4a*/
|
||||
int ManualBrakePos = 0; /*nastawa hamulca recznego*/
|
||||
double LocalBrakePosA = 0.0;
|
||||
double LocalBrakePosA = 0.0; /*nastawa hamulca pomocniczego*/
|
||||
double LocalBrakePosAEIM = 0.0; /*pozycja hamulca pomocniczego ep dla asynchronicznych ezt*/
|
||||
/*
|
||||
int BrakeStatus = b_off; //0 - odham, 1 - ham., 2 - uszk., 4 - odluzniacz, 8 - antyposlizg, 16 - uzyte EP, 32 - pozycja R, 64 - powrot z R
|
||||
*/
|
||||
|
||||
@@ -3460,8 +3460,10 @@ void TMoverParameters::UpdatePipePressure(double dt)
|
||||
if ((BrakeCtrlPosNo > 1) /*&& (ActiveCab != 0)*/)
|
||||
// with BrakePressureTable[BrakeCtrlPos] do
|
||||
{
|
||||
dpLocalValve = LocHandle->GetPF(LocalBrakePosA, Hamulec->GetBCP(), ScndPipePress, dt, 0);
|
||||
|
||||
if ((EngineType != TEngineType::ElectricInductionMotor))
|
||||
dpLocalValve = LocHandle->GetPF(std::max(LocalBrakePosA, LocalBrakePosAEIM), Hamulec->GetBCP(), ScndPipePress, dt, 0);
|
||||
else
|
||||
dpLocalValve = LocHandle->GetPF(LocalBrakePosAEIM, Hamulec->GetBCP(), ScndPipePress, dt, 0);
|
||||
if( ( BrakeHandle == TBrakeHandle::FV4a )
|
||||
&& ( ( PipePress < 2.75 )
|
||||
&& ( ( Hamulec->GetStatus() & b_rls ) == 0 ) )
|
||||
|
||||
60
Train.cpp
60
Train.cpp
@@ -612,6 +612,28 @@ bool TTrain::is_eztoer() const {
|
||||
&& ( mvControlled->ActiveDir != 0 ) ); // od yB
|
||||
}
|
||||
|
||||
// mover master controller to specified position
|
||||
void TTrain::set_master_controller( double const Position ) {
|
||||
|
||||
auto positionchange {
|
||||
std::min<int>(
|
||||
Position,
|
||||
( mvControlled->CoupledCtrl ?
|
||||
mvControlled->MainCtrlPosNo + mvControlled->ScndCtrlPosNo :
|
||||
mvControlled->MainCtrlPosNo ) )
|
||||
- ( mvControlled->CoupledCtrl ?
|
||||
mvControlled->MainCtrlPos + mvControlled->ScndCtrlPos :
|
||||
mvControlled->MainCtrlPos ) };
|
||||
while( ( positionchange < 0 )
|
||||
&& ( true == mvControlled->DecMainCtrl( 1 ) ) ) {
|
||||
++positionchange;
|
||||
}
|
||||
while( ( positionchange > 0 )
|
||||
&& ( true == mvControlled->IncMainCtrl( 1 ) ) ) {
|
||||
--positionchange;
|
||||
}
|
||||
}
|
||||
|
||||
// moves train brake lever to specified position, potentially emits switch sound if conditions are met
|
||||
void TTrain::set_train_brake( double const Position ) {
|
||||
|
||||
@@ -752,22 +774,9 @@ void TTrain::OnCommand_mastercontrollerdecreasefast( TTrain *Train, command_data
|
||||
|
||||
void TTrain::OnCommand_mastercontrollerset( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
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( ( positionchange > 0 )
|
||||
&& ( true == Train->mvControlled->IncMainCtrl( 1 ) ) ) {
|
||||
--positionchange;
|
||||
if( Command.action != GLFW_RELEASE ) {
|
||||
// on press or hold
|
||||
Train->set_master_controller( Command.param1 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4370,7 +4379,8 @@ bool TTrain::Update( double const Deltatime )
|
||||
// Odskakiwanie hamulce EP
|
||||
if( false == (
|
||||
( input::command == user_command::trainbrakeset )
|
||||
|| ( input::command == user_command::trainbrakedecrease ) ) ) {
|
||||
|| ( input::command == user_command::trainbrakedecrease )
|
||||
|| ( input::command == user_command::trainbrakecharging ) ) ) {
|
||||
set_train_brake( 0 );
|
||||
}
|
||||
}
|
||||
@@ -5113,16 +5123,12 @@ bool TTrain::Update( double const Deltatime )
|
||||
if (ggMainCtrl.SubModel) {
|
||||
|
||||
#ifdef _WIN32
|
||||
if ((DynamicObject->Mechanik != nullptr)
|
||||
&& (false == DynamicObject->Mechanik->AIControllFlag) // nie blokujemy AI
|
||||
&& (Global.iFeedbackMode == 4)
|
||||
&& (Global.fCalibrateIn[2][1] != 0.0)) {
|
||||
auto const b = clamp<double>(
|
||||
Console::AnalogCalibrateGet(2) * mvOccupied->MainCtrlPosNo,
|
||||
0.0,
|
||||
mvOccupied->MainCtrlPosNo);
|
||||
while (mvOccupied->MainCtrlPos < b) { mvOccupied->MainCtrlPos = b - 1; mvOccupied->IncMainCtrl(1); }
|
||||
while (mvOccupied->MainCtrlPos > b) { mvOccupied->MainCtrlPos = b + 1; mvOccupied->DecMainCtrl(1); }
|
||||
if( ( DynamicObject->Mechanik != nullptr )
|
||||
&& ( false == DynamicObject->Mechanik->AIControllFlag ) // nie blokujemy AI
|
||||
&& ( Global.iFeedbackMode == 4 )
|
||||
&& ( Global.fCalibrateIn[ 2 ][ 1 ] != 0.0 ) ) {
|
||||
|
||||
set_master_controller( Console::AnalogCalibrateGet( 2 ) * mvOccupied->MainCtrlPosNo );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
2
Train.h
2
Train.h
@@ -134,6 +134,8 @@ class TTrain
|
||||
bool is_eztoer() const;
|
||||
// locates nearest vehicle belonging to the consist
|
||||
TDynamicObject *find_nearest_consist_vehicle() const;
|
||||
// mover master controller to specified position
|
||||
void set_master_controller( double const Position );
|
||||
// moves train brake lever to specified position, potentially emits switch sound if conditions are met
|
||||
void set_train_brake( double const Position );
|
||||
// sets specified brake acting speed for specified vehicle, potentially updating state of cab controls to match
|
||||
|
||||
@@ -194,4 +194,10 @@ scenario_time::julian_day() const {
|
||||
return JD;
|
||||
}
|
||||
|
||||
scenario_time::operator std::string(){
|
||||
|
||||
return to_string( m_time.wHour ) + ":"
|
||||
+ ( m_time.wMinute < 10 ? "0" : "" ) + to_string( m_time.wMinute ) + ":"
|
||||
+ ( m_time.wSecond < 10 ? "0" : "" ) + to_string( m_time.wSecond );
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -9,6 +9,8 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "winheaders.h"
|
||||
|
||||
// wrapper for scenario time
|
||||
@@ -47,6 +49,8 @@ public:
|
||||
zone_bias() const {
|
||||
return m_timezonebias; }
|
||||
|
||||
/** Returns std::string in format: `"mm:ss"`. */
|
||||
operator std::string();
|
||||
private:
|
||||
// calculates day and month from given day of year
|
||||
void
|
||||
|
||||
@@ -234,12 +234,7 @@ ui_layer::render() {
|
||||
ImGui::SetNextWindowSize(ImVec2(0, 0));
|
||||
ImGui::Begin("Vehicle info", &basic_info_active, ImGuiWindowFlags_NoResize);
|
||||
|
||||
auto const &time = simulation::Time.data();
|
||||
uitextline1 =
|
||||
"Time: "
|
||||
+ to_string( time.wHour ) + ":"
|
||||
+ ( time.wMinute < 10 ? "0" : "" ) + to_string( time.wMinute ) + ":"
|
||||
+ ( time.wSecond < 10 ? "0" : "" ) + to_string( time.wSecond );
|
||||
uitextline1 = "Time: " + std::string( simulation::Time );
|
||||
if( Global.iPause ) {
|
||||
uitextline1 += " (paused)";
|
||||
}
|
||||
|
||||
@@ -255,14 +255,14 @@ template <typename Type_>
|
||||
Type_
|
||||
interpolate( Type_ const &First, Type_ const &Second, float const Factor ) {
|
||||
|
||||
return ( First * ( 1.0f - Factor ) ) + ( Second * Factor );
|
||||
return static_cast<Type_>( ( First * ( 1.0f - Factor ) ) + ( Second * Factor ) );
|
||||
}
|
||||
|
||||
template <typename Type_>
|
||||
Type_
|
||||
interpolate( Type_ const &First, Type_ const &Second, double const Factor ) {
|
||||
|
||||
return ( First * ( 1.0 - Factor ) ) + ( Second * Factor );
|
||||
return static_cast<Type_>( ( First * ( 1.0 - Factor ) ) + ( Second * Factor ) );
|
||||
}
|
||||
|
||||
// tests whether provided points form a degenerate triangle
|
||||
|
||||
Reference in New Issue
Block a user