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

refactoring: variable names

This commit is contained in:
tmj-fstate
2019-11-28 00:10:32 +01:00
parent fa42655808
commit f9febd5887
10 changed files with 291 additions and 292 deletions

View File

@@ -188,7 +188,7 @@ void TCamera::Update()
// attached movement position update // attached movement position update
auto movement { Velocity * -2.0 }; auto movement { Velocity * -2.0 };
movement.y = -movement.y; movement.y = -movement.y;
if( m_owner->MoverParameters->ActiveCab < 0 ) { if( m_owner->MoverParameters->CabOccupied < 0 ) {
movement *= -1.f; movement *= -1.f;
movement.y = -movement.y; movement.y = -movement.y;
} }

View File

@@ -1628,7 +1628,7 @@ TController::TController(bool AI, TDynamicObject *NewControll, bool InitPsyche,
pVehicles[ 1 ] = nullptr; pVehicles[ 1 ] = nullptr;
} }
if( mvOccupied != 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; VehicleName = mvOccupied->Name;
if( mvOccupied->CategoryFlag & 2 ) { // samochody: na podst. http://www.prawko-kwartnik.info/hamowanie.html 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 mvOccupied->Handle->GetPos(bh_NP)); // odcięcie na zaworze maszynisty
BrakeLevelSet(gbh_NP); //ustawienie zmiennej GBH 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 mvOccupied->CabDeactivisation(); // tak jest w Train.cpp
// przejście AI na drugą stronę EN57, ET41 itp. // przejście AI na drugą stronę EN57, ET41 itp.
while (TestFlag(d->MoverParameters->Couplers[iDirection < 0 ? end::rear : end::front].CouplingFlag, ctrain_controll)) 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 if (d->DirectionGet() != pVehicle->DirectionGet()) // jeśli są przeciwne do siebie
iDirection = -iDirection; // to będziemy jechać w drugą stronę względem zasiedzianego pojazdu 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->Mechanik = drugi; // wsadzamy tego, co ewentualnie był (podwójna trakcja)
pVehicle->MoverParameters->CabNo = 0; // wyłączanie kabin po drodze pVehicle->MoverParameters->CabActive = 0; // wyłączanie kabin po drodze
pVehicle->MoverParameters->ActiveCab = 0; // i zaznaczenie, że nie ma tam nikogo pVehicle->MoverParameters->CabOccupied = 0; // i zaznaczenie, że nie ma tam nikogo
pVehicle = d; // a mechu ma nowy pojazd (no, człon) pVehicle = d; // a mechu ma nowy pojazd (no, człon)
} }
else else
@@ -1856,9 +1856,9 @@ void TController::Activation()
} }
} }
// Ra: to przełączanie poniżej jest tu bez sensu // 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->CabOccupied = iDirection; // aktywacja kabiny w prowadzonym pojeżdzie (silnikowy może być odwrotnie?)
// mvOccupied->CabNo=iDirection; // mvOccupied->CabActive=iDirection;
// mvOccupied->ActiveDir=0; //żeby sam ustawił kierunek // mvOccupied->DirActive=0; //żeby sam ustawił kierunek
mvOccupied->CabActivisation(); // uruchomienie kabin w członach mvOccupied->CabActivisation(); // uruchomienie kabin w członach
DirectionForward(true); // nawrotnik do przodu DirectionForward(true); // nawrotnik do przodu
if (localbrakelevel > 0.0) // hamowanie tylko jeśli był wcześniej zahamowany (bo możliwe, że jedzie!) 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 int d = mvOccupied->DirAbsolute; // który sprzęg jest z przodu
if( !d ) { if( !d ) {
// jeśli nie ma ustalonego kierunku to jedziemy wg aktualnej kabiny // jeśli nie ma ustalonego kierunku to jedziemy wg aktualnej kabiny
d = mvOccupied->CabNo; d = mvOccupied->CabActive;
} }
return d; 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 // 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 // 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( Lights(
light::headlight_right, light::headlight_right,
( pVehicles[ 1 ]->MoverParameters->CabNo != 0 ? ( pVehicles[ 1 ]->MoverParameters->CabActive != 0 ?
light::headlight_left : light::headlight_left :
0 ) ); //światła manewrowe (Tb1) na pojeździe z napędem 0 ) ); //światła manewrowe (Tb1) na pojeździe z napędem
} }
else { else {
Lights( Lights(
( pVehicles[ 1 ]->MoverParameters->CabNo != 0 ? ( pVehicles[ 1 ]->MoverParameters->CabActive != 0 ?
light::headlight_left : light::headlight_left :
0 ), 0 ),
light::headlight_right ); //światła manewrowe (Tb1) na pojeździe z napędem light::headlight_right ); //światła manewrowe (Tb1) na pojeździe z napędem
} }
} }
else if( true == TestFlag( OrderCurrentGet(), Disconnect ) ) { else if( true == TestFlag( OrderCurrentGet(), Disconnect ) ) {
if( mvOccupied->ActiveDir > 0 ) { if( mvOccupied->DirActive > 0 ) {
// jak ma kierunek do przodu // jak ma kierunek do przodu
// światła manewrowe (Tb1) tylko z przodu, aby nie pozostawić odczepionego ze światłem // światła manewrowe (Tb1) tylko z przodu, aby nie pozostawić odczepionego ze światłem
Lights( light::headlight_right, 0 ); Lights( light::headlight_right, 0 );
@@ -2348,7 +2348,7 @@ void TController::DirectionInitial()
{ // jeśli na starcie jedzie { // jeśli na starcie jedzie
iDirection = iDirectionOrder = iDirection = iDirectionOrder =
(mvOccupied->V > 0 ? 1 : -1); // początkowa prędkość wymusza kierunek jazdy (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 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) if (Vehicle->Vel < 0.5)
{ // jeśli prawie stoi, można zmienić kierunek, musi być wykonane dwukrotnie, bo za pierwszym { // jeśli prawie stoi, można zmienić kierunek, musi być wykonane dwukrotnie, bo za pierwszym
// razem daje na zero // razem daje na zero
switch (newdir * Vehicle->CabNo) switch (newdir * Vehicle->CabActive)
{ // DirectionBackward() i DirectionForward() to zmiany względem kabiny { // DirectionBackward() i DirectionForward() to zmiany względem kabiny
case -1: // if (!Vehicle->DirectionBackward()) testd=0; break; case -1: // if (!Vehicle->DirectionBackward()) testd=0; break;
DirectionForward(false); DirectionForward(false);
@@ -2382,12 +2382,12 @@ int TController::OrderDirectionChange(int newdir, TMoverParameters *Vehicle)
} }
else // jeśli jedzie else // jeśli jedzie
VelforDriver = 0; // ma się zatrzymać w celu zmiany kierunku 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 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 VelforDriver = -1; // można jechać, bo kierunek jest zgodny z żądanym
if (Vehicle->TrainType == dt_EZT) 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) // if () //tylko jeśli jazda pociągowa (tego nie wiemy w momencie odpalania silnika)
Vehicle->DirectionForward(); // Ra: z przekazaniem do silnikowego Vehicle->DirectionForward(); // Ra: z przekazaniem do silnikowego
return (int)VelforDriver; // zwraca prędkość mechanika return (int)VelforDriver; // zwraca prędkość mechanika
@@ -2540,7 +2540,7 @@ bool TController::PrepareEngine()
if( !iDirection ) { if( !iDirection ) {
// jeśli nie ma ustalonego kierunku // jeśli nie ma ustalonego kierunku
if( mvOccupied->Vel < 0.01 ) { // ustalenie kierunku, gdy stoi if( mvOccupied->Vel < 0.01 ) { // ustalenie kierunku, gdy stoi
iDirection = mvOccupied->CabNo; // wg wybranej kabiny iDirection = mvOccupied->CabActive; // wg wybranej kabiny
if( !iDirection ) { if( !iDirection ) {
// jeśli nie ma ustalonego kierunku // jeśli nie ma ustalonego kierunku
if( ( mvControlling->PantographVoltage != 0.0 ) || voltfront || voltrear ) { if( ( mvControlling->PantographVoltage != 0.0 ) || voltfront || voltrear ) {
@@ -2622,7 +2622,7 @@ bool TController::PrepareEngine()
OK = false; OK = false;
if( ( true == OK ) if( ( true == OK )
&& ( mvOccupied->ActiveDir != 0 ) && ( mvOccupied->DirActive != 0 )
&& ( true == workingtemperature ) && ( true == workingtemperature )
&& ( ( mvControlling->ScndPipePress > 4.5 ) || ( mvControlling->VeselVolume == 0.0 ) ) ) { && ( ( mvControlling->ScndPipePress > 4.5 ) || ( mvControlling->VeselVolume == 0.0 ) ) ) {
@@ -2663,7 +2663,7 @@ bool TController::ReleaseEngine() {
if( false == AIControllFlag ) { if( false == AIControllFlag ) {
// tylko to testujemy dla pojazdu człowieka // tylko to testujemy dla pojazdu człowieka
OK = ( ( mvOccupied->ActiveDir == 0 ) && ( mvControlling->Mains ) ); OK = ( ( mvOccupied->DirActive == 0 ) && ( mvControlling->Mains ) );
} }
else { else {
// jeśli steruje komputer // jeśli steruje komputer
@@ -3188,7 +3188,7 @@ bool TController::IncSpeed()
} }
break; break;
case TEngineType::WheelsDriven: case TEngineType::WheelsDriven:
if (!mvControlling->CabNo) if (!mvControlling->CabActive)
mvControlling->CabActivisation(); mvControlling->CabActivisation();
if (sin(mvControlling->eAngle) > 0) if (sin(mvControlling->eAngle) > 0)
mvControlling->IncMainCtrl(3 + 3 * floor(0.5 + fabs(AccDesired))); mvControlling->IncMainCtrl(3 + 3 * floor(0.5 + fabs(AccDesired)));
@@ -3278,7 +3278,7 @@ bool TController::DecSpeed(bool force)
OK = DecSpeedEIM(); OK = DecSpeedEIM();
break; break;
case TEngineType::WheelsDriven: case TEngineType::WheelsDriven:
if (!mvControlling->CabNo) if (!mvControlling->CabActive)
mvControlling->CabActivisation(); mvControlling->CabActivisation();
if (sin(mvControlling->eAngle) < 0) if (sin(mvControlling->eAngle) < 0)
mvControlling->IncMainCtrl(3 + 3 * floor(0.5 + fabs(AccDesired))); mvControlling->IncMainCtrl(3 + 3 * floor(0.5 + fabs(AccDesired)));
@@ -3412,7 +3412,7 @@ void TController::SpeedSet()
if( fActionTime < 0.0 ) { break; } if( fActionTime < 0.0 ) { break; }
if( fReady > ( mvOccupied->Vel > 5.0 ? 0.5 : 0.4 ) ) { 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 mvOccupied->DirectionForward(); //żeby EN57 jechały na drugiej nastawie
} }
@@ -3565,13 +3565,13 @@ void TController::SpeedCntrl(double DesiredSpeed)
else if (mvControlling->ScndCtrlPos < 1) { else if (mvControlling->ScndCtrlPos < 1) {
mvControlling->IncScndCtrl(1); mvControlling->IncScndCtrl(1);
} }
mvControlling->RunCommand("SpeedCntrl", DesiredSpeed, mvControlling->CabNo); mvControlling->RunCommand("SpeedCntrl", DesiredSpeed, mvControlling->CabActive);
} }
else else
if (mvControlling->ScndCtrlPosNo == 1) if (mvControlling->ScndCtrlPosNo == 1)
{ {
mvControlling->IncScndCtrl(1); mvControlling->IncScndCtrl(1);
mvControlling->RunCommand("SpeedCntrl", DesiredSpeed, mvControlling->CabNo); mvControlling->RunCommand("SpeedCntrl", DesiredSpeed, mvControlling->CabActive);
} }
else if ((mvControlling->ScndCtrlPosNo > 1) && (!mvOccupied->SpeedCtrlTypeTime)) 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) if (mvOccupied->V!=0.0)
iDirectionOrder=mvOccupied->V>0?1:-1; iDirectionOrder=mvOccupied->V>0?1:-1;
else else
iDirectionOrder=mvOccupied->ActiveCab; iDirectionOrder=mvOccupied->CabOccupied;
if (!iDirectionOrder) iDirectionOrder=1; if (!iDirectionOrder) iDirectionOrder=1;
} }
*/ */
// jeśli wysyłane z Trainset, to wszystko jest już odpowiednio ustawione // jeśli wysyłane z Trainset, to wszystko jest już odpowiednio ustawione
// if (!NewLocation) //jeśli wysyłane z Trainset // 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 // aktualnym kierunkiem jazdy
// DirectionForward(false); //jedziemy do tyłu (nawrotnik do tyłu) // DirectionForward(false); //jedziemy do tyłu (nawrotnik do tyłu)
// CheckVehicles(); //sprawdzenie składu, AI zapali światła // CheckVehicles(); //sprawdzenie składu, AI zapali światła
@@ -4376,7 +4376,7 @@ void TController::PhysicsLog()
<< int(mvControlling->ScndCtrlPos) << " " << int(mvControlling->ScndCtrlPos) << " "
<< mvOccupied->fBrakeCtrlPos << " " << mvOccupied->fBrakeCtrlPos << " "
<< mvOccupied->LocalBrakePosA << " " << mvOccupied->LocalBrakePosA << " "
<< int(mvControlling->ActiveDir) << " " << int(mvControlling->DirActive) << " "
<< ( mvOccupied->CommandIn.Command.empty() ? "none" : mvOccupied->CommandIn.Command.c_str() ) << " " << ( mvOccupied->CommandIn.Command.empty() ? "none" : mvOccupied->CommandIn.Command.c_str() ) << " "
<< mvOccupied->CommandIn.Value1 << " " << mvOccupied->CommandIn.Value1 << " "
<< mvOccupied->CommandIn.Value2 << " " << mvOccupied->CommandIn.Value2 << " "
@@ -4842,7 +4842,7 @@ TController::UpdateSituation(double dt) {
routescandirection = end::rear; routescandirection = end::rear;
} }
/* /*
if( pVehicle->MoverParameters->ActiveCab < 0 ) { if( pVehicle->MoverParameters->CabOccupied < 0 ) {
// flip the scan direction in the rear cab // flip the scan direction in the rear cab
routescandirection ^= routescandirection; routescandirection ^= routescandirection;
} }
@@ -5357,7 +5357,7 @@ TController::UpdateSituation(double dt) {
mvOccupied->BrakeReleaser(1); // wyluzuj lokomotywę; a ST45? mvOccupied->BrakeReleaser(1); // wyluzuj lokomotywę; a ST45?
mvOccupied->DecLocalBrakeLevel(LocalBrakePosNo); // zwolnienie hamulca mvOccupied->DecLocalBrakeLevel(LocalBrakePosNo); // zwolnienie hamulca
iDrivigFlags |= movePress; // następnie będzie dociskanie 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 CheckVehicles(); // od razu zmienić światła (zgasić) - bez tego się nie odczepi
} }
} }
@@ -5376,7 +5376,7 @@ TController::UpdateSituation(double dt) {
ZeroSpeed(); ZeroSpeed();
// ponowna zmiana kierunku // ponowna zmiana kierunku
WriteLog( mvOccupied->Name + " 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 iDrivigFlags &= ~movePress; // koniec dociskania
JumpToNextOrder(); // zmieni światła JumpToNextOrder(); // zmieni światła
TableClear(); // skanowanie od nowa TableClear(); // skanowanie od nowa
@@ -5642,7 +5642,7 @@ TController::UpdateSituation(double dt) {
// TODO: proper system for sending/receiving radio messages // TODO: proper system for sending/receiving radio messages
// place the sound in appropriate cab of the manned vehicle // place the sound in appropriate cab of the manned vehicle
tsGuardSignal.owner( pVehicle ); 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 ); tsGuardSignal.play( sound_flags::exclusive );
} }
} }
@@ -6256,7 +6256,7 @@ TController::UpdateSituation(double dt) {
{ // tutaj, gdy pojazd jest wyłączony { // tutaj, gdy pojazd jest wyłączony
if (!AIControllFlag) // jeśli sterowanie jest w gestii użytkownika if (!AIControllFlag) // jeśli sterowanie jest w gestii użytkownika
if (mvOccupied->Battery) // czy użytkownik załączył baterię? 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 { // jeśli tak, to uruchomienie skanowania
CheckVehicles(); // sprawdzić skład CheckVehicles(); // sprawdzić skład
TableClear(); // resetowanie tabelki skanowania TableClear(); // resetowanie tabelki skanowania
@@ -6919,13 +6919,13 @@ void TController::TakeControl( bool const Aidriver, bool const Forcevehiclecheck
} }
else { else {
// jeśli nic nie robi // jeśli nic nie robi
if( pVehicle->iLights[ ( mvOccupied->CabNo < 0 ? if( pVehicle->iLights[ ( mvOccupied->CabActive < 0 ?
end::rear : end::rear :
end::front ) ] end::front ) ]
& ( light::headlight_left | light::headlight_right | light::headlight_upper ) ) // któreś ze świateł zapalone? & ( light::headlight_left | light::headlight_right | light::headlight_upper ) ) // któreś ze świateł zapalone?
{ // od wersji 357 oczekujemy podania komend dla AI przez scenerię { // od wersji 357 oczekujemy podania komend dla AI przez scenerię
OrderNext( Prepare_engine ); 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 OrderNext( Obey_train ); // jazda pociągowa
else else
OrderNext( Shunt ); // jazda manewrowa OrderNext( Shunt ); // jazda manewrowa
@@ -6960,7 +6960,7 @@ void TController::DirectionForward(bool forward)
if( forward ) { if( forward ) {
// do przodu w obecnej kabinie // do przodu w obecnej kabinie
while( ( mvOccupied->ActiveDir <= 0 ) while( ( mvOccupied->DirActive <= 0 )
&& ( mvOccupied->DirectionForward() ) ) { && ( mvOccupied->DirectionForward() ) ) {
// force scan table update // force scan table update
iTableDirection = 0; iTableDirection = 0;
@@ -6968,7 +6968,7 @@ void TController::DirectionForward(bool forward)
} }
else { else {
// do tyłu w obecnej kabinie // do tyłu w obecnej kabinie
while( ( mvOccupied->ActiveDir >= 0 ) while( ( mvOccupied->DirActive >= 0 )
&& ( mvOccupied->DirectionBackward() ) ) { && ( mvOccupied->DirectionBackward() ) ) {
// force scan table update // force scan table update
iTableDirection = 0; iTableDirection = 0;
@@ -6985,13 +6985,13 @@ void TController::DirectionForward(bool forward)
void TController::ZeroDirection() { void TController::ZeroDirection() {
while( ( mvOccupied->ActiveDir > 0 ) && ( mvOccupied->DirectionBackward() ) ) { ; } while( ( mvOccupied->DirActive > 0 ) && ( mvOccupied->DirectionBackward() ) ) { ; }
while( ( mvOccupied->ActiveDir < 0 ) && ( mvOccupied->DirectionForward() ) ) { ; } while( ( mvOccupied->DirActive < 0 ) && ( mvOccupied->DirectionForward() ) ) { ; }
} }
void TController::sync_consist_reversers() { void TController::sync_consist_reversers() {
auto const currentdirection { mvOccupied->ActiveDir }; auto const currentdirection { mvOccupied->DirActive };
auto const fastforward { ( auto const fastforward { (
( mvOccupied->TrainType == dt_EZT ) ( mvOccupied->TrainType == dt_EZT )
&& ( mvOccupied->EngineType != TEngineType::ElectricInductionMotor ) ) && ( mvOccupied->EngineType != TEngineType::ElectricInductionMotor ) )
@@ -7008,7 +7008,7 @@ void TController::sync_consist_reversers() {
} }
} }
// ...then restore original setting // ...then restore original setting
while( mvOccupied->ActiveDir != currentdirection ) { while( mvOccupied->DirActive != currentdirection ) {
if( false == ( if( false == (
currentdirection >= 0 ? currentdirection >= 0 ?
mvOccupied->DirectionForward() : mvOccupied->DirectionForward() :

View File

@@ -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 // only animate the mirror if it's located on the same end of the vehicle as the active cab
auto const isactive { ( auto const isactive { (
MoverParameters->ActiveCab > 0 ? ( ( pAnim->iNumber >> 4 ) == end::front ? 1.0 : 0.0 ) : MoverParameters->CabOccupied > 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::rear ? 1.0 : 0.0 ) :
0.0 ) }; 0.0 ) };
if( pAnim->iNumber & 1 ) if( pAnim->iNumber & 1 )
@@ -1040,9 +1040,9 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
&& ( ( Mechanik->action() != TAction::actSleep ) && ( ( Mechanik->action() != TAction::actSleep )
/* || ( MoverParameters->Battery ) */ ) ) { /* || ( MoverParameters->Battery ) */ ) ) {
// rysowanie figurki mechanika // rysowanie figurki mechanika
btMechanik1.Turn( MoverParameters->ActiveCab > 0 ); btMechanik1.Turn( MoverParameters->CabOccupied > 0 );
btMechanik2.Turn( MoverParameters->ActiveCab < 0 ); btMechanik2.Turn( MoverParameters->CabOccupied < 0 );
if( MoverParameters->ActiveCab != 0 ) { if( MoverParameters->CabOccupied != 0 ) {
btnOn = true; btnOn = true;
} }
} }
@@ -2831,12 +2831,12 @@ bool TDynamicObject::Update(double dt, double dt1)
if (MoverParameters->SpeedCtrl) if (MoverParameters->SpeedCtrl)
MoverParameters->CheckSpeedCtrl(dt1); MoverParameters->CheckSpeedCtrl(dt1);
MoverParameters->eimic_real = std::min(MoverParameters->eimic,MoverParameters->eimicSpeedCtrl); 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() ) if( ( Mechanik->primary() )
&& ( MoverParameters->EngineType == TEngineType::ElectricInductionMotor ) ) { && ( MoverParameters->EngineType == TEngineType::ElectricInductionMotor ) ) {
// jesli glowny i z asynchronami, to niech steruje hamulcem i napedem lacznie dla calego pociagu/ezt // 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 FED { 0.0 };
auto np { 0 }; auto np { 0 };
auto masa { 0.0 }; auto masa { 0.0 };
@@ -2861,7 +2861,7 @@ bool TDynamicObject::Update(double dt, double dt1)
MoverParameters->eimic_real = eimic; MoverParameters->eimic_real = eimic;
if (MoverParameters->EIMCtrlType == 2 && MoverParameters->MainCtrlPos == 0) if (MoverParameters->EIMCtrlType == 2 && MoverParameters->MainCtrlPos == 0)
eimic = -1.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 LBR = Max0R(-eimic, 0);
auto eim_lb = (Mechanik->AIControllFlag || !MoverParameters->LocHandleTimeTraxx ? 0 : MoverParameters->eim_localbrake); 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 // 2. ustal mozliwa do realizacji sile hamowania ED
// - w szczegolnosci powinien brac pod uwage rozne sily hamowania // - 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))) (kier ? p = p->NextC(4) : p = p->PrevC(4)))
{ {
++np; ++np;
@@ -2891,7 +2891,7 @@ bool TDynamicObject::Update(double dt, double dt1)
Nmax / (p->MoverParameters->NAxles * p->MoverParameters->NBpA), Nmax / (p->MoverParameters->NAxles * p->MoverParameters->NBpA),
p->MoverParameters->MED_Vref) * p->MoverParameters->MED_Vref) *
1000; // sila hamowania pn 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 > (p->MoverParameters->eimc[eimc_p_Fh] * p->MoverParameters->NPoweredAxles >
0) ? 0) ?
p->MoverParameters->eimc[eimc_p_Fh] * 1000 : p->MoverParameters->eimc[eimc_p_Fh] * 1000 :
@@ -2997,11 +2997,11 @@ bool TDynamicObject::Update(double dt, double dt1)
// 6. ustaw pojazdom sile hamowania ep // 6. ustaw pojazdom sile hamowania ep
// - proporcjonalnie do masy, do liczby osi, rowne cisnienia - jak // - proporcjonalnie do masy, do liczby osi, rowne cisnienia - jak
// bedzie, tak bedzie dobrze // 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 ////ALGORYTM 2 - KAZDEMU PO ROWNO, ale nie wiecej niz eped * masa
// 1. najpierw daj kazdemu tyle samo // 1. najpierw daj kazdemu tyle samo
int i = 0; 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)) ) p = (kier == true ? p->NextC(4) : p->PrevC(4)) )
{ {
auto const Nmax = ((p->MoverParameters->P2FTrans * p->MoverParameters->MaxBrakePress[0] - auto const Nmax = ((p->MoverParameters->P2FTrans * p->MoverParameters->MaxBrakePress[0] -
@@ -3029,7 +3029,7 @@ bool TDynamicObject::Update(double dt, double dt1)
test = false; test = false;
i = 0; i = 0;
float przek = 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)) ) p = (kier == true ? p->NextC(4) : p->PrevC(4)) )
{ {
if ((FzEP[i] > 0.01) && if ((FzEP[i] > 0.01) &&
@@ -3055,7 +3055,7 @@ bool TDynamicObject::Update(double dt, double dt1)
} }
i = 0; i = 0;
przek = przek / (np - nPrzekrF); 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))) (true == kier ? p = p->NextC(4) : p = p->PrevC(4)))
{ {
if (!PrzekrF[i]) if (!PrzekrF[i])
@@ -3066,7 +3066,7 @@ bool TDynamicObject::Update(double dt, double dt1)
} }
} }
i = 0; 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))) (true == kier ? p = p->NextC(4) : p = p->PrevC(4)))
{ {
float Nmax = ((p->MoverParameters->P2FTrans * p->MoverParameters->MaxBrakePress[0] - 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" 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; << 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))) (true == kier ? p = p->NextC(4) : p = p->PrevC(4)))
{ {
MEDLogFile << "\t" << p->MoverParameters->BrakePress; MEDLogFile << "\t" << p->MoverParameters->BrakePress;
@@ -5978,7 +5978,7 @@ void TDynamicObject::RaLightsSet(int head, int rear)
// jest tam czynna lokomotywa // jest tam czynna lokomotywa
// EN57 może nie mieć końcówek od środka członu // 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->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 { // jeśli ma zarówno światła jak i końcówki, ustalić, czy jest w stanie
// aktywnym // aktywnym
// np. lokomotywa na zimno będzie mieć końcówki a nie światła // np. lokomotywa na zimno będzie mieć końcówki a nie światła

View File

@@ -1351,12 +1351,11 @@ public:
int ScndCtrlPos = 0; /*polozenie dodatkowego nastawnika*/ int ScndCtrlPos = 0; /*polozenie dodatkowego nastawnika*/
int LightsPos = 0; /*polozenie przelacznika wielopozycyjnego swiatel*/ int LightsPos = 0; /*polozenie przelacznika wielopozycyjnego swiatel*/
int CompressorListPos = 0; /*polozenie przelacznika wielopozycyjnego sprezarek*/ int CompressorListPos = 0; /*polozenie przelacznika wielopozycyjnego sprezarek*/
int ActiveDir = 0; //czy lok. jest wlaczona i w ktorym kierunku: int DirActive = 0; //czy lok. jest wlaczona i w ktorym kierunku: względem wybranej kabiny: -1 - do tylu, +1 - do przodu, 0 - wylaczona
//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 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 CabActive = 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 CabOccupied = 0; //numer kabiny, w ktorej jest obsada (zwykle jedna na skład) // TODO: move to TController
int ActiveCab = 0; //numer kabiny, w ktorej jest obsada (zwykle jedna na skład)
double LastSwitchingTime = 0.0; /*czas ostatniego przelaczania czegos*/ double LastSwitchingTime = 0.0; /*czas ostatniego przelaczania czegos*/
int WarningSignal = 0; // 0: nie trabi, 1,2,4: trabi int WarningSignal = 0; // 0: nie trabi, 1,2,4: trabi
bool DepartureSignal = false; /*sygnal odjazdu*/ bool DepartureSignal = false; /*sygnal odjazdu*/

View File

@@ -293,7 +293,7 @@ double TMoverParameters::Current(double n, double U)
TMoverParameters::TMoverParameters(double VelInitial, std::string TypeNameInit, std::string NameInit, int Cab) : TMoverParameters::TMoverParameters(double VelInitial, std::string TypeNameInit, std::string NameInit, int Cab) :
TypeName( TypeNameInit ), TypeName( TypeNameInit ),
Name( NameInit ), Name( NameInit ),
ActiveCab( Cab ) CabOccupied( Cab )
{ {
WriteLog( WriteLog(
"------------------------------------------------------"); "------------------------------------------------------");
@@ -531,17 +531,17 @@ bool TMoverParameters::Dettach(int ConnectNo)
bool TMoverParameters::DirectionForward() bool TMoverParameters::DirectionForward()
{ {
if ((MainCtrlPosNo > 0) && (ActiveDir < 1) && (EIMDirectionChangeAllow())) if ((MainCtrlPosNo > 0) && (DirActive < 1) && (EIMDirectionChangeAllow()))
{ {
++ActiveDir; ++DirActive;
DirAbsolute = ActiveDir * CabNo; DirAbsolute = DirActive * CabActive;
if (DirAbsolute) if (DirAbsolute)
if (Battery) // jeśli bateria jest już załączona if (Battery) // jeśli bateria jest już załączona
BatterySwitch(true); // to w ten oto durny sposób aktywuje się CA/SHP BatterySwitch(true); // to w ten oto durny sposób aktywuje się CA/SHP
SendCtrlToNext("Direction", ActiveDir, CabNo); SendCtrlToNext("Direction", DirActive, CabActive);
return true; 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 MinCurrentSwitch(true); //"wysoki rozruch" EN57
return false; return false;
}; };
@@ -609,10 +609,10 @@ bool TMoverParameters::DecBrakeLevel()
bool TMoverParameters::ChangeCab(int direction) bool TMoverParameters::ChangeCab(int direction)
{ // zmiana kabiny i resetowanie ustawien { // zmiana kabiny i resetowanie ustawien
if (abs(ActiveCab + direction) < 2) if (abs(CabOccupied + direction) < 2)
{ {
// if (ActiveCab+direction=0) then LastCab:=ActiveCab; // if (CabOccupied+direction=0) then LastCab:=CabOccupied;
ActiveCab = ActiveCab + direction; CabOccupied = CabOccupied + direction;
if( ( BrakeCtrlPosNo > 0 ) if( ( BrakeCtrlPosNo > 0 )
&& ( ( BrakeSystem == TBrakeSystem::Pneumatic ) && ( ( BrakeSystem == TBrakeSystem::Pneumatic )
|| ( BrakeSystem == TBrakeSystem::ElectroPneumatic ) ) ) { || ( BrakeSystem == TBrakeSystem::ElectroPneumatic ) ) ) {
@@ -643,7 +643,7 @@ bool TMoverParameters::ChangeCab(int direction)
// CompressorAllow=false; // CompressorAllow=false;
// ConverterAllow=false; // ConverterAllow=false;
//} //}
// ActiveDir=0; // DirActive=0;
// DirAbsolute=0; // DirAbsolute=0;
return true; return true;
} }
@@ -662,7 +662,7 @@ TMoverParameters::CurrentSwitch(bool const State) {
// dla 2Ls150 // dla 2Ls150
if( ( EngineType == TEngineType::DieselEngine ) if( ( EngineType == TEngineType::DieselEngine )
&& ( true == ShuntModeAllow ) && ( true == ShuntModeAllow )
&& ( ActiveDir == 0 ) ) { && ( DirActive == 0 ) ) {
// przed ustawieniem kierunku // przed ustawieniem kierunku
ShuntMode = State; ShuntMode = State;
return true; return true;
@@ -1312,7 +1312,7 @@ double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShap
auto const d { ( auto const d { (
EngineType == TEngineType::WheelsDriven ? EngineType == TEngineType::WheelsDriven ?
dL * CabNo : // na chwile dla testu dL * CabActive : // na chwile dla testu
dL ) }; dL ) };
DistCounter += fabs(dL) / 1000.0; DistCounter += fabs(dL) / 1000.0;
@@ -1387,7 +1387,7 @@ double TMoverParameters::FastComputeMovement(double dt, const TTrackShape &Shape
auto const d { ( auto const d { (
EngineType == TEngineType::WheelsDriven ? EngineType == TEngineType::WheelsDriven ?
dL * CabNo : // na chwile dla testu dL * CabActive : // na chwile dla testu
dL ) }; dL ) };
DistCounter += fabs(dL) / 1000.0; DistCounter += fabs(dL) / 1000.0;
@@ -1905,7 +1905,7 @@ bool TMoverParameters::IncMainCtrl(int CtrlSpeed)
{ {
// basic fail conditions: // basic fail conditions:
if( ( MainCtrlPosNo <= 0 ) if( ( MainCtrlPosNo <= 0 )
|| ( CabNo == 0 ) ) { || ( CabActive == 0 ) ) {
// nie ma sterowania // nie ma sterowania
return false; return false;
} }
@@ -1913,7 +1913,7 @@ bool TMoverParameters::IncMainCtrl(int CtrlSpeed)
// w ET22 nie da się kręcić nastawnikiem przy włączonym boczniku // w ET22 nie da się kręcić nastawnikiem przy włączonym boczniku
return false; 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 // w EZT nie da się załączyć pozycji bez ustawienia kierunku
return false; return false;
} }
@@ -1945,7 +1945,7 @@ bool TMoverParameters::IncMainCtrl(int CtrlSpeed)
case TEngineType::ElectricSeriesMotor: case TEngineType::ElectricSeriesMotor:
{ {
if( ActiveDir == 0 ) { return false; } if( DirActive == 0 ) { return false; }
if( CtrlSpeed > 1 ) { if( CtrlSpeed > 1 ) {
// szybkie przejœcie na bezoporow¹ // szybkie przejœcie na bezoporow¹
@@ -2039,8 +2039,8 @@ bool TMoverParameters::IncMainCtrl(int CtrlSpeed)
if( true == OK ) if( true == OK )
{ {
SendCtrlToNext("MainCtrl", MainCtrlPos, CabNo); //??? SendCtrlToNext("MainCtrl", MainCtrlPos, CabActive); //???
SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabNo); SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabActive);
} }
// hunter-101012: poprawka // hunter-101012: poprawka
@@ -2070,7 +2070,7 @@ bool TMoverParameters::DecMainCtrl(int CtrlSpeed)
bool OK = false; bool OK = false;
// basic fail conditions: // basic fail conditions:
if( ( MainCtrlPosNo <= 0 ) if( ( MainCtrlPosNo <= 0 )
|| ( CabNo == 0 ) ) { || ( CabActive == 0 ) ) {
// nie ma sterowania // nie ma sterowania
OK = false; OK = false;
} }
@@ -2160,8 +2160,8 @@ bool TMoverParameters::DecMainCtrl(int CtrlSpeed)
if (OK) if (OK)
{ {
/*OK:=*/SendCtrlToNext("MainCtrl", MainCtrlPos, CabNo); // hmmmm...???!!! /*OK:=*/SendCtrlToNext("MainCtrl", MainCtrlPos, CabActive); // hmmmm...???!!!
/*OK:=*/SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabNo); /*OK:=*/SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabActive);
} }
} }
// if OK then LastRelayTime:=0; // if OK then LastRelayTime:=0;
@@ -2206,11 +2206,11 @@ bool TMoverParameters::IncScndCtrl(int CtrlSpeed)
{ {
bool OK = false; 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); OK = DynamicBrakeSwitch(false);
} }
else if ((ScndCtrlPosNo > 0) && (CabNo != 0) && else if ((ScndCtrlPosNo > 0) && (CabActive != 0) &&
!((TrainType == dt_ET42) && !((TrainType == dt_ET42) &&
((Imax == ImaxHi) || ((DynamicBrakeFlag) && (MainCtrlPowerPos() > 0))))) ((Imax == ImaxHi) || ((DynamicBrakeFlag) && (MainCtrlPowerPos() > 0)))))
{ {
@@ -2233,8 +2233,8 @@ bool TMoverParameters::IncScndCtrl(int CtrlSpeed)
OK = false; OK = false;
if (OK) if (OK)
{ {
/*OK:=*/SendCtrlToNext("MainCtrl", MainCtrlPos, CabNo); //??? /*OK:=*/SendCtrlToNext("MainCtrl", MainCtrlPos, CabActive); //???
/*OK:=*/SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabNo); /*OK:=*/SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabActive);
} }
} }
@@ -2274,13 +2274,13 @@ bool TMoverParameters::DecScndCtrl(int CtrlSpeed)
{ {
bool OK = false; bool OK = false;
if ((IsMainCtrlNoPowerPos()) && (CabNo != 0) && (TrainType == dt_ET42) && (ScndCtrlPos == 0) && if ((IsMainCtrlNoPowerPos()) && (CabActive != 0) && (TrainType == dt_ET42) && (ScndCtrlPos == 0) &&
!(DynamicBrakeFlag) && (CtrlSpeed == 1)) !(DynamicBrakeFlag) && (CtrlSpeed == 1))
{ {
// Ra: AI wywołuje z CtrlSpeed=2 albo gdy ScndCtrlPos>0 // Ra: AI wywołuje z CtrlSpeed=2 albo gdy ScndCtrlPos>0
OK = DynamicBrakeSwitch(true); OK = DynamicBrakeSwitch(true);
} }
else if ((ScndCtrlPosNo > 0) && (CabNo != 0)) else if ((ScndCtrlPosNo > 0) && (CabActive != 0))
{ {
if ((ScndCtrlPos > 0) && (!CoupledCtrl) && if ((ScndCtrlPos > 0) && (!CoupledCtrl) &&
((EngineType != TEngineType::DieselElectric) || (!AutoRelayFlag))) ((EngineType != TEngineType::DieselElectric) || (!AutoRelayFlag)))
@@ -2299,8 +2299,8 @@ bool TMoverParameters::DecScndCtrl(int CtrlSpeed)
OK = false; OK = false;
if (OK) if (OK)
{ {
/*OK:=*/SendCtrlToNext("MainCtrl", MainCtrlPos, CabNo); //??? /*OK:=*/SendCtrlToNext("MainCtrl", MainCtrlPos, CabActive); //???
/*OK:=*/SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabNo); /*OK:=*/SendCtrlToNext("ScndCtrl", ScndCtrlPos, CabActive);
} }
} }
else else
@@ -2340,13 +2340,13 @@ bool TMoverParameters::CabActivisation( bool const Force )
{ {
bool OK = false; 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) if (OK)
{ {
CabNo = ActiveCab; // sterowanie jest z kabiny z obsadą CabActive = CabOccupied; // sterowanie jest z kabiny z obsadą
DirAbsolute = ActiveDir * CabNo; DirAbsolute = DirActive * CabActive;
SecuritySystem.Status |= s_waiting; // activate the alerter TODO: make it part of control based cab selection 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; return OK;
} }
@@ -2359,15 +2359,15 @@ bool TMoverParameters::CabDeactivisation( bool const Force )
{ {
bool OK = false; 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) if (OK)
{ {
CabNo = 0; CabActive = 0;
DirAbsolute = ActiveDir * CabNo; DirAbsolute = DirActive * CabActive;
DepartureSignal = false; // nie buczeć z nieaktywnej kabiny DepartureSignal = false; // nie buczeć z nieaktywnej kabiny
SecuritySystem.Status = s_off; // deactivate alerter TODO: make it part of control based cab selection 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; return OK;
} }
@@ -2382,8 +2382,8 @@ bool TMoverParameters::AddPulseForce(int Multipler)
if ((EngineType == TEngineType::WheelsDriven) && (EnginePowerSource.SourceType == TPowerSource::InternalSource) && if ((EngineType == TEngineType::WheelsDriven) && (EnginePowerSource.SourceType == TPowerSource::InternalSource) &&
(EnginePowerSource.PowerType == TPowerType::BioPower)) (EnginePowerSource.PowerType == TPowerType::BioPower))
{ {
ActiveDir = CabNo; DirActive = CabActive;
DirAbsolute = ActiveDir * CabNo; DirAbsolute = DirActive * CabActive;
if (Vel > 0) if (Vel > 0)
PulseForce = Min0R(1000.0 * Power / (abs(V) + 0.1), Ftmax); PulseForce = Min0R(1000.0 * Power / (abs(V) + 0.1), Ftmax);
else else
@@ -2489,11 +2489,11 @@ bool TMoverParameters::Sandbox( bool const State, range_t const Notify )
if( State == true ) { if( State == true ) {
// switch on // switch on
SendCtrlToNext( "Sandbox", 1, CabNo, couplingtype ); SendCtrlToNext( "Sandbox", 1, CabActive, couplingtype );
} }
else { else {
// switch off // 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) bool TMoverParameters::SandboxAutoAllow(bool State)
{ {
//SendCtrlToNext("SandboxAutoAllow", int(State), CabNo, ctrain_controll); //SendCtrlToNext("SandboxAutoAllow", int(State), CabActive, ctrain_controll);
if (SandDoseAutoAllow != State) if (SandDoseAutoAllow != State)
{ {
@@ -2558,7 +2558,7 @@ bool TMoverParameters::SecuritySystemReset(void) // zbijanie czuwaka/SHP
{ {
SSR = true; SSR = true;
if ((TrainType == dt_EZT) || 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) || if (!TestFlag(SecuritySystem.Status, s_CAebrake) ||
!TestFlag(SecuritySystem.Status, s_SHPebrake)) !TestFlag(SecuritySystem.Status, s_SHPebrake))
SSReset(); SSReset();
@@ -2568,7 +2568,7 @@ bool TMoverParameters::SecuritySystemReset(void) // zbijanie czuwaka/SHP
} }
else else
SSR = false; SSR = false;
// SendCtrlToNext('SecurityReset',0,CabNo); // SendCtrlToNext('SecurityReset',0,CabActive);
return SSR; 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 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 ? && ( SecuritySystem.AwareMinSpeed > 0.0 ?
( Vel >= SecuritySystem.AwareMinSpeed ) : ( Vel >= SecuritySystem.AwareMinSpeed ) :
( ActiveDir != 0 ) ) ) { ( DirActive != 0 ) ) ) {
// domyślnie predkość większa od 10% Vmax, albo podanej jawnie w FIZ // 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 // with defined minspeed of 0 the alerter will activate with reverser out of neutral position
// this emulates behaviour of engines like SM42 // this emulates behaviour of engines like SM42
@@ -2672,12 +2672,12 @@ bool TMoverParameters::BatterySwitch(bool State)
Battery = State; Battery = State;
} }
if (Battery == true) if (Battery == true)
SendCtrlToNext("BatterySwitch", 1, CabNo); SendCtrlToNext("BatterySwitch", 1, CabActive);
else else
SendCtrlToNext("BatterySwitch", 0, CabNo); SendCtrlToNext("BatterySwitch", 0, CabActive);
BS = true; BS = true;
if ((Battery) && (ActiveCab != 0)) if ((Battery) && (CabOccupied != 0))
SecuritySystem.Status |= s_waiting; // aktywacja czuwaka SecuritySystem.Status |= s_waiting; // aktywacja czuwaka
else else
SecuritySystem.Status = 0; // wyłączenie czuwaka SecuritySystem.Status = 0; // wyłączenie czuwaka
@@ -2698,8 +2698,8 @@ bool TMoverParameters::EpFuseSwitch(bool State)
} }
else else
return false; return false;
// if (EpFuse == true) SendCtrlToNext("EpFuseSwitch", 1, CabNo) // if (EpFuse == true) SendCtrlToNext("EpFuseSwitch", 1, CabActive)
// else SendCtrlToNext("EpFuseSwitch", 0, CabNo); // else SendCtrlToNext("EpFuseSwitch", 0, CabActive);
} }
// ************************************************************************************************* // *************************************************************************************************
@@ -2710,7 +2710,7 @@ bool TMoverParameters::SpringBrakeActivate(bool State)
{ {
if (Battery) if (Battery)
{ {
SendCtrlToNext("SpringBrakeActivate", int(State), CabNo, SpringBrake.MultiTractionCoupler); SendCtrlToNext("SpringBrakeActivate", int(State), CabActive, SpringBrake.MultiTractionCoupler);
if (SpringBrake.Activate != State) if (SpringBrake.Activate != State)
{ {
@@ -2760,24 +2760,24 @@ bool TMoverParameters::SpringBrakeRelease()
bool TMoverParameters::DirectionBackward(void) bool TMoverParameters::DirectionBackward(void)
{ {
bool DB = false; 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)) if (MinCurrentSwitch(false))
{ {
DB = true; // DB = true; //
return DB; // exit; TODO: czy dobrze przetlumaczone? return DB; // exit; TODO: czy dobrze przetlumaczone?
} }
if ((MainCtrlPosNo > 0) && (ActiveDir > -1) && (EIMDirectionChangeAllow())) if ((MainCtrlPosNo > 0) && (DirActive > -1) && (EIMDirectionChangeAllow()))
{ {
if (EngineType == TEngineType::WheelsDriven) if (EngineType == TEngineType::WheelsDriven)
CabNo--; CabActive--;
// else // else
ActiveDir--; DirActive--;
DirAbsolute = ActiveDir * CabNo; DirAbsolute = DirActive * CabActive;
if (DirAbsolute != 0) if (DirAbsolute != 0)
if (Battery) // jeśli bateria jest już załączona if (Battery) // jeśli bateria jest już załączona
BatterySwitch(true); // to w ten oto durny sposób aktywuje się CA/SHP BatterySwitch(true); // to w ten oto durny sposób aktywuje się CA/SHP
DB = true; DB = true;
SendCtrlToNext("Direction", ActiveDir, CabNo); SendCtrlToNext("Direction", DirActive, CabActive);
} }
else else
DB = false; DB = false;
@@ -2821,7 +2821,7 @@ bool TMoverParameters::WaterPumpBreakerSwitch( bool State, range_t const Notify
SendCtrlToNext( SendCtrlToNext(
"WaterPumpBreakerSwitch", "WaterPumpBreakerSwitch",
( WaterPump.breaker ? 1 : 0 ), ( WaterPump.breaker ? 1 : 0 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -2846,7 +2846,7 @@ bool TMoverParameters::WaterPumpSwitch( bool State, range_t const Notify ) {
SendCtrlToNext( SendCtrlToNext(
"WaterPumpSwitch", "WaterPumpSwitch",
( WaterPump.is_enabled ? 1 : 0 ), ( WaterPump.is_enabled ? 1 : 0 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -2871,7 +2871,7 @@ bool TMoverParameters::WaterPumpSwitchOff( bool State, range_t const Notify ) {
SendCtrlToNext( SendCtrlToNext(
"WaterPumpSwitchOff", "WaterPumpSwitchOff",
( WaterPump.is_disabled ? 1 : 0 ), ( WaterPump.is_disabled ? 1 : 0 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -2896,7 +2896,7 @@ bool TMoverParameters::WaterHeaterBreakerSwitch( bool State, range_t const Notif
SendCtrlToNext( SendCtrlToNext(
"WaterHeaterBreakerSwitch", "WaterHeaterBreakerSwitch",
( WaterHeater.breaker ? 1 : 0 ), ( WaterHeater.breaker ? 1 : 0 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -2921,7 +2921,7 @@ bool TMoverParameters::WaterHeaterSwitch( bool State, range_t const Notify ) {
SendCtrlToNext( SendCtrlToNext(
"WaterHeaterSwitch", "WaterHeaterSwitch",
( WaterHeater.is_enabled ? 1 : 0 ), ( WaterHeater.is_enabled ? 1 : 0 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -2946,7 +2946,7 @@ bool TMoverParameters::WaterCircuitsLinkSwitch( bool State, range_t const Notify
SendCtrlToNext( SendCtrlToNext(
"WaterCircuitsLinkSwitch", "WaterCircuitsLinkSwitch",
( WaterCircuitsLink ? 1 : 0 ), ( WaterCircuitsLink ? 1 : 0 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -2971,7 +2971,7 @@ bool TMoverParameters::FuelPumpSwitch( bool State, range_t const Notify ) {
SendCtrlToNext( SendCtrlToNext(
"FuelPumpSwitch", "FuelPumpSwitch",
( FuelPump.is_enabled ? 1 : 0 ), ( FuelPump.is_enabled ? 1 : 0 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -2995,7 +2995,7 @@ bool TMoverParameters::FuelPumpSwitchOff( bool State, range_t const Notify ) {
SendCtrlToNext( SendCtrlToNext(
"FuelPumpSwitchOff", "FuelPumpSwitchOff",
( FuelPump.is_disabled ? 1 : 0 ), ( FuelPump.is_disabled ? 1 : 0 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -3020,7 +3020,7 @@ bool TMoverParameters::OilPumpSwitch( bool State, range_t const Notify ) {
SendCtrlToNext( SendCtrlToNext(
"OilPumpSwitch", "OilPumpSwitch",
( OilPump.is_enabled ? 1 : 0 ), ( OilPump.is_enabled ? 1 : 0 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -3044,7 +3044,7 @@ bool TMoverParameters::OilPumpSwitchOff( bool State, range_t const Notify ) {
SendCtrlToNext( SendCtrlToNext(
"OilPumpSwitchOff", "OilPumpSwitchOff",
( OilPump.is_disabled ? 1 : 0 ), ( OilPump.is_disabled ? 1 : 0 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -3071,7 +3071,7 @@ bool TMoverParameters::MotorBlowersSwitch( bool State, end const Side, range_t c
SendCtrlToNext( SendCtrlToNext(
( Side == end::front ? "MotorBlowersFrontSwitch" : "MotorBlowersRearSwitch" ), ( Side == end::front ? "MotorBlowersFrontSwitch" : "MotorBlowersRearSwitch" ),
( fan.is_enabled ? 1 : 0 ), ( fan.is_enabled ? 1 : 0 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -3098,7 +3098,7 @@ bool TMoverParameters::MotorBlowersSwitchOff( bool State, end const Side, range_
SendCtrlToNext( SendCtrlToNext(
( Side == end::front ? "MotorBlowersFrontSwitchOff" : "MotorBlowersRearSwitchOff" ), ( Side == end::front ? "MotorBlowersFrontSwitchOff" : "MotorBlowersRearSwitchOff" ),
( fan.is_disabled ? 1 : 0 ), ( fan.is_disabled ? 1 : 0 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -3123,7 +3123,7 @@ bool TMoverParameters::MainSwitch( bool const State, range_t const Notify ) {
SendCtrlToNext( SendCtrlToNext(
"MainSwitch", "MainSwitch",
( State ? 1 : 0 ), ( State ? 1 : 0 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -3198,7 +3198,7 @@ bool TMoverParameters::ConverterSwitch( bool State, range_t const Notify )
if( ConverterAllow == true ) { if( ConverterAllow == true ) {
if( Notify != range_t::local ) { if( Notify != range_t::local ) {
SendCtrlToNext( SendCtrlToNext(
"ConverterSwitch", 1, CabNo, "ConverterSwitch", 1, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
ctrain_controll | ctrain_depot : ctrain_controll | ctrain_depot :
ctrain_controll ) ); ctrain_controll ) );
@@ -3207,7 +3207,7 @@ bool TMoverParameters::ConverterSwitch( bool State, range_t const Notify )
else { else {
if( Notify != range_t::local ) { if( Notify != range_t::local ) {
SendCtrlToNext( SendCtrlToNext(
"ConverterSwitch", 0, CabNo, "ConverterSwitch", 0, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
ctrain_controll | ctrain_depot : ctrain_controll | ctrain_depot :
ctrain_controll ) ); ctrain_controll ) );
@@ -3237,7 +3237,7 @@ bool TMoverParameters::CompressorSwitch( bool State, range_t const Notify )
if( CompressorAllow == true ) { if( CompressorAllow == true ) {
if( Notify != range_t::local ) { if( Notify != range_t::local ) {
SendCtrlToNext( SendCtrlToNext(
"CompressorSwitch", 1, CabNo, "CompressorSwitch", 1, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
ctrain_controll | ctrain_depot : ctrain_controll | ctrain_depot :
ctrain_controll ) ); ctrain_controll ) );
@@ -3246,7 +3246,7 @@ bool TMoverParameters::CompressorSwitch( bool State, range_t const Notify )
else { else {
if( Notify != range_t::local ) { if( Notify != range_t::local ) {
SendCtrlToNext( SendCtrlToNext(
"CompressorSwitch", 0, CabNo, "CompressorSwitch", 0, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
ctrain_controll | ctrain_depot : ctrain_controll | ctrain_depot :
ctrain_controll ) ); 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 bool OK = true; //false tylko jeśli nie uda się wysłać, GF 20161124
Hamulec->Releaser(state); Hamulec->Releaser(state);
if (CabNo != 0) // rekurencyjne wysłanie do następnego if (CabActive != 0) // rekurencyjne wysłanie do następnego
OK = SendCtrlToNext("BrakeReleaser", state, CabNo); OK = SendCtrlToNext("BrakeReleaser", state, CabActive);
return OK; return OK;
} }
@@ -3519,8 +3519,8 @@ bool TMoverParameters::UniversalBrakeButton(int button, int state)
TUniversalBrake::ub_Release ) ) TUniversalBrake::ub_Release ) )
{ {
Hamulec->Releaser( int ( TestFlag ( flag, TUniversalBrake::ub_Release ) )); Hamulec->Releaser( int ( TestFlag ( flag, TUniversalBrake::ub_Release ) ));
if (CabNo != 0) // rekurencyjne wysłanie do następnego if (CabActive != 0) // rekurencyjne wysłanie do następnego
OK = SendCtrlToNext("BrakeReleaser", state, CabNo); OK = SendCtrlToNext("BrakeReleaser", state, CabActive);
} }
return OK; return OK;
} }
@@ -3535,17 +3535,17 @@ bool TMoverParameters::SwitchEPBrake(int state)
double temp; double temp;
OK = false; OK = false;
if ((BrakeHandle == TBrakeHandle::St113) && (ActiveCab != 0)) if ((BrakeHandle == TBrakeHandle::St113) && (CabOccupied != 0))
{ {
if (state > 0) if (state > 0)
temp = Handle->GetCP(); // TODO: przetlumaczyc temp = Handle->GetCP(); // TODO: przetlumaczyc
else else
temp = 0; temp = 0;
Hamulec->SetEPS(temp); Hamulec->SetEPS(temp);
SendCtrlToNext("Brake", temp, CabNo); SendCtrlToNext("Brake", temp, CabActive);
} }
// OK:=SetFlag(BrakeStatus,((2*State-1)*b_epused)); // OK:=SetFlag(BrakeStatus,((2*State-1)*b_epused));
// SendCtrlToNext('Brake',(state*(2*BrakeCtrlPos-1)),CabNo); // SendCtrlToNext('Brake',(state*(2*BrakeCtrlPos-1)),CabActive);
return OK; return OK;
} }
@@ -3621,8 +3621,8 @@ bool TMoverParameters::BrakeDelaySwitch(int BDS)
rBDS = true; rBDS = true;
Hamulec->SetBrakeStatus( Hamulec->GetBrakeStatus() & ~64 ); Hamulec->SetBrakeStatus( Hamulec->GetBrakeStatus() & ~64 );
// kopowanie nastawy hamulca do kolejnego czlonu - do przemyślenia // kopowanie nastawy hamulca do kolejnego czlonu - do przemyślenia
if (CabNo != 0) if (CabActive != 0)
SendCtrlToNext("BrakeDelay", BrakeDelayFlag, CabNo); SendCtrlToNext("BrakeDelay", BrakeDelayFlag, CabActive);
} }
else else
rBDS = false; rBDS = false;
@@ -4005,7 +4005,7 @@ void TMoverParameters::UpdatePipePressure(double dt)
Handle->SetReductor(BrakeCtrlPos2); Handle->SetReductor(BrakeCtrlPos2);
if( ( ( BrakeOpModes & bom_PS ) == 0 ) if( ( ( BrakeOpModes & bom_PS ) == 0 )
|| ( ( ActiveCab != 0 ) || ( ( CabOccupied != 0 )
&& ( BrakeOpModeFlag != bom_PS ) ) ) { && ( BrakeOpModeFlag != bom_PS ) ) ) {
if( ( BrakeOpModeFlag < bom_EP ) if( ( BrakeOpModeFlag < bom_EP )
@@ -4170,10 +4170,10 @@ void TMoverParameters::UpdatePipePressure(double dt)
} }
} // switch } // switch
if (((BrakeHandle == TBrakeHandle::FVel6)||(BrakeHandle == TBrakeHandle::FVE408)) && (ActiveCab != 0)) if (((BrakeHandle == TBrakeHandle::FVel6)||(BrakeHandle == TBrakeHandle::FVE408)) && (CabOccupied != 0))
{ {
if ((Battery) if ((Battery)
&& (ActiveDir != 0) && (DirActive != 0)
&& (EpFuse)) // tu powinien byc jeszcze bezpiecznik EP i baterie - && (EpFuse)) // tu powinien byc jeszcze bezpiecznik EP i baterie -
// temp = (Handle as TFVel6).GetCP // temp = (Handle as TFVel6).GetCP
temp = Handle->GetCP(); temp = Handle->GetCP();
@@ -4190,7 +4190,7 @@ void TMoverParameters::UpdatePipePressure(double dt)
TUHEX_StageActual = temp; TUHEX_StageActual = temp;
TUHEX_Active = TUHEX_StageActual > 0; TUHEX_Active = TUHEX_StageActual > 0;
// Ra 2014-11: na tym się wysypuje, ale nie wiem, w jakich warunkach // Ra 2014-11: na tym się wysypuje, ale nie wiem, w jakich warunkach
SendCtrlToNext("Brake", temp, CabNo); SendCtrlToNext("Brake", temp, CabActive);
} }
Pipe->Act(); Pipe->Act();
@@ -4472,7 +4472,7 @@ void TMoverParameters::ComputeTotalForce(double dt) {
// ABu 300105: cos tu mieszalem , dziala teraz troche lepiej, wiec zostawiam // ABu 300105: cos tu mieszalem , dziala teraz troche lepiej, wiec zostawiam
{ {
auto const vehicleisactive { auto const vehicleisactive {
( CabNo != 0 ) ( CabActive != 0 )
|| ( Vel > 0.0001 ) || ( Vel > 0.0001 )
|| ( std::abs( AccS ) > 0.0001 ) || ( std::abs( AccS ) > 0.0001 )
|| ( LastSwitchingTime < 5 ) || ( LastSwitchingTime < 5 )
@@ -4528,11 +4528,11 @@ void TMoverParameters::ComputeTotalForce(double dt) {
GetAnyTrainsetVoltage(), GetAnyTrainsetVoltage(),
PantographVoltage ) : PantographVoltage ) :
0.00 ); 0.00 );
if( CabNo == 0 ) { if( CabActive == 0 ) {
EngineVoltage *= ActiveDir; EngineVoltage *= DirActive;
} }
else { else {
EngineVoltage *= DirAbsolute; // ActiveDir*CabNo; EngineVoltage *= DirAbsolute; // DirActive*CabActive;
} }
} // bo nie dzialalo } // bo nie dzialalo
else { else {
@@ -4978,7 +4978,7 @@ double TMoverParameters::TractionForce( double dt ) {
else else
dtrans = Transmision.Ratio * MotorParam[ ScndCtrlActualPos ].mIsat; 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; break;
} }
default: { default: {
@@ -4995,7 +4995,7 @@ double TMoverParameters::TractionForce( double dt ) {
// eAngle = Pirazy2 - eAngle; <- ABu: a nie czasem tak, jak nizej? // eAngle = Pirazy2 - eAngle; <- ABu: a nie czasem tak, jak nizej?
eAngle -= M_PI * 2.0; 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 // wentylatory rozruchowe
// TBD, TODO: move this to update, it doesn't exactly have much to do with traction // TBD, TODO: move this to update, it doesn't exactly have much to do with traction
switch( EngineType ) { switch( EngineType ) {
@@ -5006,7 +5006,7 @@ double TMoverParameters::TractionForce( double dt ) {
case 1: { // manual case 1: { // manual
if( ( true == RVentForceOn ) if( ( true == RVentForceOn )
|| ( ( ActiveDir != 0 ) || ( ( DirActive != 0 )
&& ( RList[ MainCtrlActualPos ].R > RVentCutOff ) ) ) { && ( RList[ MainCtrlActualPos ].R > RVentCutOff ) ) ) {
RventRot += ( RVentnmax - RventRot ) * RVentSpeed * dt; RventRot += ( RVentnmax - RventRot ) * RVentSpeed * dt;
} }
@@ -5152,12 +5152,12 @@ double TMoverParameters::TractionForce( double dt ) {
} }
} }
if (ActiveDir != 0) if (DirActive != 0)
switch (EngineType) switch (EngineType)
{ {
case TEngineType::Dumb: case TEngineType::Dumb:
{ {
if (Mains && (CabNo != 0)) if (Mains && (CabActive != 0))
{ {
if (Vel > 0.1) if (Vel > 0.1)
{ {
@@ -5166,7 +5166,7 @@ double TMoverParameters::TractionForce( double dt ) {
else { else {
Ft = Ftmax * PosRatio; Ft = Ftmax * PosRatio;
} }
Ft = Ft * DirAbsolute; // ActiveDir*CabNo; Ft = Ft * DirAbsolute; // DirActive*CabActive;
} }
else { else {
Ft = 0; Ft = 0;
@@ -5285,14 +5285,14 @@ double TMoverParameters::TractionForce( double dt ) {
Mw -= dizel_MomentumRetarder(nrot * Transmision.Ratio, dt) * Transmision.Ratio * Transmision.Efficiency; Mw -= dizel_MomentumRetarder(nrot * Transmision.Ratio, dt) * Transmision.Ratio * Transmision.Efficiency;
Fw = Mw * 2.0 / WheelDiameter / NPoweredAxles; Fw = Mw * 2.0 / WheelDiameter / NPoweredAxles;
Ft = Fw * NPoweredAxles; // sila trakcyjna Ft = Fw * NPoweredAxles; // sila trakcyjna
Ft = Ft * DirAbsolute; // ActiveDir*CabNo; Ft = Ft * DirAbsolute; // DirActive*CabActive;
break; break;
} }
case TEngineType::DieselElectric: // youBy case TEngineType::DieselElectric: // youBy
{ {
// tmpV:=V*CabNo*ActiveDir; // tmpV:=V*CabActive*DirActive;
auto const tmpV { nrot * Pirazy2 * 0.5 * WheelDiameter * DirAbsolute }; //*CabNo*ActiveDir; auto const tmpV { nrot * Pirazy2 * 0.5 * WheelDiameter * DirAbsolute }; //*CabActive*DirActive;
// jazda manewrowa // jazda manewrowa
if( true == ShuntMode ) { if( true == ShuntMode ) {
if( ( true == Mains ) && ( MainCtrlPowerPos() > 0 ) ) { if( ( true == Mains ) && ( MainCtrlPowerPos() > 0 ) ) {
@@ -5352,7 +5352,7 @@ double TMoverParameters::TractionForce( double dt ) {
if (FuseFlag) if (FuseFlag)
Ft = 0; Ft = 0;
else 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 Fw = Ft / NPoweredAxles; // sila na obwodzie kola
Mw = Fw * WheelDiameter / 2.0; // moment na osi kola Mw = Fw * WheelDiameter / 2.0; // moment na osi kola
Mm = Mw / Transmision.Ratio; // moment silnika trakcyjnego Mm = Mw / Transmision.Ratio; // moment silnika trakcyjnego
@@ -5649,7 +5649,7 @@ double TMoverParameters::TractionForce( double dt ) {
if (NewSCAP != SpeedCtrlValue) if (NewSCAP != SpeedCtrlValue)
{ {
SpeedCtrlValue = NewSCAP; 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_If] = eimv[eimv_Ic] * eimc[eimc_s_icif];
eimv[eimv_M] = eimv[eimv_pole] * eimv[eimv_Ic] * eimc[eimc_s_cim]; 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_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_Pe] = eimv[eimv_Ipoj] * EngineVoltage / 1000;
eimv[eimv_eta] = eimv[eimv_Pm] / eimv[eimv_Pe]; eimv[eimv_eta] = eimv[eimv_Pm] / eimv[eimv_Pe];
@@ -5947,7 +5947,7 @@ bool TMoverParameters::FuseOn(void)
if ((IsMainCtrlNoPowerPos()) && (ScndCtrlPos == 0) && (TrainType != dt_ET40) && if ((IsMainCtrlNoPowerPos()) && (ScndCtrlPos == 0) && (TrainType != dt_ET40) &&
((Mains) || (TrainType != dt_EZT)) && (!TestFlag(EngDmgFlag, 1))) ((Mains) || (TrainType != dt_EZT)) && (!TestFlag(EngDmgFlag, 1)))
{ // w ET40 jest blokada nastawnika, ale czy działa dobrze? { // 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) if (((EngineType == TEngineType::ElectricSeriesMotor) || ((EngineType == TEngineType::DieselElectric))) && FuseFlag)
{ {
FuseFlag = false; // wlaczenie ponowne obwodu FuseFlag = false; // wlaczenie ponowne obwodu
@@ -6040,7 +6040,7 @@ double TMoverParameters::MomentumF(double I, double Iw, int SCP)
bool TMoverParameters::CutOffEngine(void) bool TMoverParameters::CutOffEngine(void)
{ {
bool COE = false; // Ra: wartość domyślna, sprawdzić to trzeba 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)) if (SetFlag(DamageFlag, -dtrain_engine))
{ {
@@ -6066,8 +6066,8 @@ bool TMoverParameters::MaxCurrentSwitch(bool State)
{ {
Imax = ImaxHi; Imax = ImaxHi;
MCS = true; MCS = true;
if (CabNo != 0) if (CabActive != 0)
SendCtrlToNext("MaxCurrentSwitch", 1, CabNo); SendCtrlToNext("MaxCurrentSwitch", 1, CabActive);
} }
if (!State) if (!State)
if (Imax == ImaxHi) if (Imax == ImaxHi)
@@ -6075,8 +6075,8 @@ bool TMoverParameters::MaxCurrentSwitch(bool State)
{ {
Imax = ImaxLo; Imax = ImaxLo;
MCS = true; MCS = true;
if (CabNo != 0) if (CabActive != 0)
SendCtrlToNext("MaxCurrentSwitch", 0, CabNo); SendCtrlToNext("MaxCurrentSwitch", 0, CabActive);
} }
} }
return MCS; return MCS;
@@ -6096,15 +6096,15 @@ bool TMoverParameters::MinCurrentSwitch(bool State)
{ {
Imin = IminHi; Imin = IminHi;
MCS = true; MCS = true;
if (CabNo != 0) if (CabActive != 0)
SendCtrlToNext("MinCurrentSwitch", 1, CabNo); SendCtrlToNext("MinCurrentSwitch", 1, CabActive);
} }
if ((!State) && (Imin == IminHi)) if ((!State) && (Imin == IminHi))
{ {
Imin = IminLo; Imin = IminLo;
MCS = true; MCS = true;
if (CabNo != 0) if (CabActive != 0)
SendCtrlToNext("MinCurrentSwitch", 0, CabNo); SendCtrlToNext("MinCurrentSwitch", 0, CabActive);
} }
} }
return MCS; return MCS;
@@ -6141,7 +6141,7 @@ bool TMoverParameters::AutoRelaySwitch(bool State)
{ {
AutoRelayFlag = State; AutoRelayFlag = State;
ARS = true; ARS = true;
SendCtrlToNext("AutoRelaySwitch", int(State), CabNo); SendCtrlToNext("AutoRelaySwitch", int(State), CabActive);
} }
else else
ARS = false; ARS = false;
@@ -6218,7 +6218,7 @@ bool TMoverParameters::AutoRelayCheck(void)
} }
else else
{ // zmieniaj mainctrlactualpos { // zmieniaj mainctrlactualpos
if ((ActiveDir < 0) && (TrainType != dt_PseudoDiesel)) if ((DirActive < 0) && (TrainType != dt_PseudoDiesel))
if (RList[MainCtrlActualPos + 1].Bn > 1) if (RList[MainCtrlActualPos + 1].Bn > 1)
{ {
return false; // nie poprawiamy przy konwersji return false; // nie poprawiamy przy konwersji
@@ -6433,7 +6433,7 @@ bool TMoverParameters::MotorConnectorsCheck() {
|| ( true == FuseFlag ) || ( true == FuseFlag )
|| ( true == StLinSwitchOff ) || ( true == StLinSwitchOff )
|| ( IsMainCtrlNoPowerPos() ) || ( IsMainCtrlNoPowerPos() )
|| ( ActiveDir == 0 ) }; || ( DirActive == 0 ) };
if( connectorsoff ) { return false; } if( connectorsoff ) { return false; }
@@ -6463,7 +6463,7 @@ bool TMoverParameters::PantFront( bool const State, range_t const Notify )
if( Notify != range_t::local ) { if( Notify != range_t::local ) {
// wysłanie wyłączenia do pozostałych? // wysłanie wyłączenia do pozostałych?
SendCtrlToNext( SendCtrlToNext(
"PantFront", 1, CabNo, "PantFront", 1, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
ctrain_controll | ctrain_depot : ctrain_controll | ctrain_depot :
ctrain_controll ) ); ctrain_controll ) );
@@ -6473,7 +6473,7 @@ bool TMoverParameters::PantFront( bool const State, range_t const Notify )
if( Notify != range_t::local ) { if( Notify != range_t::local ) {
// wysłanie wyłączenia do pozostałych? // wysłanie wyłączenia do pozostałych?
SendCtrlToNext( SendCtrlToNext(
"PantFront", 0, CabNo, "PantFront", 0, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
ctrain_controll | ctrain_depot : ctrain_controll | ctrain_depot :
ctrain_controll ) ); ctrain_controll ) );
@@ -6491,7 +6491,7 @@ bool TMoverParameters::PantFront( bool const State, range_t const Notify )
0 ); 0 );
PantFrontUp = false; PantFrontUp = false;
if( true == Multiunitcontrol ) { 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 ) { if( Notify != range_t::local ) {
// wysłanie wyłączenia do pozostałych? // wysłanie wyłączenia do pozostałych?
SendCtrlToNext( SendCtrlToNext(
"PantRear", 1, CabNo, "PantRear", 1, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
ctrain_controll | ctrain_depot : ctrain_controll | ctrain_depot :
ctrain_controll ) ); ctrain_controll ) );
@@ -6524,7 +6524,7 @@ bool TMoverParameters::PantRear( bool const State, range_t const Notify )
if( Notify != range_t::local ) { if( Notify != range_t::local ) {
// wysłanie wyłączenia do pozostałych? // wysłanie wyłączenia do pozostałych?
SendCtrlToNext( SendCtrlToNext(
"PantRear", 0, CabNo, "PantRear", 0, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
ctrain_controll | ctrain_depot : ctrain_controll | ctrain_depot :
ctrain_controll ) ); ctrain_controll ) );
@@ -6542,7 +6542,7 @@ bool TMoverParameters::PantRear( bool const State, range_t const Notify )
0 ); 0 );
PantRearUp = false; PantRearUp = false;
if( true == Multiunitcontrol ) { if( true == Multiunitcontrol ) {
SendCtrlToNext( "PantRear", 0, CabNo ); SendCtrlToNext( "PantRear", 0, CabActive );
} }
} }
*/ */
@@ -6744,7 +6744,7 @@ void TMoverParameters::CheckSpeedCtrl(double dt)
eimicSpeedCtrlIntegral = 0; eimicSpeedCtrlIntegral = 0;
} }
SpeedCtrlUnit.Parking = (Vel == 0.0) && (eimic <= 0) && (EngineType != TEngineType::ElectricInductionMotor); SpeedCtrlUnit.Parking = (Vel == 0.0) && (eimic <= 0) && (EngineType != TEngineType::ElectricInductionMotor);
SendCtrlToNext("SpeedCtrlUnit.Parking", SpeedCtrlUnit.Parking, CabNo); SendCtrlToNext("SpeedCtrlUnit.Parking", SpeedCtrlUnit.Parking, CabActive);
} }
else { else {
@@ -7155,8 +7155,8 @@ double TMoverParameters::dizel_Momentum(double dizel_fill, double n, double dt)
{ // liczy moment sily wytwarzany przez silnik spalinowy} { // liczy moment sily wytwarzany przez silnik spalinowy}
double Moment = 0, enMoment = 0, gearMoment = 0, eps = 0, newn = 0, friction = 0, neps = 0; double Moment = 0, enMoment = 0, gearMoment = 0, eps = 0, newn = 0, friction = 0, neps = 0;
double TorqueH = 0, TorqueL = 0, TorqueC = 0; double TorqueH = 0, TorqueL = 0, TorqueC = 0;
n = n * CabNo; n = n * CabActive;
if ((MotorParam[ScndCtrlActualPos].mIsat < 0.001)||(ActiveDir == 0)) if ((MotorParam[ScndCtrlActualPos].mIsat < 0.001)||(DirActive == 0))
n = enrot; n = enrot;
friction = dizel_engagefriction; friction = dizel_engagefriction;
hydro_TC_nIn = enrot; //wal wejsciowy przetwornika momentu 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 permitleft { ( ( doors & 1 ) != 0 ) };
auto const permitright { ( ( doors & 2 ) != 0 ) }; auto const permitright { ( ( doors & 2 ) != 0 ) };
PermitDoors( ( CabNo > 0 ? side::left : side::right ), permitleft, Notify ); PermitDoors( ( CabActive > 0 ? side::left : side::right ), permitleft, Notify );
PermitDoors( ( CabNo > 0 ? side::right : side::left ), permitright, Notify ); PermitDoors( ( CabActive > 0 ? side::right : side::left ), permitright, Notify );
} }
return ( Doors.permit_preset != initialstate ); return ( Doors.permit_preset != initialstate );
@@ -7688,7 +7688,7 @@ bool TMoverParameters::PermitDoorStep( bool const State, range_t const Notify )
( State == true ? ( State == true ?
1 : 1 :
0 ), 0 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -7708,10 +7708,10 @@ bool TMoverParameters::PermitDoors( side const Door, bool const State, range_t c
SendCtrlToNext( SendCtrlToNext(
"DoorPermit", "DoorPermit",
( State ? 1 : -1 ) // positive: grant, negative: revoke ( 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 : 1 :
2 ), 2 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -7732,7 +7732,7 @@ bool TMoverParameters::ChangeDoorControlMode( bool const State, range_t const No
( State == true ? ( State == true ?
1 : 1 :
0 ), 0 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -7787,10 +7787,10 @@ bool TMoverParameters::OperateDoors( side const Door, bool const State, range_t
( State == true ? ( State == true ?
"DoorOpen" : "DoorOpen" :
"DoorClose" ), "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 : 1 :
2 ), 2 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -7812,7 +7812,7 @@ bool TMoverParameters::LockDoors( bool const State, range_t const Notify ) {
( State == true ? ( State == true ?
1 : 1 :
0 ), 0 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -7838,7 +7838,7 @@ TMoverParameters::signal_departure( bool const State, range_t const Notify ) {
( State == true ? ( State == true ?
1 : 1 :
0 ), 0 ),
CabNo, CabActive,
( Notify == range_t::unit ? ( Notify == range_t::unit ?
coupling::control | coupling::permanent : coupling::control | coupling::permanent :
coupling::control ) ); coupling::control ) );
@@ -10615,7 +10615,7 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
PipePress = CntrlPipePress; PipePress = CntrlPipePress;
BrakePress = 0.0; BrakePress = 0.0;
LocalBrakePosA = 0.0; LocalBrakePosA = 0.0;
if( CabNo == 0 ) if( CabActive == 0 )
BrakeCtrlPos = static_cast<int>( Handle->GetPos( bh_NP ) ); BrakeCtrlPos = static_cast<int>( Handle->GetPos( bh_NP ) );
else else
BrakeCtrlPos = static_cast<int>( Handle->GetPos( bh_RP ) ); BrakeCtrlPos = static_cast<int>( Handle->GetPos( bh_RP ) );
@@ -10626,8 +10626,8 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
PantRear( true ); PantRear( true );
MainSwitch( true ); MainSwitch( true );
*/ */
ActiveDir = 0; // Dir; //nastawnik kierunkowy - musi być ustawiane osobno! DirActive = 0; // Dir; //nastawnik kierunkowy - musi być ustawiane osobno!
DirAbsolute = ActiveDir * CabNo; // kierunek jazdy względem sprzęgów DirAbsolute = DirActive * CabActive; // kierunek jazdy względem sprzęgów
LimPipePress = CntrlPipePress; LimPipePress = CntrlPipePress;
} }
else { // zahamowany} else { // zahamowany}
@@ -11009,8 +11009,8 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
} }
else if (Command == "Direction") else if (Command == "Direction")
{ {
ActiveDir = static_cast<int>(floor(CValue1)); DirActive = static_cast<int>(floor(CValue1));
DirAbsolute = ActiveDir * CabNo; DirAbsolute = DirActive * CabActive;
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype ); OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
} }
else if (Command == "CabActivisation") else if (Command == "CabActivisation")
@@ -11019,19 +11019,19 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
switch (static_cast<int>(CValue1 * CValue2)) switch (static_cast<int>(CValue1 * CValue2))
{ // CValue2 ma zmieniany znak przy niezgodności sprzęgów { // CValue2 ma zmieniany znak przy niezgodności sprzęgów
case 1: { case 1: {
CabNo = 1; CabActive = 1;
break; break;
} }
case -1: { case -1: {
CabNo = -1; CabActive = -1;
break; break;
} }
default:{ default:{
CabNo = 0; // gdy CValue1==0 CabActive = 0; // gdy CValue1==0
break; break;
} }
} }
DirAbsolute = ActiveDir * CabNo; DirAbsolute = DirActive * CabActive;
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype ); OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
} }
else if (Command == "AutoRelaySwitch") else if (Command == "AutoRelaySwitch")
@@ -11070,7 +11070,7 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
Battery = false; Battery = false;
/* /*
// TBD: makes no sense to activate alerters in entire consist // 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 SecuritySystem.Status = SecuritySystem.Status | s_waiting; // aktywacja czuwaka
else else
SecuritySystem.Status = 0; // wyłączenie czuwaka 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*/ else if (Command == "CabSignal") /*SHP,Indusi*/
{ // Ra: to powinno działać tylko w członie obsadzonym { // 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, TestFlag(SecuritySystem.SystemType,
2)) // jeśli kabina jest obsadzona (silnikowy w EZT?) 2)) // jeśli kabina jest obsadzona (silnikowy w EZT?)
/*?*/ /* WITH SecuritySystem */ /*?*/ /* WITH SecuritySystem */

View File

@@ -444,8 +444,8 @@ bool TTrain::Init(TDynamicObject *NewDynamicObject, bool e3d)
return false; return false;
*/ */
auto const activecab { ( auto const activecab { (
NewDynamicObject->MoverParameters->ActiveCab > 0 ? "1" : NewDynamicObject->MoverParameters->CabOccupied > 0 ? "1" :
NewDynamicObject->MoverParameters->ActiveCab < 0 ? "2" : NewDynamicObject->MoverParameters->CabOccupied < 0 ? "2" :
"p" ) }; "p" ) };
NewDynamicObject->create_controller( activecab, NewDynamicObject->ctOwner != nullptr ); 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! fMainRelayTimer = 0; // Hunter, do k...y nędzy, ustawiaj wartości początkowe zmiennych!
iCabn = ( iCabn = (
mvOccupied->ActiveCab > 0 ? 1 : mvOccupied->CabOccupied > 0 ? 1 :
mvOccupied->ActiveCab < 0 ? 2 : mvOccupied->CabOccupied < 0 ? 2 :
0 ); 0 );
{ {
@@ -475,12 +475,12 @@ bool TTrain::Init(TDynamicObject *NewDynamicObject, bool e3d)
// Ra: taka proteza - przesłanie kierunku do członów connected // Ra: taka proteza - przesłanie kierunku do członów connected
/* /*
if (mvControlled->ActiveDir > 0) if (mvControlled->DirActive > 0)
{ // było do przodu { // było do przodu
mvControlled->DirectionBackward(); mvControlled->DirectionBackward();
mvControlled->DirectionForward(); mvControlled->DirectionForward();
} }
else if (mvControlled->ActiveDir < 0) else if (mvControlled->DirActive < 0)
{ {
mvControlled->DirectionForward(); mvControlled->DirectionForward();
mvControlled->DirectionBackward(); mvControlled->DirectionBackward();
@@ -502,7 +502,7 @@ dictionary_source *TTrain::GetTrainState() {
if( dict == nullptr ) { return nullptr; } if( dict == nullptr ) { return nullptr; }
dict->insert( "name", DynamicObject->asName ); dict->insert( "name", DynamicObject->asName );
dict->insert( "cab", mvOccupied->ActiveCab ); dict->insert( "cab", mvOccupied->CabOccupied );
// basic systems state data // basic systems state data
dict->insert( "battery", mvControlled->Battery ); dict->insert( "battery", mvControlled->Battery );
dict->insert( "linebreaker", mvControlled->Mains ); dict->insert( "linebreaker", mvControlled->Mains );
@@ -515,7 +515,7 @@ dictionary_source *TTrain::GetTrainState() {
dict->insert( "lights_front", mvOccupied->iLights[ end::front ] ); dict->insert( "lights_front", mvOccupied->iLights[ end::front ] );
dict->insert( "lights_rear", mvOccupied->iLights[ end::rear ] ); dict->insert( "lights_rear", mvOccupied->iLights[ end::rear ] );
// reverser // reverser
dict->insert( "direction", mvOccupied->ActiveDir ); dict->insert( "direction", mvOccupied->DirActive );
// throttle // throttle
dict->insert( "mainctrl_pos", mvControlled->MainCtrlPos ); dict->insert( "mainctrl_pos", mvControlled->MainCtrlPos );
dict->insert( "main_ctrl_actual_pos", mvControlled->MainCtrlActualPos ); dict->insert( "main_ctrl_actual_pos", mvControlled->MainCtrlActualPos );
@@ -686,7 +686,7 @@ bool TTrain::is_eztoer() const {
&& ( mvOccupied->BrakeSubsystem == TBrakeSubSystem::ss_ESt ) && ( mvOccupied->BrakeSubsystem == TBrakeSubSystem::ss_ESt )
&& ( mvControlled->Battery == true ) && ( mvControlled->Battery == true )
&& ( mvControlled->EpFuse == true ) && ( mvControlled->EpFuse == true )
&& ( mvControlled->ActiveDir != 0 ) ); // od yB && ( mvControlled->DirActive != 0 ) ); // od yB
} }
// mover master controller to specified position // mover master controller to specified position
@@ -1798,7 +1798,7 @@ void TTrain::OnCommand_reverserincrease( TTrain *Train, command_data const &Comm
if( Train->mvOccupied->DirectionForward() ) { if( Train->mvOccupied->DirectionForward() ) {
// aktualizacja skrajnych pojazdów w składzie // aktualizacja skrajnych pojazdów w składzie
if( ( Train->mvOccupied->ActiveDir ) if( ( Train->mvOccupied->DirActive )
&& ( Train->DynamicObject->Mechanik ) ) { && ( Train->DynamicObject->Mechanik ) ) {
Train->DynamicObject->Mechanik->DirectionChange(); Train->DynamicObject->Mechanik->DirectionChange();
@@ -1813,7 +1813,7 @@ void TTrain::OnCommand_reverserdecrease( TTrain *Train, command_data const &Comm
if( Train->mvOccupied->DirectionBackward() ) { if( Train->mvOccupied->DirectionBackward() ) {
// aktualizacja skrajnych pojazdów w składzie // aktualizacja skrajnych pojazdów w składzie
if( ( Train->mvOccupied->ActiveDir ) if( ( Train->mvOccupied->DirActive )
&& ( Train->DynamicObject->Mechanik ) ) { && ( Train->DynamicObject->Mechanik ) ) {
Train->DynamicObject->Mechanik->DirectionChange();; 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" // HACK: try to move the reverser one position back, in case it's set to "high forward"
OnCommand_reverserdecrease( Train, Command ); 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() ) ) { && ( true == Train->mvOccupied->DirectionForward() ) ) {
// all work is done in the header // all work is done in the header
} }
// aktualizacja skrajnych pojazdów w składzie // aktualizacja skrajnych pojazdów w składzie
if( ( Train->mvOccupied->ActiveDir == 1 ) if( ( Train->mvOccupied->DirActive == 1 )
&& ( Train->DynamicObject->Mechanik ) ) { && ( Train->DynamicObject->Mechanik ) ) {
Train->DynamicObject->Mechanik->DirectionChange(); Train->DynamicObject->Mechanik->DirectionChange();
@@ -1857,11 +1857,11 @@ void TTrain::OnCommand_reverserneutral( TTrain *Train, command_data const &Comma
if( Command.action == GLFW_PRESS ) { if( Command.action == GLFW_PRESS ) {
while( ( Train->mvOccupied->ActiveDir < 0 ) while( ( Train->mvOccupied->DirActive < 0 )
&& ( true == Train->mvOccupied->DirectionForward() ) ) { && ( true == Train->mvOccupied->DirectionForward() ) ) {
// all work is done in the header // all work is done in the header
} }
while( ( Train->mvOccupied->ActiveDir > 0 ) while( ( Train->mvOccupied->DirActive > 0 )
&& ( true == Train->mvOccupied->DirectionBackward() ) ) { && ( true == Train->mvOccupied->DirectionBackward() ) ) {
// all work is done in the header // 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( 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() ) ) { && ( true == Train->mvOccupied->DirectionBackward() ) ) {
// all work is done in the header // all work is done in the header
} }
// aktualizacja skrajnych pojazdów w składzie // aktualizacja skrajnych pojazdów w składzie
if( ( Train->mvOccupied->ActiveDir == -1 ) if( ( Train->mvOccupied->DirActive == -1 )
&& ( Train->DynamicObject->Mechanik ) ) { && ( Train->DynamicObject->Mechanik ) ) {
Train->DynamicObject->Mechanik->DirectionChange(); Train->DynamicObject->Mechanik->DirectionChange();
@@ -5524,7 +5524,7 @@ void TTrain::OnCommand_cabchangeforward( TTrain *Train, command_data const &Comm
exitdirection == end::front ? exitdirection == end::front ?
Train->DynamicObject->PrevConnected() : Train->DynamicObject->PrevConnected() :
Train->DynamicObject->NextConnected() ); Train->DynamicObject->NextConnected() );
Global.changeDynObj->MoverParameters->ActiveCab = ( Global.changeDynObj->MoverParameters->CabOccupied = (
Train->DynamicObject->MoverParameters->Neighbours[ exitdirection ].vehicle_end ? Train->DynamicObject->MoverParameters->Neighbours[ exitdirection ].vehicle_end ?
-1 : -1 :
1 ); 1 );
@@ -5557,7 +5557,7 @@ void TTrain::OnCommand_cabchangebackward( TTrain *Train, command_data const &Com
exitdirection == end::front ? exitdirection == end::front ?
Train->DynamicObject->PrevConnected() : Train->DynamicObject->PrevConnected() :
Train->DynamicObject->NextConnected() ); Train->DynamicObject->NextConnected() );
Global.changeDynObj->MoverParameters->ActiveCab = ( Global.changeDynObj->MoverParameters->CabOccupied = (
Train->DynamicObject->MoverParameters->Neighbours[ exitdirection ].vehicle_end ? Train->DynamicObject->MoverParameters->Neighbours[ exitdirection ].vehicle_end ?
-1 : -1 :
1 ); 1 );
@@ -5578,18 +5578,18 @@ void TTrain::UpdateCab() {
&& ( DynamicObject->Mechanik->AIControllFlag ) ) { && ( DynamicObject->Mechanik->AIControllFlag ) ) {
if( iCabn != ( // numer kabiny (-1: kabina B) if( iCabn != ( // numer kabiny (-1: kabina B)
DynamicObject->MoverParameters->ActiveCab == -1 ? DynamicObject->MoverParameters->CabOccupied == -1 ?
2 : 2 :
DynamicObject->MoverParameters->ActiveCab ) ) { DynamicObject->MoverParameters->CabOccupied ) ) {
InitializeCab( InitializeCab(
DynamicObject->MoverParameters->ActiveCab, DynamicObject->MoverParameters->CabOccupied,
DynamicObject->asBaseDir + DynamicObject->MoverParameters->TypeName + ".mmd" ); DynamicObject->asBaseDir + DynamicObject->MoverParameters->TypeName + ".mmd" );
} }
} }
iCabn = ( DynamicObject->MoverParameters->ActiveCab == -1 ? iCabn = ( DynamicObject->MoverParameters->CabOccupied == -1 ?
2 : 2 :
DynamicObject->MoverParameters->ActiveCab ); DynamicObject->MoverParameters->CabOccupied );
} }
bool TTrain::Update( double const Deltatime ) bool TTrain::Update( double const Deltatime )
@@ -5775,8 +5775,8 @@ bool TTrain::Update( double const Deltatime )
fHCurrent[3] = mvControlled->ShowCurrent(3); fHCurrent[3] = mvControlled->ShowCurrent(3);
} }
bool kier = (DynamicObject->DirectionGet() * mvOccupied->ActiveCab > 0); bool kier = (DynamicObject->DirectionGet() * mvOccupied->CabOccupied > 0);
TDynamicObject *p = DynamicObject->GetFirstDynamic(mvOccupied->ActiveCab < 0 ? end::rear : end::front, 4); TDynamicObject *p = DynamicObject->GetFirstDynamic(mvOccupied->CabOccupied < 0 ? end::rear : end::front, 4);
int in = 0; int in = 0;
fEIMParams[0][6] = 0; fEIMParams[0][6] = 0;
iCarNo = 0; iCarNo = 0;
@@ -5973,11 +5973,11 @@ bool TTrain::Update( double const Deltatime )
TDynamicObject *tmp { nullptr }; TDynamicObject *tmp { nullptr };
if (DynamicObject->NextConnected()) if (DynamicObject->NextConnected())
if ((TestFlag(mvControlled->Couplers[end::rear].CouplingFlag, ctrain_controll)) && if ((TestFlag(mvControlled->Couplers[end::rear].CouplingFlag, ctrain_controll)) &&
(mvOccupied->ActiveCab == 1)) (mvOccupied->CabOccupied == 1))
tmp = DynamicObject->NextConnected(); tmp = DynamicObject->NextConnected();
if (DynamicObject->PrevConnected()) if (DynamicObject->PrevConnected())
if ((TestFlag(mvControlled->Couplers[end::front].CouplingFlag, ctrain_controll)) && if ((TestFlag(mvControlled->Couplers[end::front].CouplingFlag, ctrain_controll)) &&
(mvOccupied->ActiveCab == -1)) (mvOccupied->CabOccupied == -1))
tmp = DynamicObject->PrevConnected(); tmp = DynamicObject->PrevConnected();
if( tmp ) { if( tmp ) {
if( tmp->MoverParameters->Power > 0 ) { if( tmp->MoverParameters->Power > 0 ) {
@@ -6191,8 +6191,8 @@ bool TTrain::Update( double const Deltatime )
false : false :
mvOccupied->BrakePress < 1.0 ); // mozna prowadzic rozruch mvOccupied->BrakePress < 1.0 ); // mozna prowadzic rozruch
if( ( ( mvControlled->ActiveCab == 1 ) && ( TestFlag( mvControlled->Couplers[ end::rear ].CouplingFlag, coupling::control ) ) ) if( ( ( mvControlled->CabOccupied == 1 ) && ( TestFlag( mvControlled->Couplers[ end::rear ].CouplingFlag, coupling::control ) ) )
|| ( ( mvControlled->ActiveCab == -1 ) && ( TestFlag( mvControlled->Couplers[ end::front ].CouplingFlag, coupling::control ) ) ) ) { || ( ( mvControlled->CabOccupied == -1 ) && ( TestFlag( mvControlled->Couplers[ end::front ].CouplingFlag, coupling::control ) ) ) ) {
btLampkaUkrotnienie.Turn( true ); btLampkaUkrotnienie.Turn( true );
} }
else { else {
@@ -6220,7 +6220,7 @@ bool TTrain::Update( double const Deltatime )
btLampkaBoczniki.Turn( false ); 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 btLampkaSprezarka.Turn(mvControlled->CompressorFlag); // mutopsitka dziala
btLampkaSprezarkaOff.Turn( false == mvControlled->CompressorFlag ); btLampkaSprezarkaOff.Turn( false == mvControlled->CompressorFlag );
btLampkaFuelPumpOff.Turn( false == mvControlled->FuelPump.is_active ); btLampkaFuelPumpOff.Turn( false == mvControlled->FuelPump.is_active );
@@ -6290,9 +6290,9 @@ bool TTrain::Update( double const Deltatime )
btLampkaBlokadaDrzwi.Turn( mvOccupied->Doors.is_locked ); btLampkaBlokadaDrzwi.Turn( mvOccupied->Doors.is_locked );
btLampkaDoorLockOff.Turn( false == mvOccupied->Doors.lock_enabled ); btLampkaDoorLockOff.Turn( false == mvOccupied->Doors.lock_enabled );
btLampkaDepartureSignal.Turn( mvControlled->DepartureSignal ); btLampkaDepartureSignal.Turn( mvControlled->DepartureSignal );
btLampkaNapNastHam.Turn((mvControlled->ActiveDir != 0) && (mvOccupied->EpFuse)); // napiecie na nastawniku hamulcowym btLampkaNapNastHam.Turn((mvControlled->DirActive != 0) && (mvOccupied->EpFuse)); // napiecie na nastawniku hamulcowym
btLampkaForward.Turn(mvControlled->ActiveDir > 0); // jazda do przodu btLampkaForward.Turn(mvControlled->DirActive > 0); // jazda do przodu
btLampkaBackward.Turn(mvControlled->ActiveDir < 0); // jazda do tyłu btLampkaBackward.Turn(mvControlled->DirActive < 0); // jazda do tyłu
btLampkaED.Turn(mvControlled->DynamicBrakeFlag); // hamulec ED btLampkaED.Turn(mvControlled->DynamicBrakeFlag); // hamulec ED
btLampkaBrakeProfileG.Turn( TestFlag( mvOccupied->BrakeDelayFlag, bdelay_G ) ); btLampkaBrakeProfileG.Turn( TestFlag( mvOccupied->BrakeDelayFlag, bdelay_G ) );
btLampkaBrakeProfileP.Turn( TestFlag( mvOccupied->BrakeDelayFlag, bdelay_P ) ); 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... 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 // Ra 2014-07: no nie ma potrzeby szukać tego w każdej klatce
if ((TestFlag(mvControlled->Couplers[1].CouplingFlag, ctrain_controll)) && if ((TestFlag(mvControlled->Couplers[1].CouplingFlag, ctrain_controll)) &&
(mvOccupied->ActiveCab > 0)) (mvOccupied->CabOccupied > 0))
tmp = DynamicObject->NextConnected(); tmp = DynamicObject->NextConnected();
if ((TestFlag(mvControlled->Couplers[0].CouplingFlag, ctrain_controll)) && if ((TestFlag(mvControlled->Couplers[0].CouplingFlag, ctrain_controll)) &&
(mvOccupied->ActiveCab < 0)) (mvOccupied->CabOccupied < 0))
tmp = DynamicObject->PrevConnected(); tmp = DynamicObject->PrevConnected();
if( tmp ) { if( tmp ) {
@@ -6530,11 +6530,11 @@ bool TTrain::Update( double const Deltatime )
if (ggDirKey.SubModel) { if (ggDirKey.SubModel) {
if (mvControlled->TrainType != dt_EZT) if (mvControlled->TrainType != dt_EZT)
ggDirKey.UpdateValue( ggDirKey.UpdateValue(
double(mvControlled->ActiveDir), double(mvControlled->DirActive),
dsbReverserKey); dsbReverserKey);
else else
ggDirKey.UpdateValue( ggDirKey.UpdateValue(
double(mvControlled->ActiveDir) + double(mvControlled->Imin == mvControlled->IminHi), double(mvControlled->DirActive) + double(mvControlled->Imin == mvControlled->IminHi),
dsbReverserKey); dsbReverserKey);
ggDirKey.Update(); ggDirKey.Update();
} }
@@ -7188,7 +7188,7 @@ void TTrain::add_distance( double const Distance ) {
auto const meterenabled { ( true == ( m_distancecounter >= 0 ) ) && ( mvControlled->Battery || mvControlled->ConverterFlag ) }; 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; } else { m_distancecounter = -1.f; }
} }
@@ -7198,17 +7198,17 @@ bool TTrain::CabChange(int iDirection)
|| ( true == DynamicObject->Mechanik->AIControllFlag ) ) { || ( true == DynamicObject->Mechanik->AIControllFlag ) ) {
// jeśli prowadzi AI albo jest w innym członie // jeśli prowadzi AI albo jest w innym członie
// jak AI prowadzi, to nie można mu mieszać // 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 return false; // ewentualna zmiana pojazdu
DynamicObject->MoverParameters->ActiveCab = DynamicObject->MoverParameters->CabOccupied =
DynamicObject->MoverParameters->ActiveCab + iDirection; DynamicObject->MoverParameters->CabOccupied + iDirection;
} }
else else
{ // jeśli pojazd prowadzony ręcznie albo wcale (wagon) { // jeśli pojazd prowadzony ręcznie albo wcale (wagon)
DynamicObject->MoverParameters->CabDeactivisation(); DynamicObject->MoverParameters->CabDeactivisation();
if( DynamicObject->MoverParameters->ChangeCab( iDirection ) ) { if( DynamicObject->MoverParameters->ChangeCab( iDirection ) ) {
if( InitializeCab( if( InitializeCab(
DynamicObject->MoverParameters->ActiveCab, DynamicObject->MoverParameters->CabOccupied,
DynamicObject->asBaseDir + DynamicObject->MoverParameters->TypeName + ".mmd" ) ) { DynamicObject->asBaseDir + DynamicObject->MoverParameters->TypeName + ".mmd" ) ) {
// zmiana kabiny w ramach tego samego pojazdu // zmiana kabiny w ramach tego samego pojazdu
DynamicObject->MoverParameters->CabActivisation(); // załączenie rozrządu (wirtualne kabiny) DynamicObject->MoverParameters->CabActivisation(); // załączenie rozrządu (wirtualne kabiny)
@@ -7384,7 +7384,7 @@ bool TTrain::LoadMMediaFile(std::string const &asFileName)
return false; return false;
} // nie znalazl sekcji internal } // nie znalazl sekcji internal
if (!InitializeCab(mvOccupied->ActiveCab, asFileName)) if (!InitializeCab(mvOccupied->CabOccupied, asFileName))
{ {
// zle zainicjowana kabina // zle zainicjowana kabina
return false; return false;
@@ -7838,8 +7838,8 @@ TTrain::radio_message( sound_source *Message, int const Channel ) {
void TTrain::SetLights() void TTrain::SetLights()
{ {
TDynamicObject *p = DynamicObject->GetFirstDynamic(mvOccupied->ActiveCab < 0 ? 1 : 0, 4); TDynamicObject *p = DynamicObject->GetFirstDynamic(mvOccupied->CabOccupied < 0 ? 1 : 0, 4);
bool kier = (DynamicObject->DirectionGet() * mvOccupied->ActiveCab > 0); bool kier = (DynamicObject->DirectionGet() * mvOccupied->CabOccupied > 0);
int xs = (kier ? 0 : 1); int xs = (kier ? 0 : 1);
if (kier ? p->NextC(1) : p->PrevC(1)) // jesli jest nastepny, to tylko przod if (kier ? p->NextC(1) : p->PrevC(1)) // jesli jest nastepny, to tylko przod
{ {

View File

@@ -244,7 +244,7 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
{ // gdy zostaje na tym samym torze (przesuwanie już nie zmienia toru) { // gdy zostaje na tym samym torze (przesuwanie już nie zmienia toru)
if (bPrimary) if (bPrimary)
{ // tylko gdy początkowe ustawienie, dodajemy eventy stania do kolejki { // 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_events1, Owner, -1.0 );
pCurrentTrack->QueueEvents( pCurrentTrack->m_events2, Owner, -1.0 ); pCurrentTrack->QueueEvents( pCurrentTrack->m_events2, Owner, -1.0 );

View File

@@ -510,7 +510,7 @@ driver_mode::update_camera( double const Deltatime ) {
&& ( false == DebugCameraFlag ) ) { && ( false == DebugCameraFlag ) ) {
// jeśli jazda w kabinie, przeliczyć trzeba parametry kamery // 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 ); double modelrotate = atan2( -tempangle.x, tempangle.z );
*/ */
if( ( false == FreeFlyModeFlag ) 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.Yaw powinno być wyzerowane, aby po powrocie patrzeć do przodu
Camera.Pos = controlled->GetPosition() + simulation::Train->MirrorPosition( lr ); // pozycja lusterka Camera.Pos = controlled->GetPosition() + simulation::Train->MirrorPosition( lr ); // pozycja lusterka
Camera.Angle.y = 0; // odchylenie na bok od Camera.LookAt 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 // gdy w korytarzu
Camera.LookAt = Camera.Pos - simulation::Train->GetDirection(); Camera.LookAt = Camera.Pos - simulation::Train->GetDirection();
} }
else if( Global.shiftState ) { else if( Global.shiftState ) {
// patrzenie w bok przez szybę // 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, else { // patrzenie w kierunku osi pojazdu, z uwzględnieniem kabiny - jakby z lusterka,
// ale bez odbicia // 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() }; auto const shakeangles { simulation::Train->Dynamic()->shake_angles() };
Camera.Angle.x = 0.5 * shakeangles.second; // hustanie kamery przod tyl 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 ); Controlled->ABuSetModelShake( temp );
// ABu: koniec rzucania // ABu: koniec rzucania
*/ */
if( simulation::Train->Occupied()->ActiveCab == 0 ) { if( simulation::Train->Occupied()->CabOccupied == 0 ) {
// gdy w korytarzu // gdy w korytarzu
Camera.LookAt = Camera.LookAt =
Camera.m_owner->GetWorldPosition( Camera.m_owneroffset ) Camera.m_owner->GetWorldPosition( Camera.m_owneroffset )
@@ -602,7 +602,7 @@ driver_mode::update_camera( double const Deltatime ) {
Camera.LookAt = Camera.LookAt =
Camera.m_owner->GetWorldPosition( Camera.m_owneroffset ) Camera.m_owner->GetWorldPosition( Camera.m_owneroffset )
+ Camera.m_owner->VectorFront() * 5.0 + 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(); Camera.vUp = simulation::Train->GetUp();
} }
@@ -772,7 +772,7 @@ driver_mode::OnKeyDown(int cKey) {
Global.changeDynObj = targetvehicle; Global.changeDynObj = targetvehicle;
// TODO: choose active cab based on camera's location relative to vehicle's location // 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 ? Train->DynamicObject->MoverParameters->Neighbours[ exitdirection ].vehicle_end ?
-1 : -1 :
1 ); 1 );
@@ -792,7 +792,7 @@ driver_mode::OnKeyDown(int cKey) {
simulation::Train->Dynamic()->Mechanik->TakeControl( false, true ); simulation::Train->Dynamic()->Mechanik->TakeControl( false, true );
if( true == simulation::Train->Dynamic()->Mechanik->primary() ) { if( true == simulation::Train->Dynamic()->Mechanik->primary() ) {
simulation::Train->Occupied()->CabDeactivisation( true ); // potentially left active 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(); simulation::Train->Occupied()->CabActivisation();
} }
InOutKey(); // do kabiny InOutKey(); // do kabiny
@@ -935,9 +935,9 @@ driver_mode::DistantView( bool const Near ) {
if( vehicle == nullptr ) { return; } if( vehicle == nullptr ) { return; }
auto const cab = auto const cab =
( vehicle->MoverParameters->ActiveCab == 0 ? ( vehicle->MoverParameters->CabOccupied == 0 ?
1 : 1 :
vehicle->MoverParameters->ActiveCab ); vehicle->MoverParameters->CabOccupied );
auto const left = vehicle->VectorLeft() * cab; auto const left = vehicle->VectorLeft() * cab;
if( true == Near ) { if( true == Near ) {
@@ -951,7 +951,7 @@ driver_mode::DistantView( bool const Near ) {
Camera.Pos = Camera.Pos =
vehicle->GetPosition() 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 ); + Math3D::vector3( -10.0 * left.x, 1.6, -10.0 * left.z );
} }
@@ -997,15 +997,15 @@ driver_mode::ExternalView() {
else { else {
// default view setup // default view setup
auto const offsetflip{ auto const offsetflip{
( vehicle->MoverParameters->ActiveCab == 0 ? 1 : vehicle->MoverParameters->ActiveCab ) ( vehicle->MoverParameters->CabOccupied == 0 ? 1 : vehicle->MoverParameters->CabOccupied )
* ( vehicle->MoverParameters->ActiveDir == 0 ? 1 : vehicle->MoverParameters->ActiveDir ) }; * ( vehicle->MoverParameters->DirActive == 0 ? 1 : vehicle->MoverParameters->DirActive ) };
Camera.m_owneroffset = { Camera.m_owneroffset = {
1.5 * owner->MoverParameters->Dim.W * offsetflip, 1.5 * owner->MoverParameters->Dim.W * offsetflip,
std::max( 5.0, 1.25 * owner->MoverParameters->Dim.H ), std::max( 5.0, 1.25 * owner->MoverParameters->Dim.H ),
-0.4 * owner->MoverParameters->Dim.L * offsetflip }; -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() }; auto const shakeangles{ owner->shake_angles() };
Camera.Angle.x -= 0.5 * shakeangles.second; // hustanie kamery przod tyl Camera.Angle.x -= 0.5 * shakeangles.second; // hustanie kamery przod tyl
@@ -1028,8 +1028,8 @@ driver_mode::ExternalView() {
else { else {
// default view setup // default view setup
auto const offsetflip{ auto const offsetflip{
( vehicle->MoverParameters->ActiveCab == 0 ? 1 : vehicle->MoverParameters->ActiveCab ) ( vehicle->MoverParameters->CabOccupied == 0 ? 1 : vehicle->MoverParameters->CabOccupied )
* ( vehicle->MoverParameters->ActiveDir == 0 ? 1 : vehicle->MoverParameters->ActiveDir ) * ( vehicle->MoverParameters->DirActive == 0 ? 1 : vehicle->MoverParameters->DirActive )
* -1 }; * -1 };
Camera.m_owneroffset = { Camera.m_owneroffset = {
@@ -1037,7 +1037,7 @@ driver_mode::ExternalView() {
std::max( 5.0, 1.25 * owner->MoverParameters->Dim.H ), std::max( 5.0, 1.25 * owner->MoverParameters->Dim.H ),
0.2 * owner->MoverParameters->Dim.L * offsetflip }; 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() }; auto const shakeangles { owner->shake_angles() };
Camera.Angle.x -= 0.5 * shakeangles.second; // hustanie kamery przod tyl Camera.Angle.x -= 0.5 * shakeangles.second; // hustanie kamery przod tyl
@@ -1058,15 +1058,15 @@ driver_mode::ExternalView() {
else { else {
// default view setup // default view setup
auto const offsetflip{ auto const offsetflip{
( vehicle->MoverParameters->ActiveCab == 0 ? 1 : vehicle->MoverParameters->ActiveCab ) ( vehicle->MoverParameters->CabOccupied == 0 ? 1 : vehicle->MoverParameters->CabOccupied )
* ( vehicle->MoverParameters->ActiveDir == 0 ? 1 : vehicle->MoverParameters->ActiveDir ) }; * ( vehicle->MoverParameters->DirActive == 0 ? 1 : vehicle->MoverParameters->DirActive ) };
Camera.m_owneroffset = { Camera.m_owneroffset = {
-0.65 * owner->MoverParameters->Dim.W * offsetflip, -0.65 * owner->MoverParameters->Dim.W * offsetflip,
0.90, 0.90,
0.15 * owner->MoverParameters->Dim.L * offsetflip }; 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() }; auto const shakeangles { owner->shake_angles() };
Camera.Angle.x -= 0.5 * shakeangles.second; // hustanie kamery przod tyl 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.x -= 0.5 * shakeangles.second; // hustanie kamery przod tyl
Camera.Angle.z = shakeangles.first; // hustanie kamery na boki Camera.Angle.z = shakeangles.first; // hustanie kamery na boki
if( train->Occupied()->ActiveCab == 0 ) { if( train->Occupied()->CabOccupied == 0 ) {
Camera.LookAt = Camera.LookAt =
Camera.m_owner->GetWorldPosition( Camera.m_owneroffset ) Camera.m_owner->GetWorldPosition( Camera.m_owneroffset )
+ Camera.m_owner->VectorFront() * 5.0; + Camera.m_owner->VectorFront() * 5.0;
@@ -1120,7 +1120,7 @@ driver_mode::CabView() {
Camera.LookAt = Camera.LookAt =
Camera.m_owner->GetWorldPosition( Camera.m_owneroffset ) Camera.m_owner->GetWorldPosition( Camera.m_owneroffset )
+ Camera.m_owner->VectorFront() * 5.0 + Camera.m_owner->VectorFront() * 5.0
* Camera.m_owner->MoverParameters->ActiveCab; * Camera.m_owner->MoverParameters->CabOccupied;
} }
train->pMechOffset = Camera.m_owneroffset; train->pMechOffset = Camera.m_owneroffset;
} }
@@ -1141,7 +1141,7 @@ driver_mode::ChangeDynamic() {
// tylko jeśli ręcznie prowadzony // tylko jeśli ręcznie prowadzony
// jeśli prowadzi AI, to mu nie robimy dywersji! // jeśli prowadzi AI, to mu nie robimy dywersji!
occupied->CabDeactivisation(); occupied->CabDeactivisation();
occupied->ActiveCab = 0; occupied->CabOccupied = 0;
occupied->BrakeLevelSet( occupied->Handle->GetPos( bh_NP ) ); //rozwala sterowanie hamulcem GF 04-2016 occupied->BrakeLevelSet( occupied->Handle->GetPos( bh_NP ) ); //rozwala sterowanie hamulcem GF 04-2016
vehicle->MechInside = false; vehicle->MechInside = false;
vehicle->Controller = AIdriver; vehicle->Controller = AIdriver;
@@ -1169,13 +1169,13 @@ driver_mode::ChangeDynamic() {
if( false == driver->AIControllFlag ) // tylko jeśli ręcznie prowadzony if( false == driver->AIControllFlag ) // tylko jeśli ręcznie prowadzony
{ {
occupied->LimPipePress = occupied->PipePress; occupied->LimPipePress = occupied->PipePress;
occupied->ActiveCab = occupied->CabNo; occupied->CabOccupied = occupied->CabActive;
occupied->CabActivisation( true ); // załączenie rozrządu (wirtualne kabiny) occupied->CabActivisation( true ); // załączenie rozrządu (wirtualne kabiny)
vehicle->MechInside = true; vehicle->MechInside = true;
vehicle->Controller = Humandriver; vehicle->Controller = Humandriver;
} }
train->InitializeCab( train->InitializeCab(
occupied->CabNo, occupied->CabActive,
vehicle->asBaseDir + occupied->TypeName + ".mmd" ); vehicle->asBaseDir + occupied->TypeName + ".mmd" );
if( false == FreeFlyModeFlag ) { if( false == FreeFlyModeFlag ) {
vehicle->bDisplayCab = true; vehicle->bDisplayCab = true;

View File

@@ -52,7 +52,7 @@ drivingaid_panel::update() {
if( is_expanded ) { if( is_expanded ) {
// grade // grade
std::string gradetext; 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 }; auto const grade { controlled->VectorFront().y * 100 * ( controlled->DirectionGet() == reverser ? 1 : -1 ) * reverser };
if( std::abs( grade ) >= 0.25 ) { if( std::abs( grade ) >= 0.25 ) {
std::snprintf( std::snprintf(
@@ -89,7 +89,7 @@ drivingaid_panel::update() {
locale::strings[ locale::string::driver_aid_throttle ].c_str(), locale::strings[ locale::string::driver_aid_throttle ].c_str(),
driver->Controlling()->MainCtrlPos, driver->Controlling()->MainCtrlPos,
driver->Controlling()->ScndCtrlPos, driver->Controlling()->ScndCtrlPos,
( mover->ActiveDir > 0 ? 'D' : mover->ActiveDir < 0 ? 'R' : 'N' ), ( mover->DirActive > 0 ? 'D' : mover->DirActive < 0 ? 'R' : 'N' ),
expandedtext.c_str()); expandedtext.c_str());
text_lines.emplace_back( m_buffer.data(), Global.UITextColor ); text_lines.emplace_back( m_buffer.data(), Global.UITextColor );
@@ -689,7 +689,7 @@ debug_panel::update_section_vehicle( std::vector<text_line> &Output ) {
m_buffer.data(), m_buffer.size(), m_buffer.data(), m_buffer.size(),
locale::strings[ locale::string::debug_vehicle_forcesaccelerationvelocityposition ].c_str(), locale::strings[ locale::string::debug_vehicle_forcesaccelerationvelocityposition ].c_str(),
// forces // 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.Fb * 0.001f,
mover.Adhesive( mover.RunningTrack.friction ), mover.Adhesive( mover.RunningTrack.friction ),
( mover.SlippingWheels ? " (!)" : "" ), ( mover.SlippingWheels ? " (!)" : "" ),

View File

@@ -908,11 +908,11 @@ bool
sound_source::update_soundproofing() { 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 // 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 // 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 : Global.CabWindowOpen ? 2 :
FreeFlyModeFlag ? 0 : FreeFlyModeFlag ? 0 :
( simulation::Train ? ( simulation::Train ?
simulation::Train->Occupied()->ActiveCab : simulation::Train->Occupied()->CabOccupied :
0 ) ); 0 ) );
// location-based gain factor: // location-based gain factor:
std::uintptr_t soundproofingstamp = reinterpret_cast<std::uintptr_t>( ( std::uintptr_t soundproofingstamp = reinterpret_cast<std::uintptr_t>( (
@@ -921,7 +921,7 @@ sound_source::update_soundproofing() {
( simulation::Train ? ( simulation::Train ?
simulation::Train->Dynamic() : simulation::Train->Dynamic() :
nullptr ) ) ) nullptr ) ) )
+ activecab; + occupiedcab;
if( soundproofingstamp == m_properties.soundproofing_stamp ) { return false; } 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 EU07_SOUNDPROOFING_STRONG : // listener outside HACK: won't be true if active vehicle has open window
( simulation::Train->Dynamic() != m_owner ? ( simulation::Train->Dynamic() != m_owner ?
EU07_SOUNDPROOFING_STRONG : // in another vehicle EU07_SOUNDPROOFING_STRONG : // in another vehicle
( activecab == 0 ? ( occupiedcab == 0 ?
EU07_SOUNDPROOFING_STRONG : // listener in the engine compartment EU07_SOUNDPROOFING_STRONG : // listener in the engine compartment
EU07_SOUNDPROOFING_NONE ) ) ); // listener in the cab of the same vehicle EU07_SOUNDPROOFING_NONE ) ) ); // listener in the cab of the same vehicle
break; break;
@@ -955,7 +955,7 @@ sound_source::update_soundproofing() {
EU07_SOUNDPROOFING_SOME : // listener outside or has a window open EU07_SOUNDPROOFING_SOME : // listener outside or has a window open
( simulation::Train->Dynamic() != m_owner ? ( simulation::Train->Dynamic() != m_owner ?
EU07_SOUNDPROOFING_STRONG : // in another vehicle EU07_SOUNDPROOFING_STRONG : // in another vehicle
( activecab == 0 ? ( occupiedcab == 0 ?
EU07_SOUNDPROOFING_NONE : // listener in the engine compartment EU07_SOUNDPROOFING_NONE : // listener in the engine compartment
EU07_SOUNDPROOFING_STRONG ) ) ); // listener in another compartment of the same vehicle EU07_SOUNDPROOFING_STRONG ) ) ); // listener in another compartment of the same vehicle
break; break;