From f9febd5887fdf7cae8d0fc80100e799077334e4a Mon Sep 17 00:00:00 2001 From: tmj-fstate Date: Thu, 28 Nov 2019 00:10:32 +0100 Subject: [PATCH] refactoring: variable names --- Camera.cpp | 2 +- Driver.cpp | 82 ++++++------- DynObj.cpp | 34 +++--- McZapkie/MOVER.h | 9 +- McZapkie/Mover.cpp | 292 ++++++++++++++++++++++----------------------- Train.cpp | 96 +++++++-------- TrkFoll.cpp | 2 +- drivermode.cpp | 50 ++++---- driveruipanels.cpp | 6 +- sound.cpp | 10 +- 10 files changed, 291 insertions(+), 292 deletions(-) diff --git a/Camera.cpp b/Camera.cpp index 28405e8a..21350fb0 100644 --- a/Camera.cpp +++ b/Camera.cpp @@ -188,7 +188,7 @@ void TCamera::Update() // attached movement position update auto movement { Velocity * -2.0 }; movement.y = -movement.y; - if( m_owner->MoverParameters->ActiveCab < 0 ) { + if( m_owner->MoverParameters->CabOccupied < 0 ) { movement *= -1.f; movement.y = -movement.y; } diff --git a/Driver.cpp b/Driver.cpp index 292dadfc..86e24496 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -1628,7 +1628,7 @@ TController::TController(bool AI, TDynamicObject *NewControll, bool InitPsyche, pVehicles[ 1 ] = nullptr; } if( mvOccupied != nullptr ) { - iDirectionOrder = mvOccupied->CabNo; // 1=do przodu (w kierunku sprzęgu 0) + iDirectionOrder = mvOccupied->CabActive; // 1=do przodu (w kierunku sprzęgu 0) VehicleName = mvOccupied->Name; if( mvOccupied->CategoryFlag & 2 ) { // samochody: na podst. http://www.prawko-kwartnik.info/hamowanie.html @@ -1816,7 +1816,7 @@ void TController::Activation() mvOccupied->Handle->GetPos(bh_NP)); // odcięcie na zaworze maszynisty BrakeLevelSet(gbh_NP); //ustawienie zmiennej GBH } - mvOccupied->ActiveCab = mvOccupied->CabNo; // użytkownik moze zmienić ActiveCab wychodząc + mvOccupied->CabOccupied = mvOccupied->CabActive; // użytkownik moze zmienić CabOccupied wychodząc mvOccupied->CabDeactivisation(); // tak jest w Train.cpp // przejście AI na drugą stronę EN57, ET41 itp. while (TestFlag(d->MoverParameters->Couplers[iDirection < 0 ? end::rear : end::front].CouplingFlag, ctrain_controll)) @@ -1831,8 +1831,8 @@ void TController::Activation() if (d->DirectionGet() != pVehicle->DirectionGet()) // jeśli są przeciwne do siebie iDirection = -iDirection; // to będziemy jechać w drugą stronę względem zasiedzianego pojazdu pVehicle->Mechanik = drugi; // wsadzamy tego, co ewentualnie był (podwójna trakcja) - pVehicle->MoverParameters->CabNo = 0; // wyłączanie kabin po drodze - pVehicle->MoverParameters->ActiveCab = 0; // i zaznaczenie, że nie ma tam nikogo + pVehicle->MoverParameters->CabActive = 0; // wyłączanie kabin po drodze + pVehicle->MoverParameters->CabOccupied = 0; // i zaznaczenie, że nie ma tam nikogo pVehicle = d; // a mechu ma nowy pojazd (no, człon) } else @@ -1856,9 +1856,9 @@ void TController::Activation() } } // Ra: to przełączanie poniżej jest tu bez sensu - mvOccupied->ActiveCab = iDirection; // aktywacja kabiny w prowadzonym pojeżdzie (silnikowy może być odwrotnie?) - // mvOccupied->CabNo=iDirection; - // mvOccupied->ActiveDir=0; //żeby sam ustawił kierunek + mvOccupied->CabOccupied = iDirection; // aktywacja kabiny w prowadzonym pojeżdzie (silnikowy może być odwrotnie?) + // mvOccupied->CabActive=iDirection; + // mvOccupied->DirActive=0; //żeby sam ustawił kierunek mvOccupied->CabActivisation(); // uruchomienie kabin w członach DirectionForward(true); // nawrotnik do przodu if (localbrakelevel > 0.0) // hamowanie tylko jeśli był wcześniej zahamowany (bo możliwe, że jedzie!) @@ -2102,7 +2102,7 @@ int TController::CheckDirection() { int d = mvOccupied->DirAbsolute; // który sprzęg jest z przodu if( !d ) { // jeśli nie ma ustalonego kierunku to jedziemy wg aktualnej kabiny - d = mvOccupied->CabNo; + d = mvOccupied->CabActive; } return d; } @@ -2223,23 +2223,23 @@ bool TController::CheckVehicles(TOrders user) { // HACK: the 'front' and 'rear' of the consist is determined by current consist direction // since direction shouldn't affect Tb1 light configuration, we 'counter' this behaviour by virtually swapping end vehicles - if( mvOccupied->ActiveDir > 0 ) { + if( mvOccupied->DirActive > 0 ) { Lights( light::headlight_right, - ( pVehicles[ 1 ]->MoverParameters->CabNo != 0 ? + ( pVehicles[ 1 ]->MoverParameters->CabActive != 0 ? light::headlight_left : 0 ) ); //światła manewrowe (Tb1) na pojeździe z napędem } else { Lights( - ( pVehicles[ 1 ]->MoverParameters->CabNo != 0 ? + ( pVehicles[ 1 ]->MoverParameters->CabActive != 0 ? light::headlight_left : 0 ), light::headlight_right ); //światła manewrowe (Tb1) na pojeździe z napędem } } else if( true == TestFlag( OrderCurrentGet(), Disconnect ) ) { - if( mvOccupied->ActiveDir > 0 ) { + if( mvOccupied->DirActive > 0 ) { // jak ma kierunek do przodu // światła manewrowe (Tb1) tylko z przodu, aby nie pozostawić odczepionego ze światłem Lights( light::headlight_right, 0 ); @@ -2348,7 +2348,7 @@ void TController::DirectionInitial() { // jeśli na starcie jedzie iDirection = iDirectionOrder = (mvOccupied->V > 0 ? 1 : -1); // początkowa prędkość wymusza kierunek jazdy - DirectionForward(mvOccupied->V * mvOccupied->CabNo >= 0.0); // a dalej ustawienie nawrotnika + DirectionForward(mvOccupied->V * mvOccupied->CabActive >= 0.0); // a dalej ustawienie nawrotnika } CheckVehicles(); // sprawdzenie świateł oraz skrajnych pojazdów do skanowania }; @@ -2368,7 +2368,7 @@ int TController::OrderDirectionChange(int newdir, TMoverParameters *Vehicle) if (Vehicle->Vel < 0.5) { // jeśli prawie stoi, można zmienić kierunek, musi być wykonane dwukrotnie, bo za pierwszym // razem daje na zero - switch (newdir * Vehicle->CabNo) + switch (newdir * Vehicle->CabActive) { // DirectionBackward() i DirectionForward() to zmiany względem kabiny case -1: // if (!Vehicle->DirectionBackward()) testd=0; break; DirectionForward(false); @@ -2382,12 +2382,12 @@ int TController::OrderDirectionChange(int newdir, TMoverParameters *Vehicle) } else // jeśli jedzie VelforDriver = 0; // ma się zatrzymać w celu zmiany kierunku - if ((Vehicle->ActiveDir == 0) && (VelforDriver < Vehicle->Vel)) // Ra: to jest chyba bez sensu + if ((Vehicle->DirActive == 0) && (VelforDriver < Vehicle->Vel)) // Ra: to jest chyba bez sensu IncBrake(); // niech hamuje - if (Vehicle->ActiveDir == testd * Vehicle->CabNo) + if (Vehicle->DirActive == testd * Vehicle->CabActive) VelforDriver = -1; // można jechać, bo kierunek jest zgodny z żądanym if (Vehicle->TrainType == dt_EZT) - if (Vehicle->ActiveDir > 0) + if (Vehicle->DirActive > 0) // if () //tylko jeśli jazda pociągowa (tego nie wiemy w momencie odpalania silnika) Vehicle->DirectionForward(); // Ra: z przekazaniem do silnikowego return (int)VelforDriver; // zwraca prędkość mechanika @@ -2540,7 +2540,7 @@ bool TController::PrepareEngine() if( !iDirection ) { // jeśli nie ma ustalonego kierunku if( mvOccupied->Vel < 0.01 ) { // ustalenie kierunku, gdy stoi - iDirection = mvOccupied->CabNo; // wg wybranej kabiny + iDirection = mvOccupied->CabActive; // wg wybranej kabiny if( !iDirection ) { // jeśli nie ma ustalonego kierunku if( ( mvControlling->PantographVoltage != 0.0 ) || voltfront || voltrear ) { @@ -2622,7 +2622,7 @@ bool TController::PrepareEngine() OK = false; if( ( true == OK ) - && ( mvOccupied->ActiveDir != 0 ) + && ( mvOccupied->DirActive != 0 ) && ( true == workingtemperature ) && ( ( mvControlling->ScndPipePress > 4.5 ) || ( mvControlling->VeselVolume == 0.0 ) ) ) { @@ -2663,7 +2663,7 @@ bool TController::ReleaseEngine() { if( false == AIControllFlag ) { // tylko to testujemy dla pojazdu człowieka - OK = ( ( mvOccupied->ActiveDir == 0 ) && ( mvControlling->Mains ) ); + OK = ( ( mvOccupied->DirActive == 0 ) && ( mvControlling->Mains ) ); } else { // jeśli steruje komputer @@ -3188,7 +3188,7 @@ bool TController::IncSpeed() } break; case TEngineType::WheelsDriven: - if (!mvControlling->CabNo) + if (!mvControlling->CabActive) mvControlling->CabActivisation(); if (sin(mvControlling->eAngle) > 0) mvControlling->IncMainCtrl(3 + 3 * floor(0.5 + fabs(AccDesired))); @@ -3278,7 +3278,7 @@ bool TController::DecSpeed(bool force) OK = DecSpeedEIM(); break; case TEngineType::WheelsDriven: - if (!mvControlling->CabNo) + if (!mvControlling->CabActive) mvControlling->CabActivisation(); if (sin(mvControlling->eAngle) < 0) mvControlling->IncMainCtrl(3 + 3 * floor(0.5 + fabs(AccDesired))); @@ -3412,7 +3412,7 @@ void TController::SpeedSet() if( fActionTime < 0.0 ) { break; } if( fReady > ( mvOccupied->Vel > 5.0 ? 0.5 : 0.4 ) ) { break; } - if( mvOccupied->ActiveDir > 0 ) { + if( mvOccupied->DirActive > 0 ) { mvOccupied->DirectionForward(); //żeby EN57 jechały na drugiej nastawie } @@ -3565,13 +3565,13 @@ void TController::SpeedCntrl(double DesiredSpeed) else if (mvControlling->ScndCtrlPos < 1) { mvControlling->IncScndCtrl(1); } - mvControlling->RunCommand("SpeedCntrl", DesiredSpeed, mvControlling->CabNo); + mvControlling->RunCommand("SpeedCntrl", DesiredSpeed, mvControlling->CabActive); } else if (mvControlling->ScndCtrlPosNo == 1) { mvControlling->IncScndCtrl(1); - mvControlling->RunCommand("SpeedCntrl", DesiredSpeed, mvControlling->CabNo); + mvControlling->RunCommand("SpeedCntrl", DesiredSpeed, mvControlling->CabActive); } else if ((mvControlling->ScndCtrlPosNo > 1) && (!mvOccupied->SpeedCtrlTypeTime)) { @@ -4050,13 +4050,13 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N if (mvOccupied->V!=0.0) iDirectionOrder=mvOccupied->V>0?1:-1; else - iDirectionOrder=mvOccupied->ActiveCab; + iDirectionOrder=mvOccupied->CabOccupied; if (!iDirectionOrder) iDirectionOrder=1; } */ // jeśli wysyłane z Trainset, to wszystko jest już odpowiednio ustawione // if (!NewLocation) //jeśli wysyłane z Trainset - // if (mvOccupied->CabNo*mvOccupied->V*NewValue1<0) //jeśli zadana prędkość niezgodna z + // if (mvOccupied->CabActive*mvOccupied->V*NewValue1<0) //jeśli zadana prędkość niezgodna z // aktualnym kierunkiem jazdy // DirectionForward(false); //jedziemy do tyłu (nawrotnik do tyłu) // CheckVehicles(); //sprawdzenie składu, AI zapali światła @@ -4376,7 +4376,7 @@ void TController::PhysicsLog() << int(mvControlling->ScndCtrlPos) << " " << mvOccupied->fBrakeCtrlPos << " " << mvOccupied->LocalBrakePosA << " " - << int(mvControlling->ActiveDir) << " " + << int(mvControlling->DirActive) << " " << ( mvOccupied->CommandIn.Command.empty() ? "none" : mvOccupied->CommandIn.Command.c_str() ) << " " << mvOccupied->CommandIn.Value1 << " " << mvOccupied->CommandIn.Value2 << " " @@ -4842,7 +4842,7 @@ TController::UpdateSituation(double dt) { routescandirection = end::rear; } /* - if( pVehicle->MoverParameters->ActiveCab < 0 ) { + if( pVehicle->MoverParameters->CabOccupied < 0 ) { // flip the scan direction in the rear cab routescandirection ^= routescandirection; } @@ -5357,7 +5357,7 @@ TController::UpdateSituation(double dt) { mvOccupied->BrakeReleaser(1); // wyluzuj lokomotywę; a ST45? mvOccupied->DecLocalBrakeLevel(LocalBrakePosNo); // zwolnienie hamulca iDrivigFlags |= movePress; // następnie będzie dociskanie - DirectionForward(mvOccupied->ActiveDir < 0); // zmiana kierunku jazdy na przeciwny (dociskanie) + DirectionForward(mvOccupied->DirActive < 0); // zmiana kierunku jazdy na przeciwny (dociskanie) CheckVehicles(); // od razu zmienić światła (zgasić) - bez tego się nie odczepi } } @@ -5376,7 +5376,7 @@ TController::UpdateSituation(double dt) { ZeroSpeed(); // ponowna zmiana kierunku WriteLog( mvOccupied->Name + " ponowna zmiana kierunku" ); - DirectionForward(mvOccupied->ActiveDir < 0); // zmiana kierunku jazdy na właściwy + DirectionForward(mvOccupied->DirActive < 0); // zmiana kierunku jazdy na właściwy iDrivigFlags &= ~movePress; // koniec dociskania JumpToNextOrder(); // zmieni światła TableClear(); // skanowanie od nowa @@ -5642,7 +5642,7 @@ TController::UpdateSituation(double dt) { // TODO: proper system for sending/receiving radio messages // place the sound in appropriate cab of the manned vehicle tsGuardSignal.owner( pVehicle ); - tsGuardSignal.offset( { 0.f, 2.f, pVehicle->MoverParameters->Dim.L * 0.4f * ( pVehicle->MoverParameters->ActiveCab < 0 ? -1 : 1 ) } ); + tsGuardSignal.offset( { 0.f, 2.f, pVehicle->MoverParameters->Dim.L * 0.4f * ( pVehicle->MoverParameters->CabOccupied < 0 ? -1 : 1 ) } ); tsGuardSignal.play( sound_flags::exclusive ); } } @@ -6256,7 +6256,7 @@ TController::UpdateSituation(double dt) { { // tutaj, gdy pojazd jest wyłączony if (!AIControllFlag) // jeśli sterowanie jest w gestii użytkownika if (mvOccupied->Battery) // czy użytkownik załączył baterię? - if (mvOccupied->ActiveDir) // czy ustawił kierunek + if (mvOccupied->DirActive) // czy ustawił kierunek { // jeśli tak, to uruchomienie skanowania CheckVehicles(); // sprawdzić skład TableClear(); // resetowanie tabelki skanowania @@ -6919,13 +6919,13 @@ void TController::TakeControl( bool const Aidriver, bool const Forcevehiclecheck } else { // jeśli nic nie robi - if( pVehicle->iLights[ ( mvOccupied->CabNo < 0 ? + if( pVehicle->iLights[ ( mvOccupied->CabActive < 0 ? end::rear : end::front ) ] & ( light::headlight_left | light::headlight_right | light::headlight_upper ) ) // któreś ze świateł zapalone? { // od wersji 357 oczekujemy podania komend dla AI przez scenerię OrderNext( Prepare_engine ); - if( pVehicle->iLights[ mvOccupied->CabNo < 0 ? end::rear : end::front ] & light::headlight_upper ) // górne światło zapalone + if( pVehicle->iLights[ mvOccupied->CabActive < 0 ? end::rear : end::front ] & light::headlight_upper ) // górne światło zapalone OrderNext( Obey_train ); // jazda pociągowa else OrderNext( Shunt ); // jazda manewrowa @@ -6960,7 +6960,7 @@ void TController::DirectionForward(bool forward) if( forward ) { // do przodu w obecnej kabinie - while( ( mvOccupied->ActiveDir <= 0 ) + while( ( mvOccupied->DirActive <= 0 ) && ( mvOccupied->DirectionForward() ) ) { // force scan table update iTableDirection = 0; @@ -6968,7 +6968,7 @@ void TController::DirectionForward(bool forward) } else { // do tyłu w obecnej kabinie - while( ( mvOccupied->ActiveDir >= 0 ) + while( ( mvOccupied->DirActive >= 0 ) && ( mvOccupied->DirectionBackward() ) ) { // force scan table update iTableDirection = 0; @@ -6985,13 +6985,13 @@ void TController::DirectionForward(bool forward) void TController::ZeroDirection() { - while( ( mvOccupied->ActiveDir > 0 ) && ( mvOccupied->DirectionBackward() ) ) { ; } - while( ( mvOccupied->ActiveDir < 0 ) && ( mvOccupied->DirectionForward() ) ) { ; } + while( ( mvOccupied->DirActive > 0 ) && ( mvOccupied->DirectionBackward() ) ) { ; } + while( ( mvOccupied->DirActive < 0 ) && ( mvOccupied->DirectionForward() ) ) { ; } } void TController::sync_consist_reversers() { - auto const currentdirection { mvOccupied->ActiveDir }; + auto const currentdirection { mvOccupied->DirActive }; auto const fastforward { ( ( mvOccupied->TrainType == dt_EZT ) && ( mvOccupied->EngineType != TEngineType::ElectricInductionMotor ) ) @@ -7008,7 +7008,7 @@ void TController::sync_consist_reversers() { } } // ...then restore original setting - while( mvOccupied->ActiveDir != currentdirection ) { + while( mvOccupied->DirActive != currentdirection ) { if( false == ( currentdirection >= 0 ? mvOccupied->DirectionForward() : diff --git a/DynObj.cpp b/DynObj.cpp index 24f52fbf..147010e1 100644 --- a/DynObj.cpp +++ b/DynObj.cpp @@ -623,8 +623,8 @@ void TDynamicObject::UpdateMirror( TAnim *pAnim ) { // only animate the mirror if it's located on the same end of the vehicle as the active cab auto const isactive { ( - MoverParameters->ActiveCab > 0 ? ( ( pAnim->iNumber >> 4 ) == end::front ? 1.0 : 0.0 ) : - MoverParameters->ActiveCab < 0 ? ( ( pAnim->iNumber >> 4 ) == end::rear ? 1.0 : 0.0 ) : + MoverParameters->CabOccupied > 0 ? ( ( pAnim->iNumber >> 4 ) == end::front ? 1.0 : 0.0 ) : + MoverParameters->CabOccupied < 0 ? ( ( pAnim->iNumber >> 4 ) == end::rear ? 1.0 : 0.0 ) : 0.0 ) }; if( pAnim->iNumber & 1 ) @@ -1040,9 +1040,9 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) && ( ( Mechanik->action() != TAction::actSleep ) /* || ( MoverParameters->Battery ) */ ) ) { // rysowanie figurki mechanika - btMechanik1.Turn( MoverParameters->ActiveCab > 0 ); - btMechanik2.Turn( MoverParameters->ActiveCab < 0 ); - if( MoverParameters->ActiveCab != 0 ) { + btMechanik1.Turn( MoverParameters->CabOccupied > 0 ); + btMechanik2.Turn( MoverParameters->CabOccupied < 0 ); + if( MoverParameters->CabOccupied != 0 ) { btnOn = true; } } @@ -2831,12 +2831,12 @@ bool TDynamicObject::Update(double dt, double dt1) if (MoverParameters->SpeedCtrl) MoverParameters->CheckSpeedCtrl(dt1); MoverParameters->eimic_real = std::min(MoverParameters->eimic,MoverParameters->eimicSpeedCtrl); - MoverParameters->SendCtrlToNext("EIMIC", MoverParameters->eimic_real, MoverParameters->CabNo); + MoverParameters->SendCtrlToNext("EIMIC", MoverParameters->eimic_real, MoverParameters->CabActive); } if( ( Mechanik->primary() ) && ( MoverParameters->EngineType == TEngineType::ElectricInductionMotor ) ) { // jesli glowny i z asynchronami, to niech steruje hamulcem i napedem lacznie dla calego pociagu/ezt - auto const kier = (DirectionGet() * MoverParameters->ActiveCab > 0); + auto const kier = (DirectionGet() * MoverParameters->CabOccupied > 0); auto FED { 0.0 }; auto np { 0 }; auto masa { 0.0 }; @@ -2861,7 +2861,7 @@ bool TDynamicObject::Update(double dt, double dt1) MoverParameters->eimic_real = eimic; if (MoverParameters->EIMCtrlType == 2 && MoverParameters->MainCtrlPos == 0) eimic = -1.0; - MoverParameters->SendCtrlToNext("EIMIC", Max0R(0, eimic), MoverParameters->CabNo); + MoverParameters->SendCtrlToNext("EIMIC", Max0R(0, eimic), MoverParameters->CabActive); auto LBR = Max0R(-eimic, 0); auto eim_lb = (Mechanik->AIControllFlag || !MoverParameters->LocHandleTimeTraxx ? 0 : MoverParameters->eim_localbrake); @@ -2872,7 +2872,7 @@ bool TDynamicObject::Update(double dt, double dt1) // 2. ustal mozliwa do realizacji sile hamowania ED // - w szczegolnosci powinien brac pod uwage rozne sily hamowania - for (TDynamicObject *p = GetFirstDynamic(MoverParameters->ActiveCab < 0 ? 1 : 0, 4); p; + for (TDynamicObject *p = GetFirstDynamic(MoverParameters->CabOccupied < 0 ? 1 : 0, 4); p; (kier ? p = p->NextC(4) : p = p->PrevC(4))) { ++np; @@ -2891,7 +2891,7 @@ bool TDynamicObject::Update(double dt, double dt1) Nmax / (p->MoverParameters->NAxles * p->MoverParameters->NBpA), p->MoverParameters->MED_Vref) * 1000; // sila hamowania pn - FmaxED += ((p->MoverParameters->Mains) && (p->MoverParameters->ActiveDir != 0) && + FmaxED += ((p->MoverParameters->Mains) && (p->MoverParameters->DirActive != 0) && (p->MoverParameters->eimc[eimc_p_Fh] * p->MoverParameters->NPoweredAxles > 0) ? p->MoverParameters->eimc[eimc_p_Fh] * 1000 : @@ -2997,11 +2997,11 @@ bool TDynamicObject::Update(double dt, double dt1) // 6. ustaw pojazdom sile hamowania ep // - proporcjonalnie do masy, do liczby osi, rowne cisnienia - jak // bedzie, tak bedzie dobrze - float Fpoj = 0; // MoverParameters->ActiveCab < 0 + float Fpoj = 0; // MoverParameters->CabOccupied < 0 ////ALGORYTM 2 - KAZDEMU PO ROWNO, ale nie wiecej niz eped * masa // 1. najpierw daj kazdemu tyle samo int i = 0; - for (TDynamicObject *p = GetFirstDynamic(MoverParameters->ActiveCab < 0 ? 1 : 0, 4); p; + for (TDynamicObject *p = GetFirstDynamic(MoverParameters->CabOccupied < 0 ? 1 : 0, 4); p; p = (kier == true ? p->NextC(4) : p->PrevC(4)) ) { auto const Nmax = ((p->MoverParameters->P2FTrans * p->MoverParameters->MaxBrakePress[0] - @@ -3029,7 +3029,7 @@ bool TDynamicObject::Update(double dt, double dt1) test = false; i = 0; float przek = 0; - for (TDynamicObject *p = GetFirstDynamic(MoverParameters->ActiveCab < 0 ? 1 : 0, 4); p; + for (TDynamicObject *p = GetFirstDynamic(MoverParameters->CabOccupied < 0 ? 1 : 0, 4); p; p = (kier == true ? p->NextC(4) : p->PrevC(4)) ) { if ((FzEP[i] > 0.01) && @@ -3055,7 +3055,7 @@ bool TDynamicObject::Update(double dt, double dt1) } i = 0; przek = przek / (np - nPrzekrF); - for (TDynamicObject *p = GetFirstDynamic(MoverParameters->ActiveCab < 0 ? 1 : 0, 4); p; + for (TDynamicObject *p = GetFirstDynamic(MoverParameters->CabOccupied < 0 ? 1 : 0, 4); p; (true == kier ? p = p->NextC(4) : p = p->PrevC(4))) { if (!PrzekrF[i]) @@ -3066,7 +3066,7 @@ bool TDynamicObject::Update(double dt, double dt1) } } i = 0; - for (TDynamicObject *p = GetFirstDynamic(MoverParameters->ActiveCab < 0 ? 1 : 0, 4); p; + for (TDynamicObject *p = GetFirstDynamic(MoverParameters->CabOccupied < 0 ? 1 : 0, 4); p; (true == kier ? p = p->NextC(4) : p = p->PrevC(4))) { float Nmax = ((p->MoverParameters->P2FTrans * p->MoverParameters->MaxBrakePress[0] - @@ -3119,7 +3119,7 @@ bool TDynamicObject::Update(double dt, double dt1) { MEDLogFile << MEDLogTime << "\t" << MoverParameters->Vel << "\t" << masa*0.001 << "\t" << osie << "\t" << FmaxPN*0.001 << "\t" << FmaxED*0.001 << "\t" << FfulED*0.001 << "\t" << FrED*0.001 << "\t" << Fzad*0.001 << "\t" << FzadED*0.001 << "\t" << FzadPN*0.001; - for (TDynamicObject *p = GetFirstDynamic(MoverParameters->ActiveCab < 0 ? 1 : 0, 4); p; + for (TDynamicObject *p = GetFirstDynamic(MoverParameters->CabOccupied < 0 ? 1 : 0, 4); p; (true == kier ? p = p->NextC(4) : p = p->PrevC(4))) { MEDLogFile << "\t" << p->MoverParameters->BrakePress; @@ -5978,7 +5978,7 @@ void TDynamicObject::RaLightsSet(int head, int rear) // jest tam czynna lokomotywa // EN57 może nie mieć końcówek od środka członu if (MoverParameters->Power > 1.0) // jeśli ma moc napędową - if (!MoverParameters->ActiveDir) // jeśli nie ma ustawionego kierunku + if (!MoverParameters->DirActive) // jeśli nie ma ustawionego kierunku { // jeśli ma zarówno światła jak i końcówki, ustalić, czy jest w stanie // aktywnym // np. lokomotywa na zimno będzie mieć końcówki a nie światła diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index 64092a64..3d159321 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -1351,12 +1351,11 @@ public: int ScndCtrlPos = 0; /*polozenie dodatkowego nastawnika*/ int LightsPos = 0; /*polozenie przelacznika wielopozycyjnego swiatel*/ int CompressorListPos = 0; /*polozenie przelacznika wielopozycyjnego sprezarek*/ - int ActiveDir = 0; //czy lok. jest wlaczona i w ktorym kierunku: - //względem wybranej kabiny: -1 - do tylu, +1 - do przodu, 0 - wylaczona + int DirActive = 0; //czy lok. jest wlaczona i w ktorym kierunku: względem wybranej kabiny: -1 - do tylu, +1 - do przodu, 0 - wylaczona + int DirAbsolute = 0; //zadany kierunek jazdy względem sprzęgów (1=w strone 0,-1=w stronę 1) int MaxMainCtrlPosNoDirChange { 0 }; // can't change reverser state with master controller set above this position - int CabNo = 0; //numer kabiny, z której jest sterowanie: 1 lub -1; w przeciwnym razie brak sterowania - rozrzad - int DirAbsolute = 0; //zadany kierunek jazdy względem sprzęgów (1=w strone 0,-1=w stronę 1) - int ActiveCab = 0; //numer kabiny, w ktorej jest obsada (zwykle jedna na skład) + int CabActive = 0; //numer kabiny, z której jest sterowanie: 1 lub -1; w przeciwnym razie brak sterowania - rozrzad + int CabOccupied = 0; //numer kabiny, w ktorej jest obsada (zwykle jedna na skład) // TODO: move to TController double LastSwitchingTime = 0.0; /*czas ostatniego przelaczania czegos*/ int WarningSignal = 0; // 0: nie trabi, 1,2,4: trabi bool DepartureSignal = false; /*sygnal odjazdu*/ diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 9b55fd81..f928c335 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -293,7 +293,7 @@ double TMoverParameters::Current(double n, double U) TMoverParameters::TMoverParameters(double VelInitial, std::string TypeNameInit, std::string NameInit, int Cab) : TypeName( TypeNameInit ), Name( NameInit ), -ActiveCab( Cab ) +CabOccupied( Cab ) { WriteLog( "------------------------------------------------------"); @@ -531,17 +531,17 @@ bool TMoverParameters::Dettach(int ConnectNo) bool TMoverParameters::DirectionForward() { - if ((MainCtrlPosNo > 0) && (ActiveDir < 1) && (EIMDirectionChangeAllow())) + if ((MainCtrlPosNo > 0) && (DirActive < 1) && (EIMDirectionChangeAllow())) { - ++ActiveDir; - DirAbsolute = ActiveDir * CabNo; + ++DirActive; + DirAbsolute = DirActive * CabActive; if (DirAbsolute) if (Battery) // jeśli bateria jest już załączona BatterySwitch(true); // to w ten oto durny sposób aktywuje się CA/SHP - SendCtrlToNext("Direction", ActiveDir, CabNo); + SendCtrlToNext("Direction", DirActive, CabActive); return true; } - else if ((ActiveDir == 1) && (IsMainCtrlNoPowerPos()) && (TrainType == dt_EZT) && (EngineType != TEngineType::ElectricInductionMotor)) + else if ((DirActive == 1) && (IsMainCtrlNoPowerPos()) && (TrainType == dt_EZT) && (EngineType != TEngineType::ElectricInductionMotor)) return MinCurrentSwitch(true); //"wysoki rozruch" EN57 return false; }; @@ -609,10 +609,10 @@ bool TMoverParameters::DecBrakeLevel() bool TMoverParameters::ChangeCab(int direction) { // zmiana kabiny i resetowanie ustawien - if (abs(ActiveCab + direction) < 2) + if (abs(CabOccupied + direction) < 2) { - // if (ActiveCab+direction=0) then LastCab:=ActiveCab; - ActiveCab = ActiveCab + direction; + // if (CabOccupied+direction=0) then LastCab:=CabOccupied; + CabOccupied = CabOccupied + direction; if( ( BrakeCtrlPosNo > 0 ) && ( ( BrakeSystem == TBrakeSystem::Pneumatic ) || ( BrakeSystem == TBrakeSystem::ElectroPneumatic ) ) ) { @@ -643,7 +643,7 @@ bool TMoverParameters::ChangeCab(int direction) // CompressorAllow=false; // ConverterAllow=false; //} - // ActiveDir=0; + // DirActive=0; // DirAbsolute=0; return true; } @@ -662,7 +662,7 @@ TMoverParameters::CurrentSwitch(bool const State) { // dla 2Ls150 if( ( EngineType == TEngineType::DieselEngine ) && ( true == ShuntModeAllow ) - && ( ActiveDir == 0 ) ) { + && ( DirActive == 0 ) ) { // przed ustawieniem kierunku ShuntMode = State; return true; @@ -1312,7 +1312,7 @@ double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShap auto const d { ( EngineType == TEngineType::WheelsDriven ? - dL * CabNo : // na chwile dla testu + dL * CabActive : // na chwile dla testu dL ) }; DistCounter += fabs(dL) / 1000.0; @@ -1387,7 +1387,7 @@ double TMoverParameters::FastComputeMovement(double dt, const TTrackShape &Shape auto const d { ( EngineType == TEngineType::WheelsDriven ? - dL * CabNo : // na chwile dla testu + dL * CabActive : // na chwile dla testu dL ) }; DistCounter += fabs(dL) / 1000.0; @@ -1905,7 +1905,7 @@ bool TMoverParameters::IncMainCtrl(int CtrlSpeed) { // basic fail conditions: if( ( MainCtrlPosNo <= 0 ) - || ( CabNo == 0 ) ) { + || ( CabActive == 0 ) ) { // nie ma sterowania return false; } @@ -1913,7 +1913,7 @@ bool TMoverParameters::IncMainCtrl(int CtrlSpeed) // w ET22 nie da się kręcić nastawnikiem przy włączonym boczniku return false; } - if( ( TrainType == dt_EZT ) && ( ActiveDir == 0 ) ) { + if( ( TrainType == dt_EZT ) && ( DirActive == 0 ) ) { // w EZT nie da się załączyć pozycji bez ustawienia kierunku return false; } @@ -1945,7 +1945,7 @@ bool TMoverParameters::IncMainCtrl(int CtrlSpeed) case TEngineType::ElectricSeriesMotor: { - if( ActiveDir == 0 ) { return false; } + if( DirActive == 0 ) { return false; } if( CtrlSpeed > 1 ) { // szybkie przejœcie na bezoporow¹ @@ -2039,8 +2039,8 @@ bool TMoverParameters::IncMainCtrl(int CtrlSpeed) if( true == OK ) { - SendCtrlToNext("MainCtrl", MainCtrlPos, CabNo); //??? - SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabNo); + SendCtrlToNext("MainCtrl", MainCtrlPos, CabActive); //??? + SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabActive); } // hunter-101012: poprawka @@ -2070,7 +2070,7 @@ bool TMoverParameters::DecMainCtrl(int CtrlSpeed) bool OK = false; // basic fail conditions: if( ( MainCtrlPosNo <= 0 ) - || ( CabNo == 0 ) ) { + || ( CabActive == 0 ) ) { // nie ma sterowania OK = false; } @@ -2160,8 +2160,8 @@ bool TMoverParameters::DecMainCtrl(int CtrlSpeed) if (OK) { - /*OK:=*/SendCtrlToNext("MainCtrl", MainCtrlPos, CabNo); // hmmmm...???!!! - /*OK:=*/SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabNo); + /*OK:=*/SendCtrlToNext("MainCtrl", MainCtrlPos, CabActive); // hmmmm...???!!! + /*OK:=*/SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabActive); } } // if OK then LastRelayTime:=0; @@ -2206,11 +2206,11 @@ bool TMoverParameters::IncScndCtrl(int CtrlSpeed) { bool OK = false; - if ((IsMainCtrlNoPowerPos()) && (CabNo != 0) && (TrainType == dt_ET42) && (ScndCtrlPos == 0) && (DynamicBrakeFlag)) + if ((IsMainCtrlNoPowerPos()) && (CabActive != 0) && (TrainType == dt_ET42) && (ScndCtrlPos == 0) && (DynamicBrakeFlag)) { OK = DynamicBrakeSwitch(false); } - else if ((ScndCtrlPosNo > 0) && (CabNo != 0) && + else if ((ScndCtrlPosNo > 0) && (CabActive != 0) && !((TrainType == dt_ET42) && ((Imax == ImaxHi) || ((DynamicBrakeFlag) && (MainCtrlPowerPos() > 0))))) { @@ -2233,8 +2233,8 @@ bool TMoverParameters::IncScndCtrl(int CtrlSpeed) OK = false; if (OK) { - /*OK:=*/SendCtrlToNext("MainCtrl", MainCtrlPos, CabNo); //??? - /*OK:=*/SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabNo); + /*OK:=*/SendCtrlToNext("MainCtrl", MainCtrlPos, CabActive); //??? + /*OK:=*/SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabActive); } } @@ -2274,13 +2274,13 @@ bool TMoverParameters::DecScndCtrl(int CtrlSpeed) { bool OK = false; - if ((IsMainCtrlNoPowerPos()) && (CabNo != 0) && (TrainType == dt_ET42) && (ScndCtrlPos == 0) && + if ((IsMainCtrlNoPowerPos()) && (CabActive != 0) && (TrainType == dt_ET42) && (ScndCtrlPos == 0) && !(DynamicBrakeFlag) && (CtrlSpeed == 1)) { // Ra: AI wywołuje z CtrlSpeed=2 albo gdy ScndCtrlPos>0 OK = DynamicBrakeSwitch(true); } - else if ((ScndCtrlPosNo > 0) && (CabNo != 0)) + else if ((ScndCtrlPosNo > 0) && (CabActive != 0)) { if ((ScndCtrlPos > 0) && (!CoupledCtrl) && ((EngineType != TEngineType::DieselElectric) || (!AutoRelayFlag))) @@ -2299,8 +2299,8 @@ bool TMoverParameters::DecScndCtrl(int CtrlSpeed) OK = false; if (OK) { - /*OK:=*/SendCtrlToNext("MainCtrl", MainCtrlPos, CabNo); //??? - /*OK:=*/SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabNo); + /*OK:=*/SendCtrlToNext("MainCtrl", MainCtrlPos, CabActive); //??? + /*OK:=*/SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabActive); } } else @@ -2340,13 +2340,13 @@ bool TMoverParameters::CabActivisation( bool const Force ) { bool OK = false; - OK = Force || (CabNo == 0); // numer kabiny, z której jest sterowanie + OK = Force || (CabActive == 0); // numer kabiny, z której jest sterowanie if (OK) { - CabNo = ActiveCab; // sterowanie jest z kabiny z obsadą - DirAbsolute = ActiveDir * CabNo; + CabActive = CabOccupied; // sterowanie jest z kabiny z obsadą + DirAbsolute = DirActive * CabActive; SecuritySystem.Status |= s_waiting; // activate the alerter TODO: make it part of control based cab selection - SendCtrlToNext("CabActivisation", 1, CabNo); + SendCtrlToNext("CabActivisation", 1, CabActive); } return OK; } @@ -2359,15 +2359,15 @@ bool TMoverParameters::CabDeactivisation( bool const Force ) { bool OK = false; - OK = Force || (CabNo == ActiveCab); // o ile obsada jest w kabinie ze sterowaniem + OK = Force || (CabActive == CabOccupied); // o ile obsada jest w kabinie ze sterowaniem if (OK) { - CabNo = 0; - DirAbsolute = ActiveDir * CabNo; + CabActive = 0; + DirAbsolute = DirActive * CabActive; DepartureSignal = false; // nie buczeć z nieaktywnej kabiny SecuritySystem.Status = s_off; // deactivate alerter TODO: make it part of control based cab selection - SendCtrlToNext("CabActivisation", 0, ActiveCab); // CabNo==0! + SendCtrlToNext("CabActivisation", 0, CabOccupied); // CabActive==0! } return OK; } @@ -2382,8 +2382,8 @@ bool TMoverParameters::AddPulseForce(int Multipler) if ((EngineType == TEngineType::WheelsDriven) && (EnginePowerSource.SourceType == TPowerSource::InternalSource) && (EnginePowerSource.PowerType == TPowerType::BioPower)) { - ActiveDir = CabNo; - DirAbsolute = ActiveDir * CabNo; + DirActive = CabActive; + DirAbsolute = DirActive * CabActive; if (Vel > 0) PulseForce = Min0R(1000.0 * Power / (abs(V) + 0.1), Ftmax); else @@ -2489,11 +2489,11 @@ bool TMoverParameters::Sandbox( bool const State, range_t const Notify ) if( State == true ) { // switch on - SendCtrlToNext( "Sandbox", 1, CabNo, couplingtype ); + SendCtrlToNext( "Sandbox", 1, CabActive, couplingtype ); } else { // switch off - SendCtrlToNext( "Sandbox", 0, CabNo, couplingtype ); + SendCtrlToNext( "Sandbox", 0, CabActive, couplingtype ); } } @@ -2506,7 +2506,7 @@ bool TMoverParameters::Sandbox( bool const State, range_t const Notify ) // ************************************************************************************************* bool TMoverParameters::SandboxAutoAllow(bool State) { - //SendCtrlToNext("SandboxAutoAllow", int(State), CabNo, ctrain_controll); + //SendCtrlToNext("SandboxAutoAllow", int(State), CabActive, ctrain_controll); if (SandDoseAutoAllow != State) { @@ -2558,7 +2558,7 @@ bool TMoverParameters::SecuritySystemReset(void) // zbijanie czuwaka/SHP { SSR = true; if ((TrainType == dt_EZT) || - (ActiveDir != 0)) // Ra 2014-03: w EZT nie trzeba ustawiać kierunku + (DirActive != 0)) // Ra 2014-03: w EZT nie trzeba ustawiać kierunku if (!TestFlag(SecuritySystem.Status, s_CAebrake) || !TestFlag(SecuritySystem.Status, s_SHPebrake)) SSReset(); @@ -2568,7 +2568,7 @@ bool TMoverParameters::SecuritySystemReset(void) // zbijanie czuwaka/SHP } else SSR = false; - // SendCtrlToNext('SecurityReset',0,CabNo); + // SendCtrlToNext('SecurityReset',0,CabActive); return SSR; } @@ -2592,7 +2592,7 @@ void TMoverParameters::SecuritySystemCheck(double dt) if( ( false == ShuntMode ) // TBD, TODO: check if alerter inactivity in shunt mode is general rule or vehicle specific, may need a config flag && ( SecuritySystem.AwareMinSpeed > 0.0 ? ( Vel >= SecuritySystem.AwareMinSpeed ) : - ( ActiveDir != 0 ) ) ) { + ( DirActive != 0 ) ) ) { // domyślnie predkość większa od 10% Vmax, albo podanej jawnie w FIZ // with defined minspeed of 0 the alerter will activate with reverser out of neutral position // this emulates behaviour of engines like SM42 @@ -2672,12 +2672,12 @@ bool TMoverParameters::BatterySwitch(bool State) Battery = State; } if (Battery == true) - SendCtrlToNext("BatterySwitch", 1, CabNo); + SendCtrlToNext("BatterySwitch", 1, CabActive); else - SendCtrlToNext("BatterySwitch", 0, CabNo); + SendCtrlToNext("BatterySwitch", 0, CabActive); BS = true; - if ((Battery) && (ActiveCab != 0)) + if ((Battery) && (CabOccupied != 0)) SecuritySystem.Status |= s_waiting; // aktywacja czuwaka else SecuritySystem.Status = 0; // wyłączenie czuwaka @@ -2698,8 +2698,8 @@ bool TMoverParameters::EpFuseSwitch(bool State) } else return false; - // if (EpFuse == true) SendCtrlToNext("EpFuseSwitch", 1, CabNo) - // else SendCtrlToNext("EpFuseSwitch", 0, CabNo); + // if (EpFuse == true) SendCtrlToNext("EpFuseSwitch", 1, CabActive) + // else SendCtrlToNext("EpFuseSwitch", 0, CabActive); } // ************************************************************************************************* @@ -2710,7 +2710,7 @@ bool TMoverParameters::SpringBrakeActivate(bool State) { if (Battery) { - SendCtrlToNext("SpringBrakeActivate", int(State), CabNo, SpringBrake.MultiTractionCoupler); + SendCtrlToNext("SpringBrakeActivate", int(State), CabActive, SpringBrake.MultiTractionCoupler); if (SpringBrake.Activate != State) { @@ -2760,24 +2760,24 @@ bool TMoverParameters::SpringBrakeRelease() bool TMoverParameters::DirectionBackward(void) { bool DB = false; - if ((ActiveDir == 1) && (MainCtrlPos == 0) && (TrainType == dt_EZT) && (EngineType != TEngineType::ElectricInductionMotor)) + if ((DirActive == 1) && (MainCtrlPos == 0) && (TrainType == dt_EZT) && (EngineType != TEngineType::ElectricInductionMotor)) if (MinCurrentSwitch(false)) { DB = true; // return DB; // exit; TODO: czy dobrze przetlumaczone? } - if ((MainCtrlPosNo > 0) && (ActiveDir > -1) && (EIMDirectionChangeAllow())) + if ((MainCtrlPosNo > 0) && (DirActive > -1) && (EIMDirectionChangeAllow())) { if (EngineType == TEngineType::WheelsDriven) - CabNo--; + CabActive--; // else - ActiveDir--; - DirAbsolute = ActiveDir * CabNo; + DirActive--; + DirAbsolute = DirActive * CabActive; if (DirAbsolute != 0) if (Battery) // jeśli bateria jest już załączona BatterySwitch(true); // to w ten oto durny sposób aktywuje się CA/SHP DB = true; - SendCtrlToNext("Direction", ActiveDir, CabNo); + SendCtrlToNext("Direction", DirActive, CabActive); } else DB = false; @@ -2821,7 +2821,7 @@ bool TMoverParameters::WaterPumpBreakerSwitch( bool State, range_t const Notify SendCtrlToNext( "WaterPumpBreakerSwitch", ( WaterPump.breaker ? 1 : 0 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -2846,7 +2846,7 @@ bool TMoverParameters::WaterPumpSwitch( bool State, range_t const Notify ) { SendCtrlToNext( "WaterPumpSwitch", ( WaterPump.is_enabled ? 1 : 0 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -2871,7 +2871,7 @@ bool TMoverParameters::WaterPumpSwitchOff( bool State, range_t const Notify ) { SendCtrlToNext( "WaterPumpSwitchOff", ( WaterPump.is_disabled ? 1 : 0 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -2896,7 +2896,7 @@ bool TMoverParameters::WaterHeaterBreakerSwitch( bool State, range_t const Notif SendCtrlToNext( "WaterHeaterBreakerSwitch", ( WaterHeater.breaker ? 1 : 0 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -2921,7 +2921,7 @@ bool TMoverParameters::WaterHeaterSwitch( bool State, range_t const Notify ) { SendCtrlToNext( "WaterHeaterSwitch", ( WaterHeater.is_enabled ? 1 : 0 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -2946,7 +2946,7 @@ bool TMoverParameters::WaterCircuitsLinkSwitch( bool State, range_t const Notify SendCtrlToNext( "WaterCircuitsLinkSwitch", ( WaterCircuitsLink ? 1 : 0 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -2971,7 +2971,7 @@ bool TMoverParameters::FuelPumpSwitch( bool State, range_t const Notify ) { SendCtrlToNext( "FuelPumpSwitch", ( FuelPump.is_enabled ? 1 : 0 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -2995,7 +2995,7 @@ bool TMoverParameters::FuelPumpSwitchOff( bool State, range_t const Notify ) { SendCtrlToNext( "FuelPumpSwitchOff", ( FuelPump.is_disabled ? 1 : 0 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -3020,7 +3020,7 @@ bool TMoverParameters::OilPumpSwitch( bool State, range_t const Notify ) { SendCtrlToNext( "OilPumpSwitch", ( OilPump.is_enabled ? 1 : 0 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -3044,7 +3044,7 @@ bool TMoverParameters::OilPumpSwitchOff( bool State, range_t const Notify ) { SendCtrlToNext( "OilPumpSwitchOff", ( OilPump.is_disabled ? 1 : 0 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -3071,7 +3071,7 @@ bool TMoverParameters::MotorBlowersSwitch( bool State, end const Side, range_t c SendCtrlToNext( ( Side == end::front ? "MotorBlowersFrontSwitch" : "MotorBlowersRearSwitch" ), ( fan.is_enabled ? 1 : 0 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -3098,7 +3098,7 @@ bool TMoverParameters::MotorBlowersSwitchOff( bool State, end const Side, range_ SendCtrlToNext( ( Side == end::front ? "MotorBlowersFrontSwitchOff" : "MotorBlowersRearSwitchOff" ), ( fan.is_disabled ? 1 : 0 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -3123,7 +3123,7 @@ bool TMoverParameters::MainSwitch( bool const State, range_t const Notify ) { SendCtrlToNext( "MainSwitch", ( State ? 1 : 0 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -3198,7 +3198,7 @@ bool TMoverParameters::ConverterSwitch( bool State, range_t const Notify ) if( ConverterAllow == true ) { if( Notify != range_t::local ) { SendCtrlToNext( - "ConverterSwitch", 1, CabNo, + "ConverterSwitch", 1, CabActive, ( Notify == range_t::unit ? ctrain_controll | ctrain_depot : ctrain_controll ) ); @@ -3207,7 +3207,7 @@ bool TMoverParameters::ConverterSwitch( bool State, range_t const Notify ) else { if( Notify != range_t::local ) { SendCtrlToNext( - "ConverterSwitch", 0, CabNo, + "ConverterSwitch", 0, CabActive, ( Notify == range_t::unit ? ctrain_controll | ctrain_depot : ctrain_controll ) ); @@ -3237,7 +3237,7 @@ bool TMoverParameters::CompressorSwitch( bool State, range_t const Notify ) if( CompressorAllow == true ) { if( Notify != range_t::local ) { SendCtrlToNext( - "CompressorSwitch", 1, CabNo, + "CompressorSwitch", 1, CabActive, ( Notify == range_t::unit ? ctrain_controll | ctrain_depot : ctrain_controll ) ); @@ -3246,7 +3246,7 @@ bool TMoverParameters::CompressorSwitch( bool State, range_t const Notify ) else { if( Notify != range_t::local ) { SendCtrlToNext( - "CompressorSwitch", 0, CabNo, + "CompressorSwitch", 0, CabActive, ( Notify == range_t::unit ? ctrain_controll | ctrain_depot : ctrain_controll ) ); @@ -3489,8 +3489,8 @@ bool TMoverParameters::BrakeReleaser(int state) { bool OK = true; //false tylko jeśli nie uda się wysłać, GF 20161124 Hamulec->Releaser(state); - if (CabNo != 0) // rekurencyjne wysłanie do następnego - OK = SendCtrlToNext("BrakeReleaser", state, CabNo); + if (CabActive != 0) // rekurencyjne wysłanie do następnego + OK = SendCtrlToNext("BrakeReleaser", state, CabActive); return OK; } @@ -3519,8 +3519,8 @@ bool TMoverParameters::UniversalBrakeButton(int button, int state) TUniversalBrake::ub_Release ) ) { Hamulec->Releaser( int ( TestFlag ( flag, TUniversalBrake::ub_Release ) )); - if (CabNo != 0) // rekurencyjne wysłanie do następnego - OK = SendCtrlToNext("BrakeReleaser", state, CabNo); + if (CabActive != 0) // rekurencyjne wysłanie do następnego + OK = SendCtrlToNext("BrakeReleaser", state, CabActive); } return OK; } @@ -3535,17 +3535,17 @@ bool TMoverParameters::SwitchEPBrake(int state) double temp; OK = false; - if ((BrakeHandle == TBrakeHandle::St113) && (ActiveCab != 0)) + if ((BrakeHandle == TBrakeHandle::St113) && (CabOccupied != 0)) { if (state > 0) temp = Handle->GetCP(); // TODO: przetlumaczyc else temp = 0; Hamulec->SetEPS(temp); - SendCtrlToNext("Brake", temp, CabNo); + SendCtrlToNext("Brake", temp, CabActive); } // OK:=SetFlag(BrakeStatus,((2*State-1)*b_epused)); - // SendCtrlToNext('Brake',(state*(2*BrakeCtrlPos-1)),CabNo); + // SendCtrlToNext('Brake',(state*(2*BrakeCtrlPos-1)),CabActive); return OK; } @@ -3621,8 +3621,8 @@ bool TMoverParameters::BrakeDelaySwitch(int BDS) rBDS = true; Hamulec->SetBrakeStatus( Hamulec->GetBrakeStatus() & ~64 ); // kopowanie nastawy hamulca do kolejnego czlonu - do przemyślenia - if (CabNo != 0) - SendCtrlToNext("BrakeDelay", BrakeDelayFlag, CabNo); + if (CabActive != 0) + SendCtrlToNext("BrakeDelay", BrakeDelayFlag, CabActive); } else rBDS = false; @@ -4005,7 +4005,7 @@ void TMoverParameters::UpdatePipePressure(double dt) Handle->SetReductor(BrakeCtrlPos2); if( ( ( BrakeOpModes & bom_PS ) == 0 ) - || ( ( ActiveCab != 0 ) + || ( ( CabOccupied != 0 ) && ( BrakeOpModeFlag != bom_PS ) ) ) { if( ( BrakeOpModeFlag < bom_EP ) @@ -4170,10 +4170,10 @@ void TMoverParameters::UpdatePipePressure(double dt) } } // switch - if (((BrakeHandle == TBrakeHandle::FVel6)||(BrakeHandle == TBrakeHandle::FVE408)) && (ActiveCab != 0)) + if (((BrakeHandle == TBrakeHandle::FVel6)||(BrakeHandle == TBrakeHandle::FVE408)) && (CabOccupied != 0)) { if ((Battery) - && (ActiveDir != 0) + && (DirActive != 0) && (EpFuse)) // tu powinien byc jeszcze bezpiecznik EP i baterie - // temp = (Handle as TFVel6).GetCP temp = Handle->GetCP(); @@ -4190,7 +4190,7 @@ void TMoverParameters::UpdatePipePressure(double dt) TUHEX_StageActual = temp; TUHEX_Active = TUHEX_StageActual > 0; // Ra 2014-11: na tym się wysypuje, ale nie wiem, w jakich warunkach - SendCtrlToNext("Brake", temp, CabNo); + SendCtrlToNext("Brake", temp, CabActive); } Pipe->Act(); @@ -4472,7 +4472,7 @@ void TMoverParameters::ComputeTotalForce(double dt) { // ABu 300105: cos tu mieszalem , dziala teraz troche lepiej, wiec zostawiam { auto const vehicleisactive { - ( CabNo != 0 ) + ( CabActive != 0 ) || ( Vel > 0.0001 ) || ( std::abs( AccS ) > 0.0001 ) || ( LastSwitchingTime < 5 ) @@ -4528,11 +4528,11 @@ void TMoverParameters::ComputeTotalForce(double dt) { GetAnyTrainsetVoltage(), PantographVoltage ) : 0.00 ); - if( CabNo == 0 ) { - EngineVoltage *= ActiveDir; + if( CabActive == 0 ) { + EngineVoltage *= DirActive; } else { - EngineVoltage *= DirAbsolute; // ActiveDir*CabNo; + EngineVoltage *= DirAbsolute; // DirActive*CabActive; } } // bo nie dzialalo else { @@ -4978,7 +4978,7 @@ double TMoverParameters::TractionForce( double dt ) { else dtrans = Transmision.Ratio * MotorParam[ ScndCtrlActualPos ].mIsat; - dmoment = dizel_Momentum( dizel_fill, dtrans * nrot * ActiveDir, dt ); // oblicza tez enrot + dmoment = dizel_Momentum( dizel_fill, dtrans * nrot * DirActive, dt ); // oblicza tez enrot break; } default: { @@ -4995,7 +4995,7 @@ double TMoverParameters::TractionForce( double dt ) { // eAngle = Pirazy2 - eAngle; <- ABu: a nie czasem tak, jak nizej? eAngle -= M_PI * 2.0; */ - // hunter-091012: przeniesione z if ActiveDir<>0 (zeby po zejsciu z kierunku dalej spadala predkosc wentylatorow) + // hunter-091012: przeniesione z if DirActive<>0 (zeby po zejsciu z kierunku dalej spadala predkosc wentylatorow) // wentylatory rozruchowe // TBD, TODO: move this to update, it doesn't exactly have much to do with traction switch( EngineType ) { @@ -5006,7 +5006,7 @@ double TMoverParameters::TractionForce( double dt ) { case 1: { // manual if( ( true == RVentForceOn ) - || ( ( ActiveDir != 0 ) + || ( ( DirActive != 0 ) && ( RList[ MainCtrlActualPos ].R > RVentCutOff ) ) ) { RventRot += ( RVentnmax - RventRot ) * RVentSpeed * dt; } @@ -5152,12 +5152,12 @@ double TMoverParameters::TractionForce( double dt ) { } } - if (ActiveDir != 0) + if (DirActive != 0) switch (EngineType) { case TEngineType::Dumb: { - if (Mains && (CabNo != 0)) + if (Mains && (CabActive != 0)) { if (Vel > 0.1) { @@ -5166,7 +5166,7 @@ double TMoverParameters::TractionForce( double dt ) { else { Ft = Ftmax * PosRatio; } - Ft = Ft * DirAbsolute; // ActiveDir*CabNo; + Ft = Ft * DirAbsolute; // DirActive*CabActive; } else { Ft = 0; @@ -5285,14 +5285,14 @@ double TMoverParameters::TractionForce( double dt ) { Mw -= dizel_MomentumRetarder(nrot * Transmision.Ratio, dt) * Transmision.Ratio * Transmision.Efficiency; Fw = Mw * 2.0 / WheelDiameter / NPoweredAxles; Ft = Fw * NPoweredAxles; // sila trakcyjna - Ft = Ft * DirAbsolute; // ActiveDir*CabNo; + Ft = Ft * DirAbsolute; // DirActive*CabActive; break; } case TEngineType::DieselElectric: // youBy { - // tmpV:=V*CabNo*ActiveDir; - auto const tmpV { nrot * Pirazy2 * 0.5 * WheelDiameter * DirAbsolute }; //*CabNo*ActiveDir; + // tmpV:=V*CabActive*DirActive; + auto const tmpV { nrot * Pirazy2 * 0.5 * WheelDiameter * DirAbsolute }; //*CabActive*DirActive; // jazda manewrowa if( true == ShuntMode ) { if( ( true == Mains ) && ( MainCtrlPowerPos() > 0 ) ) { @@ -5352,7 +5352,7 @@ double TMoverParameters::TractionForce( double dt ) { if (FuseFlag) Ft = 0; else - Ft = Ft * DirAbsolute; // ActiveDir * CabNo; //zwrot sily i jej wartosc + Ft = Ft * DirAbsolute; // DirActive * CabActive; //zwrot sily i jej wartosc Fw = Ft / NPoweredAxles; // sila na obwodzie kola Mw = Fw * WheelDiameter / 2.0; // moment na osi kola Mm = Mw / Transmision.Ratio; // moment silnika trakcyjnego @@ -5649,7 +5649,7 @@ double TMoverParameters::TractionForce( double dt ) { if (NewSCAP != SpeedCtrlValue) { SpeedCtrlValue = NewSCAP; -// SendCtrlToNext("SpeedCntrl", SpeedCtrlValue, CabNo); +// SendCtrlToNext("SpeedCntrl", SpeedCtrlValue, CabActive); } } } @@ -5812,7 +5812,7 @@ double TMoverParameters::TractionForce( double dt ) { eimv[eimv_If] = eimv[eimv_Ic] * eimc[eimc_s_icif]; eimv[eimv_M] = eimv[eimv_pole] * eimv[eimv_Ic] * eimc[eimc_s_cim]; eimv[eimv_Ipoj] = (eimv[eimv_Ic] * NPoweredAxles * eimv[eimv_U]) / (EngineVoltage - eimc[eimc_f_DU]) + eimc[eimc_f_I0]; - eimv[eimv_Pm] = ActiveDir * eimv[eimv_M] * NPoweredAxles * enrot * Pirazy2 / 1000; + eimv[eimv_Pm] = DirActive * eimv[eimv_M] * NPoweredAxles * enrot * Pirazy2 / 1000; eimv[eimv_Pe] = eimv[eimv_Ipoj] * EngineVoltage / 1000; eimv[eimv_eta] = eimv[eimv_Pm] / eimv[eimv_Pe]; @@ -5947,7 +5947,7 @@ bool TMoverParameters::FuseOn(void) if ((IsMainCtrlNoPowerPos()) && (ScndCtrlPos == 0) && (TrainType != dt_ET40) && ((Mains) || (TrainType != dt_EZT)) && (!TestFlag(EngDmgFlag, 1))) { // w ET40 jest blokada nastawnika, ale czy działa dobrze? - SendCtrlToNext("FuseSwitch", 1, CabNo); + SendCtrlToNext("FuseSwitch", 1, CabActive); if (((EngineType == TEngineType::ElectricSeriesMotor) || ((EngineType == TEngineType::DieselElectric))) && FuseFlag) { FuseFlag = false; // wlaczenie ponowne obwodu @@ -6040,7 +6040,7 @@ double TMoverParameters::MomentumF(double I, double Iw, int SCP) bool TMoverParameters::CutOffEngine(void) { bool COE = false; // Ra: wartość domyślna, sprawdzić to trzeba - if ((NPoweredAxles > 0) && (CabNo == 0) && (EngineType == TEngineType::ElectricSeriesMotor)) + if ((NPoweredAxles > 0) && (CabActive == 0) && (EngineType == TEngineType::ElectricSeriesMotor)) { if (SetFlag(DamageFlag, -dtrain_engine)) { @@ -6066,8 +6066,8 @@ bool TMoverParameters::MaxCurrentSwitch(bool State) { Imax = ImaxHi; MCS = true; - if (CabNo != 0) - SendCtrlToNext("MaxCurrentSwitch", 1, CabNo); + if (CabActive != 0) + SendCtrlToNext("MaxCurrentSwitch", 1, CabActive); } if (!State) if (Imax == ImaxHi) @@ -6075,8 +6075,8 @@ bool TMoverParameters::MaxCurrentSwitch(bool State) { Imax = ImaxLo; MCS = true; - if (CabNo != 0) - SendCtrlToNext("MaxCurrentSwitch", 0, CabNo); + if (CabActive != 0) + SendCtrlToNext("MaxCurrentSwitch", 0, CabActive); } } return MCS; @@ -6096,15 +6096,15 @@ bool TMoverParameters::MinCurrentSwitch(bool State) { Imin = IminHi; MCS = true; - if (CabNo != 0) - SendCtrlToNext("MinCurrentSwitch", 1, CabNo); + if (CabActive != 0) + SendCtrlToNext("MinCurrentSwitch", 1, CabActive); } if ((!State) && (Imin == IminHi)) { Imin = IminLo; MCS = true; - if (CabNo != 0) - SendCtrlToNext("MinCurrentSwitch", 0, CabNo); + if (CabActive != 0) + SendCtrlToNext("MinCurrentSwitch", 0, CabActive); } } return MCS; @@ -6141,7 +6141,7 @@ bool TMoverParameters::AutoRelaySwitch(bool State) { AutoRelayFlag = State; ARS = true; - SendCtrlToNext("AutoRelaySwitch", int(State), CabNo); + SendCtrlToNext("AutoRelaySwitch", int(State), CabActive); } else ARS = false; @@ -6218,7 +6218,7 @@ bool TMoverParameters::AutoRelayCheck(void) } else { // zmieniaj mainctrlactualpos - if ((ActiveDir < 0) && (TrainType != dt_PseudoDiesel)) + if ((DirActive < 0) && (TrainType != dt_PseudoDiesel)) if (RList[MainCtrlActualPos + 1].Bn > 1) { return false; // nie poprawiamy przy konwersji @@ -6433,7 +6433,7 @@ bool TMoverParameters::MotorConnectorsCheck() { || ( true == FuseFlag ) || ( true == StLinSwitchOff ) || ( IsMainCtrlNoPowerPos() ) - || ( ActiveDir == 0 ) }; + || ( DirActive == 0 ) }; if( connectorsoff ) { return false; } @@ -6463,7 +6463,7 @@ bool TMoverParameters::PantFront( bool const State, range_t const Notify ) if( Notify != range_t::local ) { // wysłanie wyłączenia do pozostałych? SendCtrlToNext( - "PantFront", 1, CabNo, + "PantFront", 1, CabActive, ( Notify == range_t::unit ? ctrain_controll | ctrain_depot : ctrain_controll ) ); @@ -6473,7 +6473,7 @@ bool TMoverParameters::PantFront( bool const State, range_t const Notify ) if( Notify != range_t::local ) { // wysłanie wyłączenia do pozostałych? SendCtrlToNext( - "PantFront", 0, CabNo, + "PantFront", 0, CabActive, ( Notify == range_t::unit ? ctrain_controll | ctrain_depot : ctrain_controll ) ); @@ -6491,7 +6491,7 @@ bool TMoverParameters::PantFront( bool const State, range_t const Notify ) 0 ); PantFrontUp = false; if( true == Multiunitcontrol ) { - SendCtrlToNext( "PantFront", 0, CabNo ); + SendCtrlToNext( "PantFront", 0, CabActive ); } } */ @@ -6514,7 +6514,7 @@ bool TMoverParameters::PantRear( bool const State, range_t const Notify ) if( Notify != range_t::local ) { // wysłanie wyłączenia do pozostałych? SendCtrlToNext( - "PantRear", 1, CabNo, + "PantRear", 1, CabActive, ( Notify == range_t::unit ? ctrain_controll | ctrain_depot : ctrain_controll ) ); @@ -6524,7 +6524,7 @@ bool TMoverParameters::PantRear( bool const State, range_t const Notify ) if( Notify != range_t::local ) { // wysłanie wyłączenia do pozostałych? SendCtrlToNext( - "PantRear", 0, CabNo, + "PantRear", 0, CabActive, ( Notify == range_t::unit ? ctrain_controll | ctrain_depot : ctrain_controll ) ); @@ -6542,7 +6542,7 @@ bool TMoverParameters::PantRear( bool const State, range_t const Notify ) 0 ); PantRearUp = false; if( true == Multiunitcontrol ) { - SendCtrlToNext( "PantRear", 0, CabNo ); + SendCtrlToNext( "PantRear", 0, CabActive ); } } */ @@ -6744,7 +6744,7 @@ void TMoverParameters::CheckSpeedCtrl(double dt) eimicSpeedCtrlIntegral = 0; } SpeedCtrlUnit.Parking = (Vel == 0.0) && (eimic <= 0) && (EngineType != TEngineType::ElectricInductionMotor); - SendCtrlToNext("SpeedCtrlUnit.Parking", SpeedCtrlUnit.Parking, CabNo); + SendCtrlToNext("SpeedCtrlUnit.Parking", SpeedCtrlUnit.Parking, CabActive); } else { @@ -7155,8 +7155,8 @@ double TMoverParameters::dizel_Momentum(double dizel_fill, double n, double dt) { // liczy moment sily wytwarzany przez silnik spalinowy} double Moment = 0, enMoment = 0, gearMoment = 0, eps = 0, newn = 0, friction = 0, neps = 0; double TorqueH = 0, TorqueL = 0, TorqueC = 0; - n = n * CabNo; - if ((MotorParam[ScndCtrlActualPos].mIsat < 0.001)||(ActiveDir == 0)) + n = n * CabActive; + if ((MotorParam[ScndCtrlActualPos].mIsat < 0.001)||(DirActive == 0)) n = enrot; friction = dizel_engagefriction; hydro_TC_nIn = enrot; //wal wejsciowy przetwornika momentu @@ -7669,8 +7669,8 @@ bool TMoverParameters::ChangeDoorPermitPreset( int const Change, range_t const N auto const permitleft { ( ( doors & 1 ) != 0 ) }; auto const permitright { ( ( doors & 2 ) != 0 ) }; - PermitDoors( ( CabNo > 0 ? side::left : side::right ), permitleft, Notify ); - PermitDoors( ( CabNo > 0 ? side::right : side::left ), permitright, Notify ); + PermitDoors( ( CabActive > 0 ? side::left : side::right ), permitleft, Notify ); + PermitDoors( ( CabActive > 0 ? side::right : side::left ), permitright, Notify ); } return ( Doors.permit_preset != initialstate ); @@ -7688,7 +7688,7 @@ bool TMoverParameters::PermitDoorStep( bool const State, range_t const Notify ) ( State == true ? 1 : 0 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -7708,10 +7708,10 @@ bool TMoverParameters::PermitDoors( side const Door, bool const State, range_t c SendCtrlToNext( "DoorPermit", ( State ? 1 : -1 ) // positive: grant, negative: revoke - * ( Door == ( CabNo > 0 ? side::left : side::right ) ? // 1=lewe, 2=prawe (swap if reversed) + * ( Door == ( CabActive > 0 ? side::left : side::right ) ? // 1=lewe, 2=prawe (swap if reversed) 1 : 2 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -7732,7 +7732,7 @@ bool TMoverParameters::ChangeDoorControlMode( bool const State, range_t const No ( State == true ? 1 : 0 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -7787,10 +7787,10 @@ bool TMoverParameters::OperateDoors( side const Door, bool const State, range_t ( State == true ? "DoorOpen" : "DoorClose" ), - ( Door == ( CabNo > 0 ? side::left : side::right ) ? // 1=lewe, 2=prawe (swap if reversed) + ( Door == ( CabActive > 0 ? side::left : side::right ) ? // 1=lewe, 2=prawe (swap if reversed) 1 : 2 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -7812,7 +7812,7 @@ bool TMoverParameters::LockDoors( bool const State, range_t const Notify ) { ( State == true ? 1 : 0 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -7838,7 +7838,7 @@ TMoverParameters::signal_departure( bool const State, range_t const Notify ) { ( State == true ? 1 : 0 ), - CabNo, + CabActive, ( Notify == range_t::unit ? coupling::control | coupling::permanent : coupling::control ) ); @@ -10615,7 +10615,7 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir) PipePress = CntrlPipePress; BrakePress = 0.0; LocalBrakePosA = 0.0; - if( CabNo == 0 ) + if( CabActive == 0 ) BrakeCtrlPos = static_cast( Handle->GetPos( bh_NP ) ); else BrakeCtrlPos = static_cast( Handle->GetPos( bh_RP ) ); @@ -10626,8 +10626,8 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir) PantRear( true ); MainSwitch( true ); */ - ActiveDir = 0; // Dir; //nastawnik kierunkowy - musi być ustawiane osobno! - DirAbsolute = ActiveDir * CabNo; // kierunek jazdy względem sprzęgów + DirActive = 0; // Dir; //nastawnik kierunkowy - musi być ustawiane osobno! + DirAbsolute = DirActive * CabActive; // kierunek jazdy względem sprzęgów LimPipePress = CntrlPipePress; } else { // zahamowany} @@ -11009,8 +11009,8 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C } else if (Command == "Direction") { - ActiveDir = static_cast(floor(CValue1)); - DirAbsolute = ActiveDir * CabNo; + DirActive = static_cast(floor(CValue1)); + DirAbsolute = DirActive * CabActive; OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype ); } else if (Command == "CabActivisation") @@ -11019,19 +11019,19 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C switch (static_cast(CValue1 * CValue2)) { // CValue2 ma zmieniany znak przy niezgodności sprzęgów case 1: { - CabNo = 1; + CabActive = 1; break; } case -1: { - CabNo = -1; + CabActive = -1; break; } default:{ - CabNo = 0; // gdy CValue1==0 + CabActive = 0; // gdy CValue1==0 break; } } - DirAbsolute = ActiveDir * CabNo; + DirAbsolute = DirActive * CabActive; OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype ); } else if (Command == "AutoRelaySwitch") @@ -11070,7 +11070,7 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C Battery = false; /* // TBD: makes no sense to activate alerters in entire consist - if ((Battery) && (ActiveCab != 0) ) + if ((Battery) && (CabOccupied != 0) ) SecuritySystem.Status = SecuritySystem.Status | s_waiting; // aktywacja czuwaka else SecuritySystem.Status = 0; // wyłączenie czuwaka @@ -11299,7 +11299,7 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C } else if (Command == "CabSignal") /*SHP,Indusi*/ { // Ra: to powinno działać tylko w członie obsadzonym - if (/*(TrainType=dt_EZT)or*/ (ActiveCab != 0) && (Battery) && + if (/*(TrainType=dt_EZT)or*/ (CabOccupied != 0) && (Battery) && TestFlag(SecuritySystem.SystemType, 2)) // jeśli kabina jest obsadzona (silnikowy w EZT?) /*?*/ /* WITH SecuritySystem */ diff --git a/Train.cpp b/Train.cpp index 6f8b38ee..6af695ba 100644 --- a/Train.cpp +++ b/Train.cpp @@ -444,8 +444,8 @@ bool TTrain::Init(TDynamicObject *NewDynamicObject, bool e3d) return false; */ auto const activecab { ( - NewDynamicObject->MoverParameters->ActiveCab > 0 ? "1" : - NewDynamicObject->MoverParameters->ActiveCab < 0 ? "2" : + NewDynamicObject->MoverParameters->CabOccupied > 0 ? "1" : + NewDynamicObject->MoverParameters->CabOccupied < 0 ? "2" : "p" ) }; NewDynamicObject->create_controller( activecab, NewDynamicObject->ctOwner != nullptr ); } @@ -460,8 +460,8 @@ bool TTrain::Init(TDynamicObject *NewDynamicObject, bool e3d) fMainRelayTimer = 0; // Hunter, do k...y nędzy, ustawiaj wartości początkowe zmiennych! iCabn = ( - mvOccupied->ActiveCab > 0 ? 1 : - mvOccupied->ActiveCab < 0 ? 2 : + mvOccupied->CabOccupied > 0 ? 1 : + mvOccupied->CabOccupied < 0 ? 2 : 0 ); { @@ -475,12 +475,12 @@ bool TTrain::Init(TDynamicObject *NewDynamicObject, bool e3d) // Ra: taka proteza - przesłanie kierunku do członów connected /* - if (mvControlled->ActiveDir > 0) + if (mvControlled->DirActive > 0) { // było do przodu mvControlled->DirectionBackward(); mvControlled->DirectionForward(); } - else if (mvControlled->ActiveDir < 0) + else if (mvControlled->DirActive < 0) { mvControlled->DirectionForward(); mvControlled->DirectionBackward(); @@ -502,7 +502,7 @@ dictionary_source *TTrain::GetTrainState() { if( dict == nullptr ) { return nullptr; } dict->insert( "name", DynamicObject->asName ); - dict->insert( "cab", mvOccupied->ActiveCab ); + dict->insert( "cab", mvOccupied->CabOccupied ); // basic systems state data dict->insert( "battery", mvControlled->Battery ); dict->insert( "linebreaker", mvControlled->Mains ); @@ -515,7 +515,7 @@ dictionary_source *TTrain::GetTrainState() { dict->insert( "lights_front", mvOccupied->iLights[ end::front ] ); dict->insert( "lights_rear", mvOccupied->iLights[ end::rear ] ); // reverser - dict->insert( "direction", mvOccupied->ActiveDir ); + dict->insert( "direction", mvOccupied->DirActive ); // throttle dict->insert( "mainctrl_pos", mvControlled->MainCtrlPos ); dict->insert( "main_ctrl_actual_pos", mvControlled->MainCtrlActualPos ); @@ -686,7 +686,7 @@ bool TTrain::is_eztoer() const { && ( mvOccupied->BrakeSubsystem == TBrakeSubSystem::ss_ESt ) && ( mvControlled->Battery == true ) && ( mvControlled->EpFuse == true ) - && ( mvControlled->ActiveDir != 0 ) ); // od yB + && ( mvControlled->DirActive != 0 ) ); // od yB } // mover master controller to specified position @@ -1798,7 +1798,7 @@ void TTrain::OnCommand_reverserincrease( TTrain *Train, command_data const &Comm if( Train->mvOccupied->DirectionForward() ) { // aktualizacja skrajnych pojazdów w składzie - if( ( Train->mvOccupied->ActiveDir ) + if( ( Train->mvOccupied->DirActive ) && ( Train->DynamicObject->Mechanik ) ) { Train->DynamicObject->Mechanik->DirectionChange(); @@ -1813,7 +1813,7 @@ void TTrain::OnCommand_reverserdecrease( TTrain *Train, command_data const &Comm if( Train->mvOccupied->DirectionBackward() ) { // aktualizacja skrajnych pojazdów w składzie - if( ( Train->mvOccupied->ActiveDir ) + if( ( Train->mvOccupied->DirActive ) && ( Train->DynamicObject->Mechanik ) ) { Train->DynamicObject->Mechanik->DirectionChange();; @@ -1837,14 +1837,14 @@ void TTrain::OnCommand_reverserforward( TTrain *Train, command_data const &Comma // HACK: try to move the reverser one position back, in case it's set to "high forward" OnCommand_reverserdecrease( Train, Command ); - if( Train->mvOccupied->ActiveDir < 1 ) { + if( Train->mvOccupied->DirActive < 1 ) { - while( ( Train->mvOccupied->ActiveDir < 1 ) + while( ( Train->mvOccupied->DirActive < 1 ) && ( true == Train->mvOccupied->DirectionForward() ) ) { // all work is done in the header } // aktualizacja skrajnych pojazdów w składzie - if( ( Train->mvOccupied->ActiveDir == 1 ) + if( ( Train->mvOccupied->DirActive == 1 ) && ( Train->DynamicObject->Mechanik ) ) { Train->DynamicObject->Mechanik->DirectionChange(); @@ -1857,11 +1857,11 @@ void TTrain::OnCommand_reverserneutral( TTrain *Train, command_data const &Comma if( Command.action == GLFW_PRESS ) { - while( ( Train->mvOccupied->ActiveDir < 0 ) + while( ( Train->mvOccupied->DirActive < 0 ) && ( true == Train->mvOccupied->DirectionForward() ) ) { // all work is done in the header } - while( ( Train->mvOccupied->ActiveDir > 0 ) + while( ( Train->mvOccupied->DirActive > 0 ) && ( true == Train->mvOccupied->DirectionBackward() ) ) { // all work is done in the header } @@ -1872,14 +1872,14 @@ void TTrain::OnCommand_reverserbackward( TTrain *Train, command_data const &Comm if( Command.action == GLFW_PRESS ) { - if( Train->mvOccupied->ActiveDir > -1 ) { + if( Train->mvOccupied->DirActive > -1 ) { - while( ( Train->mvOccupied->ActiveDir > -1 ) + while( ( Train->mvOccupied->DirActive > -1 ) && ( true == Train->mvOccupied->DirectionBackward() ) ) { // all work is done in the header } // aktualizacja skrajnych pojazdów w składzie - if( ( Train->mvOccupied->ActiveDir == -1 ) + if( ( Train->mvOccupied->DirActive == -1 ) && ( Train->DynamicObject->Mechanik ) ) { Train->DynamicObject->Mechanik->DirectionChange(); @@ -5524,7 +5524,7 @@ void TTrain::OnCommand_cabchangeforward( TTrain *Train, command_data const &Comm exitdirection == end::front ? Train->DynamicObject->PrevConnected() : Train->DynamicObject->NextConnected() ); - Global.changeDynObj->MoverParameters->ActiveCab = ( + Global.changeDynObj->MoverParameters->CabOccupied = ( Train->DynamicObject->MoverParameters->Neighbours[ exitdirection ].vehicle_end ? -1 : 1 ); @@ -5557,7 +5557,7 @@ void TTrain::OnCommand_cabchangebackward( TTrain *Train, command_data const &Com exitdirection == end::front ? Train->DynamicObject->PrevConnected() : Train->DynamicObject->NextConnected() ); - Global.changeDynObj->MoverParameters->ActiveCab = ( + Global.changeDynObj->MoverParameters->CabOccupied = ( Train->DynamicObject->MoverParameters->Neighbours[ exitdirection ].vehicle_end ? -1 : 1 ); @@ -5578,18 +5578,18 @@ void TTrain::UpdateCab() { && ( DynamicObject->Mechanik->AIControllFlag ) ) { if( iCabn != ( // numer kabiny (-1: kabina B) - DynamicObject->MoverParameters->ActiveCab == -1 ? + DynamicObject->MoverParameters->CabOccupied == -1 ? 2 : - DynamicObject->MoverParameters->ActiveCab ) ) { + DynamicObject->MoverParameters->CabOccupied ) ) { InitializeCab( - DynamicObject->MoverParameters->ActiveCab, + DynamicObject->MoverParameters->CabOccupied, DynamicObject->asBaseDir + DynamicObject->MoverParameters->TypeName + ".mmd" ); } } - iCabn = ( DynamicObject->MoverParameters->ActiveCab == -1 ? + iCabn = ( DynamicObject->MoverParameters->CabOccupied == -1 ? 2 : - DynamicObject->MoverParameters->ActiveCab ); + DynamicObject->MoverParameters->CabOccupied ); } bool TTrain::Update( double const Deltatime ) @@ -5775,8 +5775,8 @@ bool TTrain::Update( double const Deltatime ) fHCurrent[3] = mvControlled->ShowCurrent(3); } - bool kier = (DynamicObject->DirectionGet() * mvOccupied->ActiveCab > 0); - TDynamicObject *p = DynamicObject->GetFirstDynamic(mvOccupied->ActiveCab < 0 ? end::rear : end::front, 4); + bool kier = (DynamicObject->DirectionGet() * mvOccupied->CabOccupied > 0); + TDynamicObject *p = DynamicObject->GetFirstDynamic(mvOccupied->CabOccupied < 0 ? end::rear : end::front, 4); int in = 0; fEIMParams[0][6] = 0; iCarNo = 0; @@ -5973,11 +5973,11 @@ bool TTrain::Update( double const Deltatime ) TDynamicObject *tmp { nullptr }; if (DynamicObject->NextConnected()) if ((TestFlag(mvControlled->Couplers[end::rear].CouplingFlag, ctrain_controll)) && - (mvOccupied->ActiveCab == 1)) + (mvOccupied->CabOccupied == 1)) tmp = DynamicObject->NextConnected(); if (DynamicObject->PrevConnected()) if ((TestFlag(mvControlled->Couplers[end::front].CouplingFlag, ctrain_controll)) && - (mvOccupied->ActiveCab == -1)) + (mvOccupied->CabOccupied == -1)) tmp = DynamicObject->PrevConnected(); if( tmp ) { if( tmp->MoverParameters->Power > 0 ) { @@ -6191,8 +6191,8 @@ bool TTrain::Update( double const Deltatime ) false : mvOccupied->BrakePress < 1.0 ); // mozna prowadzic rozruch - if( ( ( mvControlled->ActiveCab == 1 ) && ( TestFlag( mvControlled->Couplers[ end::rear ].CouplingFlag, coupling::control ) ) ) - || ( ( mvControlled->ActiveCab == -1 ) && ( TestFlag( mvControlled->Couplers[ end::front ].CouplingFlag, coupling::control ) ) ) ) { + if( ( ( mvControlled->CabOccupied == 1 ) && ( TestFlag( mvControlled->Couplers[ end::rear ].CouplingFlag, coupling::control ) ) ) + || ( ( mvControlled->CabOccupied == -1 ) && ( TestFlag( mvControlled->Couplers[ end::front ].CouplingFlag, coupling::control ) ) ) ) { btLampkaUkrotnienie.Turn( true ); } else { @@ -6220,7 +6220,7 @@ bool TTrain::Update( double const Deltatime ) btLampkaBoczniki.Turn( false ); } - btLampkaNapNastHam.Turn(mvControlled->ActiveDir != 0); // napiecie na nastawniku hamulcowym + btLampkaNapNastHam.Turn(mvControlled->DirActive != 0); // napiecie na nastawniku hamulcowym btLampkaSprezarka.Turn(mvControlled->CompressorFlag); // mutopsitka dziala btLampkaSprezarkaOff.Turn( false == mvControlled->CompressorFlag ); btLampkaFuelPumpOff.Turn( false == mvControlled->FuelPump.is_active ); @@ -6290,9 +6290,9 @@ bool TTrain::Update( double const Deltatime ) btLampkaBlokadaDrzwi.Turn( mvOccupied->Doors.is_locked ); btLampkaDoorLockOff.Turn( false == mvOccupied->Doors.lock_enabled ); btLampkaDepartureSignal.Turn( mvControlled->DepartureSignal ); - btLampkaNapNastHam.Turn((mvControlled->ActiveDir != 0) && (mvOccupied->EpFuse)); // napiecie na nastawniku hamulcowym - btLampkaForward.Turn(mvControlled->ActiveDir > 0); // jazda do przodu - btLampkaBackward.Turn(mvControlled->ActiveDir < 0); // jazda do tyłu + btLampkaNapNastHam.Turn((mvControlled->DirActive != 0) && (mvOccupied->EpFuse)); // napiecie na nastawniku hamulcowym + btLampkaForward.Turn(mvControlled->DirActive > 0); // jazda do przodu + btLampkaBackward.Turn(mvControlled->DirActive < 0); // jazda do tyłu btLampkaED.Turn(mvControlled->DynamicBrakeFlag); // hamulec ED btLampkaBrakeProfileG.Turn( TestFlag( mvOccupied->BrakeDelayFlag, bdelay_G ) ); btLampkaBrakeProfileP.Turn( TestFlag( mvOccupied->BrakeDelayFlag, bdelay_P ) ); @@ -6392,10 +6392,10 @@ bool TTrain::Update( double const Deltatime ) TDynamicObject *tmp { nullptr }; //=mvControlled->mvSecond; //Ra 2014-07: trzeba to jeszcze wyjąć z kabiny... // Ra 2014-07: no nie ma potrzeby szukać tego w każdej klatce if ((TestFlag(mvControlled->Couplers[1].CouplingFlag, ctrain_controll)) && - (mvOccupied->ActiveCab > 0)) + (mvOccupied->CabOccupied > 0)) tmp = DynamicObject->NextConnected(); if ((TestFlag(mvControlled->Couplers[0].CouplingFlag, ctrain_controll)) && - (mvOccupied->ActiveCab < 0)) + (mvOccupied->CabOccupied < 0)) tmp = DynamicObject->PrevConnected(); if( tmp ) { @@ -6530,11 +6530,11 @@ bool TTrain::Update( double const Deltatime ) if (ggDirKey.SubModel) { if (mvControlled->TrainType != dt_EZT) ggDirKey.UpdateValue( - double(mvControlled->ActiveDir), + double(mvControlled->DirActive), dsbReverserKey); else ggDirKey.UpdateValue( - double(mvControlled->ActiveDir) + double(mvControlled->Imin == mvControlled->IminHi), + double(mvControlled->DirActive) + double(mvControlled->Imin == mvControlled->IminHi), dsbReverserKey); ggDirKey.Update(); } @@ -7188,7 +7188,7 @@ void TTrain::add_distance( double const Distance ) { auto const meterenabled { ( true == ( m_distancecounter >= 0 ) ) && ( mvControlled->Battery || mvControlled->ConverterFlag ) }; - if( true == meterenabled ) { m_distancecounter += Distance * Occupied()->ActiveCab; } + if( true == meterenabled ) { m_distancecounter += Distance * Occupied()->CabOccupied; } else { m_distancecounter = -1.f; } } @@ -7198,17 +7198,17 @@ bool TTrain::CabChange(int iDirection) || ( true == DynamicObject->Mechanik->AIControllFlag ) ) { // jeśli prowadzi AI albo jest w innym członie // jak AI prowadzi, to nie można mu mieszać - if (abs(DynamicObject->MoverParameters->ActiveCab + iDirection) > 1) + if (abs(DynamicObject->MoverParameters->CabOccupied + iDirection) > 1) return false; // ewentualna zmiana pojazdu - DynamicObject->MoverParameters->ActiveCab = - DynamicObject->MoverParameters->ActiveCab + iDirection; + DynamicObject->MoverParameters->CabOccupied = + DynamicObject->MoverParameters->CabOccupied + iDirection; } else { // jeśli pojazd prowadzony ręcznie albo wcale (wagon) DynamicObject->MoverParameters->CabDeactivisation(); if( DynamicObject->MoverParameters->ChangeCab( iDirection ) ) { if( InitializeCab( - DynamicObject->MoverParameters->ActiveCab, + DynamicObject->MoverParameters->CabOccupied, DynamicObject->asBaseDir + DynamicObject->MoverParameters->TypeName + ".mmd" ) ) { // zmiana kabiny w ramach tego samego pojazdu DynamicObject->MoverParameters->CabActivisation(); // załączenie rozrządu (wirtualne kabiny) @@ -7384,7 +7384,7 @@ bool TTrain::LoadMMediaFile(std::string const &asFileName) return false; } // nie znalazl sekcji internal - if (!InitializeCab(mvOccupied->ActiveCab, asFileName)) + if (!InitializeCab(mvOccupied->CabOccupied, asFileName)) { // zle zainicjowana kabina return false; @@ -7838,8 +7838,8 @@ TTrain::radio_message( sound_source *Message, int const Channel ) { void TTrain::SetLights() { - TDynamicObject *p = DynamicObject->GetFirstDynamic(mvOccupied->ActiveCab < 0 ? 1 : 0, 4); - bool kier = (DynamicObject->DirectionGet() * mvOccupied->ActiveCab > 0); + TDynamicObject *p = DynamicObject->GetFirstDynamic(mvOccupied->CabOccupied < 0 ? 1 : 0, 4); + bool kier = (DynamicObject->DirectionGet() * mvOccupied->CabOccupied > 0); int xs = (kier ? 0 : 1); if (kier ? p->NextC(1) : p->PrevC(1)) // jesli jest nastepny, to tylko przod { diff --git a/TrkFoll.cpp b/TrkFoll.cpp index d7f2aebe..49c48bc6 100644 --- a/TrkFoll.cpp +++ b/TrkFoll.cpp @@ -244,7 +244,7 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary) { // gdy zostaje na tym samym torze (przesuwanie już nie zmienia toru) if (bPrimary) { // tylko gdy początkowe ustawienie, dodajemy eventy stania do kolejki - if (Owner->MoverParameters->ActiveCab != 0) { + if (Owner->MoverParameters->CabOccupied != 0) { pCurrentTrack->QueueEvents( pCurrentTrack->m_events1, Owner, -1.0 ); pCurrentTrack->QueueEvents( pCurrentTrack->m_events2, Owner, -1.0 ); diff --git a/drivermode.cpp b/drivermode.cpp index d4a3c9f8..7c4cfab2 100644 --- a/drivermode.cpp +++ b/drivermode.cpp @@ -510,7 +510,7 @@ driver_mode::update_camera( double const Deltatime ) { && ( false == DebugCameraFlag ) ) { // jeśli jazda w kabinie, przeliczyć trzeba parametry kamery /* - auto tempangle = controlled->VectorFront() * ( controlled->MoverParameters->ActiveCab == -1 ? -1 : 1 ); + auto tempangle = controlled->VectorFront() * ( controlled->MoverParameters->CabOccupied == -1 ? -1 : 1 ); double modelrotate = atan2( -tempangle.x, tempangle.z ); */ if( ( false == FreeFlyModeFlag ) @@ -524,17 +524,17 @@ driver_mode::update_camera( double const Deltatime ) { // Camera.Yaw powinno być wyzerowane, aby po powrocie patrzeć do przodu Camera.Pos = controlled->GetPosition() + simulation::Train->MirrorPosition( lr ); // pozycja lusterka Camera.Angle.y = 0; // odchylenie na bok od Camera.LookAt - if( simulation::Train->Occupied()->ActiveCab == 0 ) { + if( simulation::Train->Occupied()->CabOccupied == 0 ) { // gdy w korytarzu Camera.LookAt = Camera.Pos - simulation::Train->GetDirection(); } else if( Global.shiftState ) { // patrzenie w bok przez szybę - Camera.LookAt = Camera.Pos - ( lr ? -1 : 1 ) * controlled->VectorLeft() * simulation::Train->Occupied()->ActiveCab; + Camera.LookAt = Camera.Pos - ( lr ? -1 : 1 ) * controlled->VectorLeft() * simulation::Train->Occupied()->CabOccupied; } else { // patrzenie w kierunku osi pojazdu, z uwzględnieniem kabiny - jakby z lusterka, // ale bez odbicia - Camera.LookAt = Camera.Pos - simulation::Train->GetDirection() * simulation::Train->Occupied()->ActiveCab; //-1 albo 1 + Camera.LookAt = Camera.Pos - simulation::Train->GetDirection() * simulation::Train->Occupied()->CabOccupied; //-1 albo 1 } auto const shakeangles { simulation::Train->Dynamic()->shake_angles() }; Camera.Angle.x = 0.5 * shakeangles.second; // hustanie kamery przod tyl @@ -591,7 +591,7 @@ driver_mode::update_camera( double const Deltatime ) { Controlled->ABuSetModelShake( temp ); // ABu: koniec rzucania */ - if( simulation::Train->Occupied()->ActiveCab == 0 ) { + if( simulation::Train->Occupied()->CabOccupied == 0 ) { // gdy w korytarzu Camera.LookAt = Camera.m_owner->GetWorldPosition( Camera.m_owneroffset ) @@ -602,7 +602,7 @@ driver_mode::update_camera( double const Deltatime ) { Camera.LookAt = Camera.m_owner->GetWorldPosition( Camera.m_owneroffset ) + Camera.m_owner->VectorFront() * 5.0 - * simulation::Train->Occupied()->ActiveCab; //-1 albo 1 + * simulation::Train->Occupied()->CabOccupied; //-1 albo 1 } Camera.vUp = simulation::Train->GetUp(); } @@ -772,7 +772,7 @@ driver_mode::OnKeyDown(int cKey) { Global.changeDynObj = targetvehicle; // TODO: choose active cab based on camera's location relative to vehicle's location /* - Global.changeDynObj->MoverParameters->ActiveCab = ( + Global.changeDynObj->MoverParameters->CabOccupied = ( Train->DynamicObject->MoverParameters->Neighbours[ exitdirection ].vehicle_end ? -1 : 1 ); @@ -792,7 +792,7 @@ driver_mode::OnKeyDown(int cKey) { simulation::Train->Dynamic()->Mechanik->TakeControl( false, true ); if( true == simulation::Train->Dynamic()->Mechanik->primary() ) { simulation::Train->Occupied()->CabDeactivisation( true ); // potentially left active -// simulation::Train->Occupied()->ActiveCab = simulation::Train->Occupied()->CabNo; +// simulation::Train->Occupied()->CabOccupied = simulation::Train->Occupied()->CabActive; simulation::Train->Occupied()->CabActivisation(); } InOutKey(); // do kabiny @@ -935,9 +935,9 @@ driver_mode::DistantView( bool const Near ) { if( vehicle == nullptr ) { return; } auto const cab = - ( vehicle->MoverParameters->ActiveCab == 0 ? + ( vehicle->MoverParameters->CabOccupied == 0 ? 1 : - vehicle->MoverParameters->ActiveCab ); + vehicle->MoverParameters->CabOccupied ); auto const left = vehicle->VectorLeft() * cab; if( true == Near ) { @@ -951,7 +951,7 @@ driver_mode::DistantView( bool const Near ) { Camera.Pos = vehicle->GetPosition() - + vehicle->VectorFront() * vehicle->MoverParameters->ActiveCab * 50.0 + + vehicle->VectorFront() * vehicle->MoverParameters->CabOccupied * 50.0 + Math3D::vector3( -10.0 * left.x, 1.6, -10.0 * left.z ); } @@ -997,15 +997,15 @@ driver_mode::ExternalView() { else { // default view setup auto const offsetflip{ - ( vehicle->MoverParameters->ActiveCab == 0 ? 1 : vehicle->MoverParameters->ActiveCab ) - * ( vehicle->MoverParameters->ActiveDir == 0 ? 1 : vehicle->MoverParameters->ActiveDir ) }; + ( vehicle->MoverParameters->CabOccupied == 0 ? 1 : vehicle->MoverParameters->CabOccupied ) + * ( vehicle->MoverParameters->DirActive == 0 ? 1 : vehicle->MoverParameters->DirActive ) }; Camera.m_owneroffset = { 1.5 * owner->MoverParameters->Dim.W * offsetflip, std::max( 5.0, 1.25 * owner->MoverParameters->Dim.H ), -0.4 * owner->MoverParameters->Dim.L * offsetflip }; - Camera.Angle.y = glm::radians( ( vehicle->MoverParameters->ActiveDir < 0 ? 180.0 : 0.0 ) ); + Camera.Angle.y = glm::radians( ( vehicle->MoverParameters->DirActive < 0 ? 180.0 : 0.0 ) ); } auto const shakeangles{ owner->shake_angles() }; Camera.Angle.x -= 0.5 * shakeangles.second; // hustanie kamery przod tyl @@ -1028,8 +1028,8 @@ driver_mode::ExternalView() { else { // default view setup auto const offsetflip{ - ( vehicle->MoverParameters->ActiveCab == 0 ? 1 : vehicle->MoverParameters->ActiveCab ) - * ( vehicle->MoverParameters->ActiveDir == 0 ? 1 : vehicle->MoverParameters->ActiveDir ) + ( vehicle->MoverParameters->CabOccupied == 0 ? 1 : vehicle->MoverParameters->CabOccupied ) + * ( vehicle->MoverParameters->DirActive == 0 ? 1 : vehicle->MoverParameters->DirActive ) * -1 }; Camera.m_owneroffset = { @@ -1037,7 +1037,7 @@ driver_mode::ExternalView() { std::max( 5.0, 1.25 * owner->MoverParameters->Dim.H ), 0.2 * owner->MoverParameters->Dim.L * offsetflip }; - Camera.Angle.y = glm::radians( ( vehicle->MoverParameters->ActiveDir < 0 ? 0.0 : 180.0 ) ); + Camera.Angle.y = glm::radians( ( vehicle->MoverParameters->DirActive < 0 ? 0.0 : 180.0 ) ); } auto const shakeangles { owner->shake_angles() }; Camera.Angle.x -= 0.5 * shakeangles.second; // hustanie kamery przod tyl @@ -1058,15 +1058,15 @@ driver_mode::ExternalView() { else { // default view setup auto const offsetflip{ - ( vehicle->MoverParameters->ActiveCab == 0 ? 1 : vehicle->MoverParameters->ActiveCab ) - * ( vehicle->MoverParameters->ActiveDir == 0 ? 1 : vehicle->MoverParameters->ActiveDir ) }; + ( vehicle->MoverParameters->CabOccupied == 0 ? 1 : vehicle->MoverParameters->CabOccupied ) + * ( vehicle->MoverParameters->DirActive == 0 ? 1 : vehicle->MoverParameters->DirActive ) }; Camera.m_owneroffset = { -0.65 * owner->MoverParameters->Dim.W * offsetflip, 0.90, 0.15 * owner->MoverParameters->Dim.L * offsetflip }; - Camera.Angle.y = glm::radians( ( vehicle->MoverParameters->ActiveDir < 0 ? 180.0 : 0.0 ) ); + Camera.Angle.y = glm::radians( ( vehicle->MoverParameters->DirActive < 0 ? 180.0 : 0.0 ) ); } auto const shakeangles { owner->shake_angles() }; Camera.Angle.x -= 0.5 * shakeangles.second; // hustanie kamery przod tyl @@ -1110,7 +1110,7 @@ driver_mode::CabView() { Camera.Angle.x -= 0.5 * shakeangles.second; // hustanie kamery przod tyl Camera.Angle.z = shakeangles.first; // hustanie kamery na boki - if( train->Occupied()->ActiveCab == 0 ) { + if( train->Occupied()->CabOccupied == 0 ) { Camera.LookAt = Camera.m_owner->GetWorldPosition( Camera.m_owneroffset ) + Camera.m_owner->VectorFront() * 5.0; @@ -1120,7 +1120,7 @@ driver_mode::CabView() { Camera.LookAt = Camera.m_owner->GetWorldPosition( Camera.m_owneroffset ) + Camera.m_owner->VectorFront() * 5.0 - * Camera.m_owner->MoverParameters->ActiveCab; + * Camera.m_owner->MoverParameters->CabOccupied; } train->pMechOffset = Camera.m_owneroffset; } @@ -1141,7 +1141,7 @@ driver_mode::ChangeDynamic() { // tylko jeśli ręcznie prowadzony // jeśli prowadzi AI, to mu nie robimy dywersji! occupied->CabDeactivisation(); - occupied->ActiveCab = 0; + occupied->CabOccupied = 0; occupied->BrakeLevelSet( occupied->Handle->GetPos( bh_NP ) ); //rozwala sterowanie hamulcem GF 04-2016 vehicle->MechInside = false; vehicle->Controller = AIdriver; @@ -1169,13 +1169,13 @@ driver_mode::ChangeDynamic() { if( false == driver->AIControllFlag ) // tylko jeśli ręcznie prowadzony { occupied->LimPipePress = occupied->PipePress; - occupied->ActiveCab = occupied->CabNo; + occupied->CabOccupied = occupied->CabActive; occupied->CabActivisation( true ); // załączenie rozrządu (wirtualne kabiny) vehicle->MechInside = true; vehicle->Controller = Humandriver; } train->InitializeCab( - occupied->CabNo, + occupied->CabActive, vehicle->asBaseDir + occupied->TypeName + ".mmd" ); if( false == FreeFlyModeFlag ) { vehicle->bDisplayCab = true; diff --git a/driveruipanels.cpp b/driveruipanels.cpp index 412e485f..a7c62c8e 100644 --- a/driveruipanels.cpp +++ b/driveruipanels.cpp @@ -52,7 +52,7 @@ drivingaid_panel::update() { if( is_expanded ) { // grade std::string gradetext; - auto const reverser { ( mover->ActiveDir > 0 ? 1 : -1 ) }; + auto const reverser { ( mover->DirActive > 0 ? 1 : -1 ) }; auto const grade { controlled->VectorFront().y * 100 * ( controlled->DirectionGet() == reverser ? 1 : -1 ) * reverser }; if( std::abs( grade ) >= 0.25 ) { std::snprintf( @@ -89,7 +89,7 @@ drivingaid_panel::update() { locale::strings[ locale::string::driver_aid_throttle ].c_str(), driver->Controlling()->MainCtrlPos, driver->Controlling()->ScndCtrlPos, - ( mover->ActiveDir > 0 ? 'D' : mover->ActiveDir < 0 ? 'R' : 'N' ), + ( mover->DirActive > 0 ? 'D' : mover->DirActive < 0 ? 'R' : 'N' ), expandedtext.c_str()); text_lines.emplace_back( m_buffer.data(), Global.UITextColor ); @@ -689,7 +689,7 @@ debug_panel::update_section_vehicle( std::vector &Output ) { m_buffer.data(), m_buffer.size(), locale::strings[ locale::string::debug_vehicle_forcesaccelerationvelocityposition ].c_str(), // forces - mover.Ft * 0.001f * ( mover.ActiveCab ? mover.ActiveCab : vehicle.ctOwner ? vehicle.ctOwner->Controlling()->ActiveCab : 1 ) + 0.001f, + mover.Ft * 0.001f * ( mover.CabOccupied ? mover.CabOccupied : vehicle.ctOwner ? vehicle.ctOwner->Controlling()->CabOccupied : 1 ) + 0.001f, mover.Fb * 0.001f, mover.Adhesive( mover.RunningTrack.friction ), ( mover.SlippingWheels ? " (!)" : "" ), diff --git a/sound.cpp b/sound.cpp index 9f247fd5..eabd867e 100644 --- a/sound.cpp +++ b/sound.cpp @@ -908,11 +908,11 @@ bool sound_source::update_soundproofing() { // NOTE, HACK: current cab id can vary from -1 to +1, and we use another higher priority value for open cab window // we use this as modifier to force re-calculations when moving between compartments or changing window state - int const activecab = ( + int const occupiedcab = ( Global.CabWindowOpen ? 2 : FreeFlyModeFlag ? 0 : ( simulation::Train ? - simulation::Train->Occupied()->ActiveCab : + simulation::Train->Occupied()->CabOccupied : 0 ) ); // location-based gain factor: std::uintptr_t soundproofingstamp = reinterpret_cast( ( @@ -921,7 +921,7 @@ sound_source::update_soundproofing() { ( simulation::Train ? simulation::Train->Dynamic() : nullptr ) ) ) - + activecab; + + occupiedcab; if( soundproofingstamp == m_properties.soundproofing_stamp ) { return false; } @@ -944,7 +944,7 @@ sound_source::update_soundproofing() { EU07_SOUNDPROOFING_STRONG : // listener outside HACK: won't be true if active vehicle has open window ( simulation::Train->Dynamic() != m_owner ? EU07_SOUNDPROOFING_STRONG : // in another vehicle - ( activecab == 0 ? + ( occupiedcab == 0 ? EU07_SOUNDPROOFING_STRONG : // listener in the engine compartment EU07_SOUNDPROOFING_NONE ) ) ); // listener in the cab of the same vehicle break; @@ -955,7 +955,7 @@ sound_source::update_soundproofing() { EU07_SOUNDPROOFING_SOME : // listener outside or has a window open ( simulation::Train->Dynamic() != m_owner ? EU07_SOUNDPROOFING_STRONG : // in another vehicle - ( activecab == 0 ? + ( occupiedcab == 0 ? EU07_SOUNDPROOFING_NONE : // listener in the engine compartment EU07_SOUNDPROOFING_STRONG ) ) ); // listener in another compartment of the same vehicle break;