mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 16:19:19 +02:00
Merge branch 'tmj-fstate-mover_in_c++'
This commit is contained in:
@@ -125,7 +125,7 @@ class TAnimModel : public editor::basic_node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// constructors
|
// constructors
|
||||||
TAnimModel( scene::node_data const &Nodedata );
|
explicit TAnimModel( scene::node_data const &Nodedata );
|
||||||
// destructor
|
// destructor
|
||||||
~TAnimModel();
|
~TAnimModel();
|
||||||
// methods
|
// methods
|
||||||
|
|||||||
1
Button.h
1
Button.h
@@ -32,6 +32,7 @@ class TButton
|
|||||||
void
|
void
|
||||||
play();
|
play();
|
||||||
// plays specified sound
|
// plays specified sound
|
||||||
|
static
|
||||||
void
|
void
|
||||||
play( sound *Sound );
|
play( sound *Sound );
|
||||||
|
|
||||||
|
|||||||
@@ -1797,7 +1797,7 @@ void TController::AutoRewident()
|
|||||||
}
|
}
|
||||||
if (mvOccupied->TrainType == dt_EZT)
|
if (mvOccupied->TrainType == dt_EZT)
|
||||||
{
|
{
|
||||||
fAccThreshold = std::max(-fBrake_a0[BrakeAccTableSize] - 8 * fBrake_a1[BrakeAccTableSize], -0.75);
|
fAccThreshold = std::max(-fBrake_a0[BrakeAccTableSize] - 8 * fBrake_a1[BrakeAccTableSize], -0.6);
|
||||||
fBrakeReaction = 0.25;
|
fBrakeReaction = 0.25;
|
||||||
}
|
}
|
||||||
else if (ustaw > 16)
|
else if (ustaw > 16)
|
||||||
@@ -5668,7 +5668,7 @@ bool TController::IsStop()
|
|||||||
double
|
double
|
||||||
TController::TrackBlock() const {
|
TController::TrackBlock() const {
|
||||||
|
|
||||||
return pVehicles[ TMoverParameters::side::front ]->fTrackBlock;
|
return pVehicles[ side::front ]->fTrackBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TController::MoveTo(TDynamicObject *to)
|
void TController::MoveTo(TDynamicObject *to)
|
||||||
|
|||||||
75
DynObj.cpp
75
DynObj.cpp
@@ -1276,21 +1276,21 @@ void TDynamicObject::CouplersDettach(double MinDist, int MyScanDir) {
|
|||||||
if (MyScanDir > 0) {
|
if (MyScanDir > 0) {
|
||||||
// pojazd od strony sprzęgu 0
|
// pojazd od strony sprzęgu 0
|
||||||
if( ( PrevConnected != nullptr )
|
if( ( PrevConnected != nullptr )
|
||||||
&& ( MoverParameters->Couplers[ TMoverParameters::side::front ].CoupleDist > MinDist ) ) {
|
&& ( MoverParameters->Couplers[ side::front ].CoupleDist > MinDist ) ) {
|
||||||
// sprzęgi wirtualne zawsze przekraczają
|
// sprzęgi wirtualne zawsze przekraczają
|
||||||
if( ( PrevConnectedNo == TMoverParameters::side::front ?
|
if( ( PrevConnectedNo == side::front ?
|
||||||
PrevConnected->PrevConnected :
|
PrevConnected->PrevConnected :
|
||||||
PrevConnected->NextConnected )
|
PrevConnected->NextConnected )
|
||||||
== this ) {
|
== this ) {
|
||||||
// Ra: nie rozłączamy znalezionego, jeżeli nie do nas podłączony
|
// Ra: nie rozłączamy znalezionego, jeżeli nie do nas podłączony
|
||||||
// (może jechać w innym kierunku)
|
// (może jechać w innym kierunku)
|
||||||
PrevConnected->MoverParameters->Couplers[PrevConnectedNo].Connected = nullptr;
|
PrevConnected->MoverParameters->Couplers[PrevConnectedNo].Connected = nullptr;
|
||||||
if( PrevConnectedNo == TMoverParameters::side::front ) {
|
if( PrevConnectedNo == side::front ) {
|
||||||
// sprzęg 0 nie podłączony
|
// sprzęg 0 nie podłączony
|
||||||
PrevConnected->PrevConnectedNo = 2;
|
PrevConnected->PrevConnectedNo = 2;
|
||||||
PrevConnected->PrevConnected = nullptr;
|
PrevConnected->PrevConnected = nullptr;
|
||||||
}
|
}
|
||||||
else if( PrevConnectedNo == TMoverParameters::side::rear ) {
|
else if( PrevConnectedNo == side::rear ) {
|
||||||
// sprzęg 1 nie podłączony
|
// sprzęg 1 nie podłączony
|
||||||
PrevConnected->NextConnectedNo = 2;
|
PrevConnected->NextConnectedNo = 2;
|
||||||
PrevConnected->NextConnected = nullptr;
|
PrevConnected->NextConnected = nullptr;
|
||||||
@@ -1299,27 +1299,27 @@ void TDynamicObject::CouplersDettach(double MinDist, int MyScanDir) {
|
|||||||
// za to zawsze odłączamy siebie
|
// za to zawsze odłączamy siebie
|
||||||
PrevConnected = nullptr;
|
PrevConnected = nullptr;
|
||||||
PrevConnectedNo = 2; // sprzęg 0 nie podłączony
|
PrevConnectedNo = 2; // sprzęg 0 nie podłączony
|
||||||
MoverParameters->Couplers[ TMoverParameters::side::front ].Connected = nullptr;
|
MoverParameters->Couplers[ side::front ].Connected = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// pojazd od strony sprzęgu 1
|
// pojazd od strony sprzęgu 1
|
||||||
if( ( NextConnected != nullptr )
|
if( ( NextConnected != nullptr )
|
||||||
&& ( MoverParameters->Couplers[ TMoverParameters::side::rear ].CoupleDist > MinDist ) ) {
|
&& ( MoverParameters->Couplers[ side::rear ].CoupleDist > MinDist ) ) {
|
||||||
// sprzęgi wirtualne zawsze przekraczają
|
// sprzęgi wirtualne zawsze przekraczają
|
||||||
if( ( NextConnectedNo == TMoverParameters::side::front ?
|
if( ( NextConnectedNo == side::front ?
|
||||||
NextConnected->PrevConnected :
|
NextConnected->PrevConnected :
|
||||||
NextConnected->NextConnected )
|
NextConnected->NextConnected )
|
||||||
== this) {
|
== this) {
|
||||||
// Ra: nie rozłączamy znalezionego, jeżeli nie do nas podłączony
|
// Ra: nie rozłączamy znalezionego, jeżeli nie do nas podłączony
|
||||||
// (może jechać w innym kierunku)
|
// (może jechać w innym kierunku)
|
||||||
NextConnected->MoverParameters->Couplers[ NextConnectedNo ].Connected = nullptr;
|
NextConnected->MoverParameters->Couplers[ NextConnectedNo ].Connected = nullptr;
|
||||||
if( NextConnectedNo == TMoverParameters::side::front ) {
|
if( NextConnectedNo == side::front ) {
|
||||||
// sprzęg 0 nie podłączony
|
// sprzęg 0 nie podłączony
|
||||||
NextConnected->PrevConnectedNo = 2;
|
NextConnected->PrevConnectedNo = 2;
|
||||||
NextConnected->PrevConnected = nullptr;
|
NextConnected->PrevConnected = nullptr;
|
||||||
}
|
}
|
||||||
else if( NextConnectedNo == TMoverParameters::side::rear ) {
|
else if( NextConnectedNo == side::rear ) {
|
||||||
// sprzęg 1 nie podłączony
|
// sprzęg 1 nie podłączony
|
||||||
NextConnected->NextConnectedNo = 2;
|
NextConnected->NextConnectedNo = 2;
|
||||||
NextConnected->NextConnected = nullptr;
|
NextConnected->NextConnected = nullptr;
|
||||||
@@ -1411,7 +1411,7 @@ void TDynamicObject::ABuScanObjects( int Direction, double Distance )
|
|||||||
// siebie można bezpiecznie podłączyć jednostronnie do znalezionego
|
// siebie można bezpiecznie podłączyć jednostronnie do znalezionego
|
||||||
MoverParameters->Attach( mycoupler, foundcoupler, foundobject->MoverParameters, coupling::faux );
|
MoverParameters->Attach( mycoupler, foundcoupler, foundobject->MoverParameters, coupling::faux );
|
||||||
// MoverParameters->Couplers[MyCouplFound].Render=false; //wirtualnego nie renderujemy
|
// MoverParameters->Couplers[MyCouplFound].Render=false; //wirtualnego nie renderujemy
|
||||||
if( mycoupler == TMoverParameters::side::front ) {
|
if( mycoupler == side::front ) {
|
||||||
PrevConnected = foundobject; // pojazd od strony sprzęgu 0
|
PrevConnected = foundobject; // pojazd od strony sprzęgu 0
|
||||||
PrevConnectedNo = foundcoupler;
|
PrevConnectedNo = foundcoupler;
|
||||||
}
|
}
|
||||||
@@ -1422,7 +1422,7 @@ void TDynamicObject::ABuScanObjects( int Direction, double Distance )
|
|||||||
|
|
||||||
if( foundobject->MoverParameters->Couplers[ foundcoupler ].CouplingFlag == coupling::faux ) {
|
if( foundobject->MoverParameters->Couplers[ foundcoupler ].CouplingFlag == coupling::faux ) {
|
||||||
// Ra: wpinamy się wirtualnym tylko jeśli znaleziony ma wirtualny sprzęg
|
// Ra: wpinamy się wirtualnym tylko jeśli znaleziony ma wirtualny sprzęg
|
||||||
if( ( foundcoupler == TMoverParameters::side::front ?
|
if( ( foundcoupler == side::front ?
|
||||||
foundobject->PrevConnected :
|
foundobject->PrevConnected :
|
||||||
foundobject->NextConnected )
|
foundobject->NextConnected )
|
||||||
!= this ) {
|
!= this ) {
|
||||||
@@ -1430,13 +1430,13 @@ void TDynamicObject::ABuScanObjects( int Direction, double Distance )
|
|||||||
// otherwise we risk leaving the target's connected vehicle with active one-side connection
|
// otherwise we risk leaving the target's connected vehicle with active one-side connection
|
||||||
foundobject->CouplersDettach(
|
foundobject->CouplersDettach(
|
||||||
1.0,
|
1.0,
|
||||||
( foundcoupler == TMoverParameters::side::front ?
|
( foundcoupler == side::front ?
|
||||||
1 :
|
1 :
|
||||||
-1 ) );
|
-1 ) );
|
||||||
}
|
}
|
||||||
foundobject->MoverParameters->Attach( foundcoupler, mycoupler, this->MoverParameters, coupling::faux );
|
foundobject->MoverParameters->Attach( foundcoupler, mycoupler, this->MoverParameters, coupling::faux );
|
||||||
|
|
||||||
if( foundcoupler == TMoverParameters::side::front ) {
|
if( foundcoupler == side::front ) {
|
||||||
// jeśli widoczny sprzęg 0 znalezionego
|
// jeśli widoczny sprzęg 0 znalezionego
|
||||||
if( ( DebugModeFlag )
|
if( ( DebugModeFlag )
|
||||||
&& ( foundobject->PrevConnected )
|
&& ( foundobject->PrevConnected )
|
||||||
@@ -1553,8 +1553,6 @@ TDynamicObject::TDynamicObject()
|
|||||||
iAxleFirst = 0; // numer pierwszej osi w kierunku ruchu (przełączenie
|
iAxleFirst = 0; // numer pierwszej osi w kierunku ruchu (przełączenie
|
||||||
// następuje, gdy osie sa na
|
// następuje, gdy osie sa na
|
||||||
// tym samym torze)
|
// tym samym torze)
|
||||||
iInventory = 0; // flagi bitowe posiadanych submodeli (zaktualizuje się po
|
|
||||||
// wczytaniu MMD)
|
|
||||||
RaLightsSet(0, 0); // początkowe zerowanie stanu świateł
|
RaLightsSet(0, 0); // początkowe zerowanie stanu świateł
|
||||||
// Ra: domyślne ilości animacji dla zgodności wstecz (gdy brak ilości podanych
|
// Ra: domyślne ilości animacji dla zgodności wstecz (gdy brak ilości podanych
|
||||||
// w MMD)
|
// w MMD)
|
||||||
@@ -1942,19 +1940,19 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
|||||||
btEndSignals21.Init("endsignal23", mdModel, false);
|
btEndSignals21.Init("endsignal23", mdModel, false);
|
||||||
btEndSignals13.Init("endsignal12", mdModel, false);
|
btEndSignals13.Init("endsignal12", mdModel, false);
|
||||||
btEndSignals23.Init("endsignal22", mdModel, false);
|
btEndSignals23.Init("endsignal22", mdModel, false);
|
||||||
iInventory |= btEndSignals11.Active() ? 0x01 : 0; // informacja, czy ma poszczególne światła
|
iInventory[ side::front ] |= btEndSignals11.Active() ? light::redmarker_left : 0; // informacja, czy ma poszczególne światła
|
||||||
iInventory |= btEndSignals21.Active() ? 0x02 : 0;
|
iInventory[ side::front ] |= btEndSignals13.Active() ? light::redmarker_right : 0;
|
||||||
iInventory |= btEndSignals13.Active() ? 0x04 : 0;
|
iInventory[ side::rear ] |= btEndSignals21.Active() ? light::redmarker_left : 0;
|
||||||
iInventory |= btEndSignals23.Active() ? 0x08 : 0;
|
iInventory[ side::rear ] |= btEndSignals23.Active() ? light::redmarker_right : 0;
|
||||||
// ABu: to niestety zostawione dla kompatybilnosci modeli:
|
// ABu: to niestety zostawione dla kompatybilnosci modeli:
|
||||||
btEndSignals1.Init("endsignals1", mdModel, false);
|
btEndSignals1.Init("endsignals1", mdModel, false);
|
||||||
btEndSignals2.Init("endsignals2", mdModel, false);
|
btEndSignals2.Init("endsignals2", mdModel, false);
|
||||||
btEndSignalsTab1.Init("endtab1", mdModel, false);
|
btEndSignalsTab1.Init("endtab1", mdModel, false);
|
||||||
btEndSignalsTab2.Init("endtab2", mdModel, false);
|
btEndSignalsTab2.Init("endtab2", mdModel, false);
|
||||||
iInventory |= btEndSignals1.Active() ? 0x10 : 0;
|
iInventory[ side::front ] |= btEndSignals1.Active() ? ( light::redmarker_left | light::redmarker_right ) : 0;
|
||||||
iInventory |= btEndSignals2.Active() ? 0x20 : 0;
|
iInventory[ side::front ] |= btEndSignalsTab1.Active() ? light::rearendsignals : 0; // tabliczki blaszane
|
||||||
iInventory |= btEndSignalsTab1.Active() ? 0x40 : 0; // tabliczki blaszane
|
iInventory[ side::rear ] |= btEndSignals2.Active() ? ( light::redmarker_left | light::redmarker_right ) : 0;
|
||||||
iInventory |= btEndSignalsTab2.Active() ? 0x80 : 0;
|
iInventory[ side::rear ] |= btEndSignalsTab2.Active() ? light::rearendsignals : 0;
|
||||||
// ABu Uwaga! tu zmienic w modelu!
|
// ABu Uwaga! tu zmienic w modelu!
|
||||||
btHeadSignals11.Init("headlamp13", mdModel, false); // lewe
|
btHeadSignals11.Init("headlamp13", mdModel, false); // lewe
|
||||||
btHeadSignals12.Init("headlamp11", mdModel, false); // górne
|
btHeadSignals12.Init("headlamp11", mdModel, false); // górne
|
||||||
@@ -1962,7 +1960,13 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
|||||||
btHeadSignals21.Init("headlamp23", mdModel, false);
|
btHeadSignals21.Init("headlamp23", mdModel, false);
|
||||||
btHeadSignals22.Init("headlamp21", mdModel, false);
|
btHeadSignals22.Init("headlamp21", mdModel, false);
|
||||||
btHeadSignals23.Init("headlamp22", mdModel, false);
|
btHeadSignals23.Init("headlamp22", mdModel, false);
|
||||||
btMechanik1.Init("mechanik1", mdLowPolyInt, false);
|
iInventory[ side::front ] |= btHeadSignals11.Active() ? light::headlight_left : 0;
|
||||||
|
iInventory[ side::front ] |= btHeadSignals12.Active() ? light::headlight_upper : 0;
|
||||||
|
iInventory[ side::front ] |= btHeadSignals13.Active() ? light::headlight_right : 0;
|
||||||
|
iInventory[ side::rear ] |= btHeadSignals21.Active() ? light::headlight_left : 0;
|
||||||
|
iInventory[ side::rear ] |= btHeadSignals22.Active() ? light::headlight_upper : 0;
|
||||||
|
iInventory[ side::rear ] |= btHeadSignals23.Active() ? light::headlight_right : 0;
|
||||||
|
btMechanik1.Init("mechanik1", mdLowPolyInt, false);
|
||||||
btMechanik2.Init("mechanik2", mdLowPolyInt, false);
|
btMechanik2.Init("mechanik2", mdLowPolyInt, false);
|
||||||
TurnOff(); // resetowanie zmiennych submodeli
|
TurnOff(); // resetowanie zmiennych submodeli
|
||||||
|
|
||||||
@@ -5000,7 +5004,7 @@ void TDynamicObject::RaLightsSet(int head, int rear)
|
|||||||
// pojazdu
|
// pojazdu
|
||||||
if (!MoverParameters)
|
if (!MoverParameters)
|
||||||
return; // może tego nie być na początku
|
return; // może tego nie być na początku
|
||||||
if (rear == 2 + 32 + 64)
|
if (rear == ( light::redmarker_left | light::redmarker_right | light::rearendsignals ) )
|
||||||
{ // jeśli koniec pociągu, to trzeba ustalić, czy
|
{ // jeśli koniec pociągu, to trzeba ustalić, czy
|
||||||
// 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
|
||||||
@@ -5009,15 +5013,20 @@ void TDynamicObject::RaLightsSet(int head, int rear)
|
|||||||
{ // 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
|
||||||
rear = 64; // tablice blaszane
|
rear = light::rearendsignals; // tablice blaszane
|
||||||
// trzeba to uzależnić od "załączenia baterii" w pojeździe
|
// trzeba to uzależnić od "załączenia baterii" w pojeździe
|
||||||
}
|
}
|
||||||
if (rear == 2 + 32 + 64) // jeśli nadal obydwie możliwości
|
if( rear == ( light::redmarker_left | light::redmarker_right | light::rearendsignals ) ) // jeśli nadal obydwie możliwości
|
||||||
if (iInventory &
|
if( iInventory[
|
||||||
(iDirection ? 0x2A : 0x15)) // czy ma jakieś światła czerowone od danej strony
|
( iDirection ?
|
||||||
rear = 2 + 32; // dwa światła czerwone
|
side::rear :
|
||||||
else
|
side::front ) ] & ( light::redmarker_left | light::redmarker_right ) ) {
|
||||||
rear = 64; // tablice blaszane
|
// czy ma jakieś światła czerowone od danej strony
|
||||||
|
rear = ( light::redmarker_left | light::redmarker_right ); // dwa światła czerwone
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rear = light::rearendsignals; // tablice blaszane
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (iDirection) // w zależności od kierunku pojazdu w składzie
|
if (iDirection) // w zależności od kierunku pojazdu w składzie
|
||||||
{ // jesli pojazd stoi sprzęgiem 0 w stronę czoła
|
{ // jesli pojazd stoi sprzęgiem 0 w stronę czoła
|
||||||
@@ -5439,7 +5448,7 @@ vehicle_table::update_traction( TDynamicObject *Vehicle ) {
|
|||||||
// pętla po pantografach
|
// pętla po pantografach
|
||||||
auto pantograph { Vehicle->pants[ pantographindex ].fParamPants };
|
auto pantograph { Vehicle->pants[ pantographindex ].fParamPants };
|
||||||
if( true == (
|
if( true == (
|
||||||
pantographindex == TMoverParameters::side::front ?
|
pantographindex == side::front ?
|
||||||
Vehicle->MoverParameters->PantFrontUp :
|
Vehicle->MoverParameters->PantFrontUp :
|
||||||
Vehicle->MoverParameters->PantRearUp ) ) {
|
Vehicle->MoverParameters->PantRearUp ) ) {
|
||||||
// jeśli pantograf podniesiony
|
// jeśli pantograf podniesiony
|
||||||
|
|||||||
3
DynObj.h
3
DynObj.h
@@ -338,7 +338,7 @@ private:
|
|||||||
bool bBrakeAcc;
|
bool bBrakeAcc;
|
||||||
sound* rsUnbrake = nullptr; // yB - odglos luzowania
|
sound* rsUnbrake = nullptr; // yB - odglos luzowania
|
||||||
float ModCamRot;
|
float ModCamRot;
|
||||||
int iInventory; // flagi bitowe posiadanych submodeli (np. świateł)
|
int iInventory[ 2 ] { 0, 0 }; // flagi bitowe posiadanych submodeli (np. świateł)
|
||||||
void TurnOff();
|
void TurnOff();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -464,6 +464,7 @@ private:
|
|||||||
void RadioStop();
|
void RadioStop();
|
||||||
void Damage(char flag);
|
void Damage(char flag);
|
||||||
void RaLightsSet(int head, int rear);
|
void RaLightsSet(int head, int rear);
|
||||||
|
int LightList( side const Side ) const { return iInventory[ Side ]; }
|
||||||
TDynamicObject * FirstFind(int &coupler_nr, int cf = 1);
|
TDynamicObject * FirstFind(int &coupler_nr, int cf = 1);
|
||||||
float GetEPP(); // wyliczanie sredniego cisnienia w PG
|
float GetEPP(); // wyliczanie sredniego cisnienia w PG
|
||||||
int DirectionSet(int d); // ustawienie kierunku w składzie
|
int DirectionSet(int d); // ustawienie kierunku w składzie
|
||||||
|
|||||||
@@ -130,13 +130,13 @@ bool TEventLauncher::check_conditions()
|
|||||||
bool bCond = false;
|
bool bCond = false;
|
||||||
if (iKey != 0)
|
if (iKey != 0)
|
||||||
{
|
{
|
||||||
// tylko jeśli okno jest aktywne
|
// tylko jeśli okno jest aktywne
|
||||||
if( iKey > 255 ) {
|
if( iKey > 255 ) {
|
||||||
// key and modifier
|
// key and modifier
|
||||||
auto const modifier = ( iKey & 0xff00 ) >> 8;
|
auto const modifier = ( iKey & 0xff00 ) >> 8;
|
||||||
bCond = ( Console::Pressed( iKey & 0xff ) )
|
bCond = ( Console::Pressed( iKey & 0xff ) )
|
||||||
&& ( modifier & 1 ? Global::shiftState : true )
|
&& ( ( modifier & 1 ) ? Global::shiftState : true )
|
||||||
&& ( modifier & 2 ? Global::ctrlState : true );
|
&& ( ( modifier & 2 ) ? Global::ctrlState : true );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// just key
|
// just key
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class TEventLauncher : public editor::basic_node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
TEventLauncher( scene::node_data const &Nodedata ) : basic_node( Nodedata ) {}
|
explicit TEventLauncher( scene::node_data const &Nodedata ) : basic_node( Nodedata ) {}
|
||||||
// legacy constructor
|
// legacy constructor
|
||||||
TEventLauncher() = default;
|
TEventLauncher() = default;
|
||||||
|
|
||||||
|
|||||||
@@ -140,6 +140,11 @@ static int const ctrain_passenger = 16; //mostek przejściowy
|
|||||||
static int const ctrain_scndpneumatic = 32; //przewody 8 atm (żółte; zasilanie powietrzem)
|
static int const ctrain_scndpneumatic = 32; //przewody 8 atm (żółte; zasilanie powietrzem)
|
||||||
static int const ctrain_heating = 64; //przewody ogrzewania WN
|
static int const ctrain_heating = 64; //przewody ogrzewania WN
|
||||||
static int const ctrain_depot = 128; //nie rozłączalny podczas zwykłych manewrów (międzyczłonowy), we wpisie wartość ujemna
|
static int const ctrain_depot = 128; //nie rozłączalny podczas zwykłych manewrów (międzyczłonowy), we wpisie wartość ujemna
|
||||||
|
// vehicle sides; exclusive
|
||||||
|
enum side {
|
||||||
|
front = 0,
|
||||||
|
rear
|
||||||
|
};
|
||||||
// possible coupling types; can be combined
|
// possible coupling types; can be combined
|
||||||
enum coupling {
|
enum coupling {
|
||||||
faux = 0x0,
|
faux = 0x0,
|
||||||
@@ -162,6 +167,16 @@ enum range {
|
|||||||
enum start {
|
enum start {
|
||||||
manual,
|
manual,
|
||||||
automatic
|
automatic
|
||||||
|
};
|
||||||
|
// recognized vehicle light locations and types; can be combined
|
||||||
|
enum light {
|
||||||
|
|
||||||
|
headlight_left = 0x01,
|
||||||
|
redmarker_left = 0x02,
|
||||||
|
headlight_upper = 0x04,
|
||||||
|
headlight_right = 0x10,
|
||||||
|
redmarker_right = 0x20,
|
||||||
|
rearendsignals = 0x40
|
||||||
};
|
};
|
||||||
/*typ hamulca elektrodynamicznego*/
|
/*typ hamulca elektrodynamicznego*/
|
||||||
static int const dbrake_none = 0;
|
static int const dbrake_none = 0;
|
||||||
@@ -699,15 +714,6 @@ public:
|
|||||||
int LightsDefPos = 1;
|
int LightsDefPos = 1;
|
||||||
bool LightsWrap = false;
|
bool LightsWrap = false;
|
||||||
int Lights[2][17]; // pozycje świateł, przód - tył, 1 .. 16
|
int Lights[2][17]; // pozycje świateł, przód - tył, 1 .. 16
|
||||||
enum light {
|
|
||||||
|
|
||||||
headlight_left = 0x01,
|
|
||||||
redmarker_left = 0x02,
|
|
||||||
headlight_upper = 0x04,
|
|
||||||
headlight_right = 0x10,
|
|
||||||
redmarker_right = 0x20,
|
|
||||||
rearendsignals = 0x40
|
|
||||||
};
|
|
||||||
int ScndInMain{ 0 }; /*zaleznosc bocznika od nastawnika*/
|
int ScndInMain{ 0 }; /*zaleznosc bocznika od nastawnika*/
|
||||||
bool MBrake = false; /*Czy jest hamulec reczny*/
|
bool MBrake = false; /*Czy jest hamulec reczny*/
|
||||||
double StopBrakeDecc = 0.0;
|
double StopBrakeDecc = 0.0;
|
||||||
@@ -802,10 +808,6 @@ public:
|
|||||||
TRotation Rot;
|
TRotation Rot;
|
||||||
std::string Name; /*nazwa wlasna*/
|
std::string Name; /*nazwa wlasna*/
|
||||||
TCoupling Couplers[2]; //urzadzenia zderzno-sprzegowe, polaczenia miedzy wagonami
|
TCoupling Couplers[2]; //urzadzenia zderzno-sprzegowe, polaczenia miedzy wagonami
|
||||||
enum side {
|
|
||||||
front = 0,
|
|
||||||
rear
|
|
||||||
};
|
|
||||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||||
double HVCouplers[ 2 ][ 2 ]; //przewod WN
|
double HVCouplers[ 2 ][ 2 ]; //przewod WN
|
||||||
enum hvcoupler {
|
enum hvcoupler {
|
||||||
|
|||||||
@@ -294,10 +294,13 @@ bool FileExists( std::string const &Filename ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// returns time of last modification for specified file
|
// returns time of last modification for specified file
|
||||||
time_t
|
std::time_t
|
||||||
last_modified( std::string const &Filename ) {
|
last_modified( std::string const &Filename ) {
|
||||||
|
std::string fn = Filename;
|
||||||
|
std::replace(fn.begin(), fn.end(), '\\', '/');
|
||||||
struct stat filestat;
|
struct stat filestat;
|
||||||
if( ::stat( Filename.c_str(), &filestat ) == 0 ) { return filestat.st_mtime; }
|
if( ::stat( fn.c_str(), &filestat ) == 0 )
|
||||||
else { return 0; }
|
return filestat.st_mtime;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,4 +160,4 @@ extract_value( bool &Variable, std::string const &Key, std::string const &Input,
|
|||||||
bool FileExists( std::string const &Filename );
|
bool FileExists( std::string const &Filename );
|
||||||
|
|
||||||
// returns time of last modification for specified file
|
// returns time of last modification for specified file
|
||||||
time_t last_modified( std::string const &Filename );
|
std::time_t last_modified( std::string const &Filename );
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ bool TMemCell::Compare( std::string const &szTestText, double const fTestValue1,
|
|||||||
&& ( !TestFlag( CheckMask, conditional_memval2 ) || ( fValue2 == fTestValue2 ) ) );
|
&& ( !TestFlag( CheckMask, conditional_memval2 ) || ( fValue2 == fTestValue2 ) ) );
|
||||||
};
|
};
|
||||||
|
|
||||||
bool TMemCell::IsVelocity()
|
bool TMemCell::IsVelocity() const
|
||||||
{ // sprawdzenie, czy event odczytu tej komórki ma być do skanowania, czy do kolejkowania
|
{ // sprawdzenie, czy event odczytu tej komórki ma być do skanowania, czy do kolejkowania
|
||||||
if (eCommand == cm_SetVelocity)
|
if (eCommand == cm_SetVelocity)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class TMemCell : public editor::basic_node {
|
|||||||
public:
|
public:
|
||||||
std::string asTrackName; // McZapkie-100302 - zeby nazwe toru na ktory jest Putcommand wysylane pamietac
|
std::string asTrackName; // McZapkie-100302 - zeby nazwe toru na ktory jest Putcommand wysylane pamietac
|
||||||
|
|
||||||
TMemCell( scene::node_data const &Nodedata );
|
explicit TMemCell( scene::node_data const &Nodedata );
|
||||||
|
|
||||||
void
|
void
|
||||||
UpdateValues( std::string const &szNewText, double const fNewValue1, double const fNewValue2, int const CheckMask );
|
UpdateValues( std::string const &szNewText, double const fNewValue1, double const fNewValue2, int const CheckMask );
|
||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
return bCommand; };
|
return bCommand; };
|
||||||
void StopCommandSent();
|
void StopCommandSent();
|
||||||
TCommandType CommandCheck();
|
TCommandType CommandCheck();
|
||||||
bool IsVelocity();
|
bool IsVelocity() const;
|
||||||
void AssignEvents(TEvent *e);
|
void AssignEvents(TEvent *e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -1743,7 +1743,7 @@ void TModel3d::Init()
|
|||||||
// 2012-02 funkcje do tworzenia terenu z E3D
|
// 2012-02 funkcje do tworzenia terenu z E3D
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
int TModel3d::TerrainCount()
|
int TModel3d::TerrainCount() const
|
||||||
{ // zliczanie kwadratów kilometrowych (główna
|
{ // zliczanie kwadratów kilometrowych (główna
|
||||||
// linia po Next) do tworznia tablicy
|
// linia po Next) do tworznia tablicy
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|||||||
14
Model3d.h
14
Model3d.h
@@ -184,15 +184,13 @@ public:
|
|||||||
};
|
};
|
||||||
void InitialRotate(bool doit);
|
void InitialRotate(bool doit);
|
||||||
void BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t, std::vector<std::string> *n, bool dynamic);
|
void BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t, std::vector<std::string> *n, bool dynamic);
|
||||||
void ReplacableSet(material_handle const *r, int a)
|
static void ReplacableSet(material_handle const *r, int a) {
|
||||||
{
|
|
||||||
ReplacableSkinId = r;
|
ReplacableSkinId = r;
|
||||||
iAlpha = a;
|
iAlpha = a; };
|
||||||
};
|
|
||||||
void Name_Material( std::string const &Name );
|
void Name_Material( std::string const &Name );
|
||||||
void Name( std::string const &Name );
|
void Name( std::string const &Name );
|
||||||
// Ra: funkcje do budowania terenu z E3D
|
// Ra: funkcje do budowania terenu z E3D
|
||||||
int Flags() { return iFlags; };
|
int Flags() const { return iFlags; };
|
||||||
void UnFlagNext() { iFlags &= 0x00FFFFFF; };
|
void UnFlagNext() { iFlags &= 0x00FFFFFF; };
|
||||||
void ColorsSet( glm::vec3 const &Ambient, glm::vec3 const &Diffuse, glm::vec3 const &Specular );
|
void ColorsSet( glm::vec3 const &Ambient, glm::vec3 const &Diffuse, glm::vec3 const &Specular );
|
||||||
// sets light level (alpha component of illumination color) to specified value
|
// sets light level (alpha component of illumination color) to specified value
|
||||||
@@ -201,7 +199,7 @@ public:
|
|||||||
return fMatrix ? *(fMatrix->TranslationGet()) + v_TransVector : v_TransVector; }
|
return fMatrix ? *(fMatrix->TranslationGet()) + v_TransVector : v_TransVector; }
|
||||||
inline float3 Translation2Get() {
|
inline float3 Translation2Get() {
|
||||||
return *(fMatrix->TranslationGet()) + Child->Translation1Get(); }
|
return *(fMatrix->TranslationGet()) + Child->Translation1Get(); }
|
||||||
material_handle GetMaterial() {
|
material_handle GetMaterial() const {
|
||||||
return m_material; }
|
return m_material; }
|
||||||
void ParentMatrix(float4x4 *m);
|
void ParentMatrix(float4x4 *m);
|
||||||
float MaxY( float4x4 const &m );
|
float MaxY( float4x4 const &m );
|
||||||
@@ -250,8 +248,8 @@ public:
|
|||||||
void SaveToBinFile(std::string const &FileName);
|
void SaveToBinFile(std::string const &FileName);
|
||||||
int Flags() const { return iFlags; };
|
int Flags() const { return iFlags; };
|
||||||
void Init();
|
void Init();
|
||||||
std::string NameGet() { return m_filename; };
|
std::string NameGet() const { return m_filename; };
|
||||||
int TerrainCount();
|
int TerrainCount() const;
|
||||||
TSubModel * TerrainSquare(int n);
|
TSubModel * TerrainSquare(int n);
|
||||||
void deserialize(std::istream &s, size_t size, bool dynamic);
|
void deserialize(std::istream &s, size_t size, bool dynamic);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -61,11 +61,11 @@ class garbage_collector {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// constructor:
|
// constructor:
|
||||||
garbage_collector( Container_ &Container, int const Secondstolive, int const Sweepsize, std::string const Resourcename = "resource" ) :
|
garbage_collector( Container_ &Container, unsigned int const Secondstolive, std::size_t const Sweepsize, std::string const Resourcename = "resource" ) :
|
||||||
m_container( Container ),
|
m_unusedresourcetimetolive{ std::chrono::seconds{ Secondstolive } },
|
||||||
m_unusedresourcetimetolive { std::chrono::seconds( Secondstolive ) },
|
m_unusedresourcesweepsize{ Sweepsize },
|
||||||
m_unusedresourcesweepsize( Sweepsize ),
|
m_resourcename{ Resourcename },
|
||||||
m_resourcename( Resourcename )
|
m_container{ Container }
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// methods:
|
// methods:
|
||||||
|
|||||||
@@ -674,7 +674,7 @@ opengl_texture::release( bool const Backup ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
opengl_texture::set_filtering() {
|
opengl_texture::set_filtering() const {
|
||||||
|
|
||||||
// default texture mode
|
// default texture mode
|
||||||
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ private:
|
|||||||
void load_DDS();
|
void load_DDS();
|
||||||
void load_TEX();
|
void load_TEX();
|
||||||
void load_TGA();
|
void load_TGA();
|
||||||
void set_filtering();
|
void set_filtering() const;
|
||||||
void downsize( GLuint const Format );
|
void downsize( GLuint const Format );
|
||||||
|
|
||||||
// members
|
// members
|
||||||
|
|||||||
23
Track.h
23
Track.h
@@ -96,16 +96,11 @@ class TSwitchExtension
|
|||||||
|
|
||||||
class TIsolated
|
class TIsolated
|
||||||
{ // obiekt zbierający zajętości z kilku odcinków
|
{ // obiekt zbierający zajętości z kilku odcinków
|
||||||
int iAxles = 0; // ilość osi na odcinkach obsługiwanych przez obiekt
|
public:
|
||||||
TIsolated *pNext = nullptr; // odcinki izolowane są trzymane w postaci listy jednikierunkowej
|
// constructors
|
||||||
static TIsolated *pRoot; // początek listy
|
|
||||||
public:
|
|
||||||
std::string asName; // nazwa obiektu, baza do nazw eventów
|
|
||||||
TEvent *evBusy = nullptr; // zdarzenie wyzwalane po zajęciu grupy
|
|
||||||
TEvent *evFree = nullptr; // zdarzenie wyzwalane po całkowitym zwolnieniu zajętości grupy
|
|
||||||
TMemCell *pMemCell = nullptr; // automatyczna komórka pamięci, która współpracuje z odcinkiem izolowanym
|
|
||||||
TIsolated();
|
TIsolated();
|
||||||
TIsolated(const std::string &n, TIsolated *i);
|
TIsolated(const std::string &n, TIsolated *i);
|
||||||
|
// methods
|
||||||
static void DeleteAll();
|
static void DeleteAll();
|
||||||
static TIsolated * Find(const std::string &n); // znalezienie obiektu albo utworzenie nowego
|
static TIsolated * Find(const std::string &n); // znalezienie obiektu albo utworzenie nowego
|
||||||
void Modify(int i, TDynamicObject *o); // dodanie lub odjęcie osi
|
void Modify(int i, TDynamicObject *o); // dodanie lub odjęcie osi
|
||||||
@@ -115,6 +110,16 @@ class TIsolated
|
|||||||
return (pRoot); };
|
return (pRoot); };
|
||||||
TIsolated * Next() {
|
TIsolated * Next() {
|
||||||
return (pNext); };
|
return (pNext); };
|
||||||
|
// members
|
||||||
|
std::string asName; // nazwa obiektu, baza do nazw eventów
|
||||||
|
TEvent *evBusy { nullptr }; // zdarzenie wyzwalane po zajęciu grupy
|
||||||
|
TEvent *evFree { nullptr }; // zdarzenie wyzwalane po całkowitym zwolnieniu zajętości grupy
|
||||||
|
TMemCell *pMemCell { nullptr }; // automatyczna komórka pamięci, która współpracuje z odcinkiem izolowanym
|
||||||
|
private:
|
||||||
|
// members
|
||||||
|
int iAxles { 0 }; // ilość osi na odcinkach obsługiwanych przez obiekt
|
||||||
|
TIsolated *pNext { nullptr }; // odcinki izolowane są trzymane w postaci listy jednikierunkowej
|
||||||
|
static TIsolated *pRoot; // początek listy
|
||||||
};
|
};
|
||||||
|
|
||||||
// trajektoria ruchu - opakowanie
|
// trajektoria ruchu - opakowanie
|
||||||
@@ -184,7 +189,7 @@ public:
|
|||||||
bool ScannedFlag = false; // McZapkie: do zaznaczania kolorem torów skanowanych przez AI
|
bool ScannedFlag = false; // McZapkie: do zaznaczania kolorem torów skanowanych przez AI
|
||||||
TGroundNode *nFouling[ 2 ] = { nullptr, nullptr }; // współrzędne ukresu albo oporu kozła
|
TGroundNode *nFouling[ 2 ] = { nullptr, nullptr }; // współrzędne ukresu albo oporu kozła
|
||||||
|
|
||||||
TTrack( scene::node_data const &Nodedata );
|
explicit TTrack( scene::node_data const &Nodedata );
|
||||||
virtual ~TTrack();
|
virtual ~TTrack();
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class TTraction : public editor::basic_node {
|
|||||||
glm::dvec3 m_origin;
|
glm::dvec3 m_origin;
|
||||||
geometry_handle m_geometry;
|
geometry_handle m_geometry;
|
||||||
|
|
||||||
TTraction( scene::node_data const &Nodedata );
|
explicit TTraction( scene::node_data const &Nodedata );
|
||||||
|
|
||||||
void Load( cParser *parser, glm::dvec3 const &pOrigin );
|
void Load( cParser *parser, glm::dvec3 const &pOrigin );
|
||||||
// set origin point
|
// set origin point
|
||||||
|
|||||||
578
Train.cpp
578
Train.cpp
@@ -247,6 +247,8 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
|||||||
{ user_command::motoroverloadrelaythresholdtoggle, &TTrain::OnCommand_motoroverloadrelaythresholdtoggle },
|
{ user_command::motoroverloadrelaythresholdtoggle, &TTrain::OnCommand_motoroverloadrelaythresholdtoggle },
|
||||||
{ user_command::motoroverloadrelayreset, &TTrain::OnCommand_motoroverloadrelayreset },
|
{ user_command::motoroverloadrelayreset, &TTrain::OnCommand_motoroverloadrelayreset },
|
||||||
{ user_command::heatingtoggle, &TTrain::OnCommand_heatingtoggle },
|
{ user_command::heatingtoggle, &TTrain::OnCommand_heatingtoggle },
|
||||||
|
{ user_command::lightspresetactivatenext, &TTrain::OnCommand_lightspresetactivatenext },
|
||||||
|
{ user_command::lightspresetactivateprevious, &TTrain::OnCommand_lightspresetactivateprevious },
|
||||||
{ user_command::headlighttoggleleft, &TTrain::OnCommand_headlighttoggleleft },
|
{ user_command::headlighttoggleleft, &TTrain::OnCommand_headlighttoggleleft },
|
||||||
{ user_command::headlighttoggleright, &TTrain::OnCommand_headlighttoggleright },
|
{ user_command::headlighttoggleright, &TTrain::OnCommand_headlighttoggleright },
|
||||||
{ user_command::headlighttoggleupper, &TTrain::OnCommand_headlighttoggleupper },
|
{ user_command::headlighttoggleupper, &TTrain::OnCommand_headlighttoggleupper },
|
||||||
@@ -2145,6 +2147,60 @@ void TTrain::OnCommand_motoroverloadrelayreset( TTrain *Train, command_data cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TTrain::OnCommand_lightspresetactivatenext( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
|
if( Train->mvOccupied->LightsPosNo == 0 ) {
|
||||||
|
// lights are controlled by preset selector
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if( Command.action != GLFW_PRESS ) {
|
||||||
|
// one change per key press
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ( Train->mvOccupied->LightsPos < Train->mvOccupied->LightsPosNo )
|
||||||
|
|| ( true == Train->mvOccupied->LightsWrap ) ) {
|
||||||
|
// active light preset is stored as value in range 1-LigthPosNo
|
||||||
|
Train->mvOccupied->LightsPos = (
|
||||||
|
Train->mvOccupied->LightsPos < Train->mvOccupied->LightsPosNo ?
|
||||||
|
Train->mvOccupied->LightsPos + 1 :
|
||||||
|
1 ); // wrap mode
|
||||||
|
|
||||||
|
Train->SetLights();
|
||||||
|
// visual feedback
|
||||||
|
if( Train->ggLightsButton.SubModel != nullptr ) {
|
||||||
|
Train->ggLightsButton.UpdateValue( Train->mvOccupied->LightsPos - 1, Train->dsbSwitch );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TTrain::OnCommand_lightspresetactivateprevious( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
|
if( Train->mvOccupied->LightsPosNo == 0 ) {
|
||||||
|
// lights are controlled by preset selector
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if( Command.action != GLFW_PRESS ) {
|
||||||
|
// one change per key press
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ( Train->mvOccupied->LightsPos > 1 )
|
||||||
|
|| ( true == Train->mvOccupied->LightsWrap ) ) {
|
||||||
|
// active light preset is stored as value in range 1-LigthPosNo
|
||||||
|
Train->mvOccupied->LightsPos = (
|
||||||
|
Train->mvOccupied->LightsPos > 1 ?
|
||||||
|
Train->mvOccupied->LightsPos - 1 :
|
||||||
|
Train->mvOccupied->LightsPosNo ); // wrap mode
|
||||||
|
|
||||||
|
Train->SetLights();
|
||||||
|
// visual feedback
|
||||||
|
if( Train->ggLightsButton.SubModel != nullptr ) {
|
||||||
|
Train->ggLightsButton.UpdateValue( Train->mvOccupied->LightsPos - 1, Train->dsbSwitch );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_headlighttoggleleft( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_headlighttoggleleft( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
if( Train->mvOccupied->LightsPosNo > 0 ) {
|
if( Train->mvOccupied->LightsPosNo > 0 ) {
|
||||||
@@ -2152,12 +2208,12 @@ void TTrain::OnCommand_headlighttoggleleft( TTrain *Train, command_data const &C
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int const lightsindex =
|
int const vehicleside =
|
||||||
( Train->mvOccupied->ActiveCab == 1 ?
|
( Train->mvOccupied->ActiveCab == 1 ?
|
||||||
0 :
|
side::front :
|
||||||
1 );
|
side::rear );
|
||||||
|
|
||||||
bool current_state = (bool)(Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_left);
|
bool current_state = (bool)(Train->DynamicObject->iLights[ vehicleside ] & light::headlight_left);
|
||||||
|
|
||||||
if (Command.desired_state == command_data::ON && current_state)
|
if (Command.desired_state == command_data::ON && current_state)
|
||||||
return;
|
return;
|
||||||
@@ -2168,17 +2224,17 @@ void TTrain::OnCommand_headlighttoggleleft( TTrain *Train, command_data const &C
|
|||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
if( !current_state ) {
|
if( !current_state ) {
|
||||||
// turn on
|
// turn on
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_left;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggLeftLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
Train->ggLeftLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||||
// if the light is controlled by 3-way switch, disable marker light
|
// if the light is controlled by 3-way switch, disable marker light
|
||||||
if( Train->ggLeftEndLightButton.SubModel == nullptr ) {
|
if( Train->ggLeftEndLightButton.SubModel == nullptr ) {
|
||||||
Train->DynamicObject->iLights[ lightsindex ] &= ~TMoverParameters::light::redmarker_left;
|
Train->DynamicObject->iLights[ vehicleside ] &= ~light::redmarker_left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//turn off
|
//turn off
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_left;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggLeftLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
Train->ggLeftLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
@@ -2192,12 +2248,12 @@ void TTrain::OnCommand_headlighttoggleright( TTrain *Train, command_data const &
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int const lightsindex =
|
int const vehicleside =
|
||||||
( Train->mvOccupied->ActiveCab == 1 ?
|
( Train->mvOccupied->ActiveCab == 1 ?
|
||||||
0 :
|
side::front :
|
||||||
1 );
|
side::rear );
|
||||||
|
|
||||||
bool current_state = (bool)(Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_right);
|
bool current_state = (bool)(Train->DynamicObject->iLights[ vehicleside ] & light::headlight_right);
|
||||||
|
|
||||||
if (Command.desired_state == command_data::ON && current_state)
|
if (Command.desired_state == command_data::ON && current_state)
|
||||||
return;
|
return;
|
||||||
@@ -2208,17 +2264,17 @@ void TTrain::OnCommand_headlighttoggleright( TTrain *Train, command_data const &
|
|||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
if( !current_state ) {
|
if( !current_state ) {
|
||||||
// turn on
|
// turn on
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_right;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggRightLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
Train->ggRightLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||||
// if the light is controlled by 3-way switch, disable marker light
|
// if the light is controlled by 3-way switch, disable marker light
|
||||||
if( Train->ggRightEndLightButton.SubModel == nullptr ) {
|
if( Train->ggRightEndLightButton.SubModel == nullptr ) {
|
||||||
Train->DynamicObject->iLights[ lightsindex ] &= ~TMoverParameters::light::redmarker_right;
|
Train->DynamicObject->iLights[ vehicleside ] &= ~light::redmarker_right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//turn off
|
//turn off
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_right;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggRightLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
Train->ggRightLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
@@ -2232,12 +2288,12 @@ void TTrain::OnCommand_headlighttoggleupper( TTrain *Train, command_data const &
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int const lightsindex =
|
int const vehicleside =
|
||||||
( Train->mvOccupied->ActiveCab == 1 ?
|
( Train->mvOccupied->ActiveCab == 1 ?
|
||||||
0 :
|
side::front :
|
||||||
1 );
|
side::rear );
|
||||||
|
|
||||||
bool current_state = (bool)(Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_upper);
|
bool current_state = (bool)(Train->DynamicObject->iLights[ vehicleside ] & light::headlight_upper);
|
||||||
|
|
||||||
if (Command.desired_state == command_data::ON && current_state)
|
if (Command.desired_state == command_data::ON && current_state)
|
||||||
return;
|
return;
|
||||||
@@ -2248,13 +2304,13 @@ void TTrain::OnCommand_headlighttoggleupper( TTrain *Train, command_data const &
|
|||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
if( !current_state ) {
|
if( !current_state ) {
|
||||||
// turn on
|
// turn on
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_upper;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggUpperLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
Train->ggUpperLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//turn off
|
//turn off
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_upper;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggUpperLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
Train->ggUpperLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
@@ -2268,16 +2324,16 @@ void TTrain::OnCommand_redmarkertoggleleft( TTrain *Train, command_data const &C
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int const lightsindex =
|
int const vehicleside =
|
||||||
( Train->mvOccupied->ActiveCab == 1 ?
|
( Train->mvOccupied->ActiveCab == 1 ?
|
||||||
0 :
|
side::front :
|
||||||
1 );
|
side::rear );
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
if( ( Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::redmarker_left ) == 0 ) {
|
if( ( Train->DynamicObject->iLights[ vehicleside ] & light::redmarker_left ) == 0 ) {
|
||||||
// turn on
|
// turn on
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::redmarker_left;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
if( Train->ggLeftEndLightButton.SubModel != nullptr ) {
|
if( Train->ggLeftEndLightButton.SubModel != nullptr ) {
|
||||||
Train->ggLeftEndLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
Train->ggLeftEndLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||||
@@ -2287,12 +2343,12 @@ void TTrain::OnCommand_redmarkertoggleleft( TTrain *Train, command_data const &C
|
|||||||
// this is crude, but for now will do
|
// this is crude, but for now will do
|
||||||
Train->ggLeftLightButton.UpdateValue( -1.0, Train->dsbSwitch );
|
Train->ggLeftLightButton.UpdateValue( -1.0, Train->dsbSwitch );
|
||||||
// if the light is controlled by 3-way switch, disable the headlight
|
// if the light is controlled by 3-way switch, disable the headlight
|
||||||
Train->DynamicObject->iLights[ lightsindex ] &= ~TMoverParameters::light::headlight_left;
|
Train->DynamicObject->iLights[ vehicleside ] &= ~light::headlight_left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//turn off
|
//turn off
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::redmarker_left;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
if( Train->ggLeftEndLightButton.SubModel != nullptr ) {
|
if( Train->ggLeftEndLightButton.SubModel != nullptr ) {
|
||||||
Train->ggLeftEndLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
Train->ggLeftEndLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||||
@@ -2313,16 +2369,16 @@ void TTrain::OnCommand_redmarkertoggleright( TTrain *Train, command_data const &
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int const lightsindex =
|
int const vehicleside =
|
||||||
( Train->mvOccupied->ActiveCab == 1 ?
|
( Train->mvOccupied->ActiveCab == 1 ?
|
||||||
0 :
|
side::front :
|
||||||
1 );
|
side::rear );
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
if( ( Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::redmarker_right ) == 0 ) {
|
if( ( Train->DynamicObject->iLights[ vehicleside ] & light::redmarker_right ) == 0 ) {
|
||||||
// turn on
|
// turn on
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::redmarker_right;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
if( Train->ggRightEndLightButton.SubModel != nullptr ) {
|
if( Train->ggRightEndLightButton.SubModel != nullptr ) {
|
||||||
Train->ggRightEndLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
Train->ggRightEndLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||||
@@ -2332,12 +2388,12 @@ void TTrain::OnCommand_redmarkertoggleright( TTrain *Train, command_data const &
|
|||||||
// this is crude, but for now will do
|
// this is crude, but for now will do
|
||||||
Train->ggRightLightButton.UpdateValue( -1.0, Train->dsbSwitch );
|
Train->ggRightLightButton.UpdateValue( -1.0, Train->dsbSwitch );
|
||||||
// if the light is controlled by 3-way switch, disable the headlight
|
// if the light is controlled by 3-way switch, disable the headlight
|
||||||
Train->DynamicObject->iLights[ lightsindex ] &= ~TMoverParameters::light::headlight_right;
|
Train->DynamicObject->iLights[ vehicleside ] &= ~light::headlight_right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//turn off
|
//turn off
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::redmarker_right;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
if( Train->ggRightEndLightButton.SubModel != nullptr ) {
|
if( Train->ggRightEndLightButton.SubModel != nullptr ) {
|
||||||
Train->ggRightEndLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
Train->ggRightEndLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||||
@@ -2358,23 +2414,23 @@ void TTrain::OnCommand_headlighttogglerearleft( TTrain *Train, command_data cons
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int const lightsindex =
|
int const vehicleside =
|
||||||
( Train->mvOccupied->ActiveCab == 1 ?
|
( Train->mvOccupied->ActiveCab == 1 ?
|
||||||
1 :
|
side::rear :
|
||||||
0 );
|
side::front );
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// NOTE: we toggle the light on opposite side, as 'rear right' is 'front left' on the rear end etc
|
// NOTE: we toggle the light on opposite side, as 'rear right' is 'front left' on the rear end etc
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
if( ( Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_right ) == 0 ) {
|
if( ( Train->DynamicObject->iLights[ vehicleside ] & light::headlight_right ) == 0 ) {
|
||||||
// turn on
|
// turn on
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_right;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggRearLeftLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
Train->ggRearLeftLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//turn off
|
//turn off
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_right;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggRearLeftLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
Train->ggRearLeftLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
@@ -2388,23 +2444,23 @@ void TTrain::OnCommand_headlighttogglerearright( TTrain *Train, command_data con
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int const lightsindex =
|
int const vehicleside =
|
||||||
( Train->mvOccupied->ActiveCab == 1 ?
|
( Train->mvOccupied->ActiveCab == 1 ?
|
||||||
1 :
|
side::rear :
|
||||||
0 );
|
side::front );
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// NOTE: we toggle the light on opposite side, as 'rear right' is 'front left' on the rear end etc
|
// NOTE: we toggle the light on opposite side, as 'rear right' is 'front left' on the rear end etc
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
if( ( Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_left ) == 0 ) {
|
if( ( Train->DynamicObject->iLights[ vehicleside ] & light::headlight_left ) == 0 ) {
|
||||||
// turn on
|
// turn on
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_left;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggRearRightLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
Train->ggRearRightLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//turn off
|
//turn off
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_left;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggRearRightLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
Train->ggRearRightLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
@@ -2418,22 +2474,22 @@ void TTrain::OnCommand_headlighttogglerearupper( TTrain *Train, command_data con
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int const lightsindex =
|
int const vehicleside =
|
||||||
( Train->mvOccupied->ActiveCab == 1 ?
|
( Train->mvOccupied->ActiveCab == 1 ?
|
||||||
1 :
|
side::rear :
|
||||||
0 );
|
side::front );
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
if( ( Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_upper ) == 0 ) {
|
if( ( Train->DynamicObject->iLights[ vehicleside ] & light::headlight_upper ) == 0 ) {
|
||||||
// turn on
|
// turn on
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_upper;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggRearUpperLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
Train->ggRearUpperLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//turn off
|
//turn off
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_upper;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggRearUpperLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
Train->ggRearUpperLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
@@ -2447,23 +2503,23 @@ void TTrain::OnCommand_redmarkertogglerearleft( TTrain *Train, command_data cons
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int const lightsindex =
|
int const vehicleside =
|
||||||
( Train->mvOccupied->ActiveCab == 1 ?
|
( Train->mvOccupied->ActiveCab == 1 ?
|
||||||
1 :
|
side::rear :
|
||||||
0 );
|
side::front );
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// NOTE: we toggle the light on opposite side, as 'rear right' is 'front left' on the rear end etc
|
// NOTE: we toggle the light on opposite side, as 'rear right' is 'front left' on the rear end etc
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
if( ( Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::redmarker_right ) == 0 ) {
|
if( ( Train->DynamicObject->iLights[ vehicleside ] & light::redmarker_right ) == 0 ) {
|
||||||
// turn on
|
// turn on
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::redmarker_right;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggRearLeftEndLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
Train->ggRearLeftEndLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//turn off
|
//turn off
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::redmarker_right;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggRearLeftEndLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
Train->ggRearLeftEndLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
@@ -2477,23 +2533,23 @@ void TTrain::OnCommand_redmarkertogglerearright( TTrain *Train, command_data con
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int const lightsindex =
|
int const vehicleside =
|
||||||
( Train->mvOccupied->ActiveCab == 1 ?
|
( Train->mvOccupied->ActiveCab == 1 ?
|
||||||
1 :
|
side::rear :
|
||||||
0 );
|
side::front );
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// NOTE: we toggle the light on opposite side, as 'rear right' is 'front left' on the rear end etc
|
// NOTE: we toggle the light on opposite side, as 'rear right' is 'front left' on the rear end etc
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
if( ( Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::redmarker_left ) == 0 ) {
|
if( ( Train->DynamicObject->iLights[ vehicleside ] & light::redmarker_left ) == 0 ) {
|
||||||
// turn on
|
// turn on
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::redmarker_left;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggRearRightEndLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
Train->ggRearRightEndLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//turn off
|
//turn off
|
||||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left;
|
Train->DynamicObject->iLights[ vehicleside ] ^= light::redmarker_left;
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggRearRightEndLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
Train->ggRearRightEndLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
@@ -3014,7 +3070,8 @@ void TTrain::OnKeyDown(int cKey)
|
|||||||
DynamicObject->Mechanik->TakeControl(true);
|
DynamicObject->Mechanik->TakeControl(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (cKey == Global::Keys[k_UpperSign]) // ABu 060205: światło górne -
|
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||||
|
else if (cKey == Global::Keys[k_UpperSign]) // ABu 060205: światło górne -
|
||||||
// włączenie
|
// włączenie
|
||||||
{
|
{
|
||||||
if (mvOccupied->LightsPosNo > 0) //kręciolek od swiatel
|
if (mvOccupied->LightsPosNo > 0) //kręciolek od swiatel
|
||||||
@@ -3031,6 +3088,7 @@ void TTrain::OnKeyDown(int cKey)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else // McZapkie-240302 - klawisze bez shifta
|
else // McZapkie-240302 - klawisze bez shifta
|
||||||
{
|
{
|
||||||
@@ -3127,8 +3185,7 @@ void TTrain::OnKeyDown(int cKey)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// McZapkie-240302 - wylaczanie automatycznego pilota (w trybie ~debugmode
|
// McZapkie-240302 - wylaczanie automatycznego pilota (w trybie ~debugmode mozna tylko raz)
|
||||||
// mozna tylko raz)
|
|
||||||
else if (cKey == GLFW_KEY_Q) // bez Shift
|
else if (cKey == GLFW_KEY_Q) // bez Shift
|
||||||
{
|
{
|
||||||
if (DynamicObject->Mechanik)
|
if (DynamicObject->Mechanik)
|
||||||
@@ -3363,6 +3420,7 @@ if
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||||
else if (cKey == Global::Keys[k_UpperSign]) // ABu 060205: światło górne -
|
else if (cKey == Global::Keys[k_UpperSign]) // ABu 060205: światło górne -
|
||||||
// wyłączenie
|
// wyłączenie
|
||||||
{
|
{
|
||||||
@@ -3380,6 +3438,7 @@ if
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// else
|
// else
|
||||||
if (DebugModeFlag)
|
if (DebugModeFlag)
|
||||||
{ // przesuwanie składu o 100m
|
{ // przesuwanie składu o 100m
|
||||||
@@ -4432,9 +4491,6 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
true :
|
true :
|
||||||
false ) );
|
false ) );
|
||||||
|
|
||||||
// hunter-261211: jakis stary kod (i niezgodny z prawda),
|
|
||||||
// zahaszowalem i poprawilem
|
|
||||||
// youBy-220913: ale przyda sie do lampki samej przetwornicy
|
|
||||||
btLampkaPrzetw.Turn( !mvControlled->ConverterFlag );
|
btLampkaPrzetw.Turn( !mvControlled->ConverterFlag );
|
||||||
btLampkaNadmPrzetw.Turn( mvControlled->ConvOvldFlag );
|
btLampkaNadmPrzetw.Turn( mvControlled->ConvOvldFlag );
|
||||||
|
|
||||||
@@ -4445,10 +4501,12 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
|
|
||||||
btLampkaBezoporowa.Turn(mvControlled->ResistorsFlagCheck() ||
|
btLampkaBezoporowa.Turn(mvControlled->ResistorsFlagCheck() ||
|
||||||
(mvControlled->MainCtrlActualPos == 0)); // do EU04
|
(mvControlled->MainCtrlActualPos == 0)); // do EU04
|
||||||
if ((mvControlled->Itot != 0) || (mvOccupied->BrakePress > 2) ||
|
if( ( mvControlled->Itot != 0 )
|
||||||
(mvOccupied->PipePress < 3.6))
|
|| ( mvOccupied->BrakePress > 2 )
|
||||||
btLampkaStyczn.TurnOff(); // Ra: czy to jest udawanie działania
|
|| ( mvOccupied->PipePress < 3.6 ) ) {
|
||||||
// styczników liniowych?
|
// Ra: czy to jest udawanie działania styczników liniowych?
|
||||||
|
btLampkaStyczn.TurnOff();
|
||||||
|
}
|
||||||
else if (mvOccupied->BrakePress < 1)
|
else if (mvOccupied->BrakePress < 1)
|
||||||
btLampkaStyczn.TurnOn(); // mozna prowadzic rozruch
|
btLampkaStyczn.TurnOn(); // mozna prowadzic rozruch
|
||||||
if (((TestFlag(mvControlled->Couplers[1].CouplingFlag, ctrain_controll)) &&
|
if (((TestFlag(mvControlled->Couplers[1].CouplingFlag, ctrain_controll)) &&
|
||||||
@@ -4628,15 +4686,8 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
btLampkaNadmPrzetwB.TurnOn();
|
btLampkaNadmPrzetwB.TurnOn();
|
||||||
btLampkaPrzetwB.TurnOff();
|
btLampkaPrzetwB.TurnOff();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// hunter-261211: jakis stary kod (i niezgodny z prawda), zahaszowalem
|
|
||||||
// if (tmp)
|
|
||||||
// if (tmp->MoverParameters->ConverterFlag==true)
|
|
||||||
// btLampkaNadmPrzetwB.TurnOff();
|
|
||||||
// else
|
|
||||||
// btLampkaNadmPrzetwB.TurnOn();
|
|
||||||
|
|
||||||
} //**************************************************** */
|
|
||||||
if( mvControlled->Battery || mvControlled->ConverterFlag )
|
if( mvControlled->Battery || mvControlled->ConverterFlag )
|
||||||
{
|
{
|
||||||
switch (mvControlled->TrainType)
|
switch (mvControlled->TrainType)
|
||||||
@@ -4666,6 +4717,18 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
btLampkaForward.Turn(mvControlled->ActiveDir > 0); // jazda do przodu
|
btLampkaForward.Turn(mvControlled->ActiveDir > 0); // jazda do przodu
|
||||||
btLampkaBackward.Turn(mvControlled->ActiveDir < 0); // jazda do tyłu
|
btLampkaBackward.Turn(mvControlled->ActiveDir < 0); // jazda do tyłu
|
||||||
btLampkaED.Turn(mvControlled->DynamicBrakeFlag); // hamulec ED
|
btLampkaED.Turn(mvControlled->DynamicBrakeFlag); // hamulec ED
|
||||||
|
// light indicators
|
||||||
|
// NOTE: sides are hardcoded to deal with setups where single cab is equipped with all indicators
|
||||||
|
btLampkaUpperLight.Turn( ( mvOccupied->iLights[ side::front ] & light::headlight_upper ) != 0 );
|
||||||
|
btLampkaLeftLight.Turn( ( mvOccupied->iLights[ side::front ] & light::headlight_left ) != 0 );
|
||||||
|
btLampkaRightLight.Turn( ( mvOccupied->iLights[ side::front ] & light::headlight_right ) != 0 );
|
||||||
|
btLampkaLeftEndLight.Turn( ( mvOccupied->iLights[ side::front ] & light::redmarker_left ) != 0 );
|
||||||
|
btLampkaRightEndLight.Turn( ( mvOccupied->iLights[ side::front ] & light::redmarker_right ) != 0 );
|
||||||
|
btLampkaRearUpperLight.Turn( ( mvOccupied->iLights[ side::rear ] & light::headlight_upper ) != 0 );
|
||||||
|
btLampkaRearLeftLight.Turn( ( mvOccupied->iLights[ side::rear ] & light::headlight_left ) != 0 );
|
||||||
|
btLampkaRearRightLight.Turn( ( mvOccupied->iLights[ side::rear ] & light::headlight_right ) != 0 );
|
||||||
|
btLampkaRearLeftEndLight.Turn( ( mvOccupied->iLights[ side::rear ] & light::redmarker_left ) != 0 );
|
||||||
|
btLampkaRearRightEndLight.Turn( ( mvOccupied->iLights[ side::rear ] & light::redmarker_right ) != 0 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // gdy bateria wyłączona
|
{ // gdy bateria wyłączona
|
||||||
@@ -4681,7 +4744,19 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
btLampkaForward.TurnOff();
|
btLampkaForward.TurnOff();
|
||||||
btLampkaBackward.TurnOff();
|
btLampkaBackward.TurnOff();
|
||||||
btLampkaED.TurnOff();
|
btLampkaED.TurnOff();
|
||||||
|
// light indicators
|
||||||
|
btLampkaUpperLight.TurnOff();
|
||||||
|
btLampkaLeftLight.TurnOff();
|
||||||
|
btLampkaRightLight.TurnOff();
|
||||||
|
btLampkaLeftEndLight.TurnOff();
|
||||||
|
btLampkaRightEndLight.TurnOff();
|
||||||
|
btLampkaRearUpperLight.TurnOff();
|
||||||
|
btLampkaRearLeftLight.TurnOff();
|
||||||
|
btLampkaRearRightLight.TurnOff();
|
||||||
|
btLampkaRearLeftEndLight.TurnOff();
|
||||||
|
btLampkaRearRightEndLight.TurnOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
// McZapkie-080602: obroty (albo translacje) regulatorow
|
// McZapkie-080602: obroty (albo translacje) regulatorow
|
||||||
if (ggMainCtrl.SubModel) {
|
if (ggMainCtrl.SubModel) {
|
||||||
|
|
||||||
@@ -4939,12 +5014,6 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
ggRearRightLightButton.PutValue(-1);
|
ggRearRightLightButton.PutValue(-1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ggLightsButton.SubModel)
|
|
||||||
{
|
|
||||||
ggLightsButton.PutValue(mvOccupied->LightsPos - 1);
|
|
||||||
ggLightsButton.Update();
|
|
||||||
}
|
|
||||||
ggDimHeadlightsButton.Update();
|
|
||||||
//---------
|
//---------
|
||||||
// hunter-080812: poprawka na ogrzewanie w elektrykach - usuniete uzaleznienie od przetwornicy
|
// hunter-080812: poprawka na ogrzewanie w elektrykach - usuniete uzaleznienie od przetwornicy
|
||||||
if ((((mvControlled->EngineType == ElectricSeriesMotor) && (mvControlled->Mains == true) &&
|
if ((((mvControlled->EngineType == ElectricSeriesMotor) && (mvControlled->Mains == true) &&
|
||||||
@@ -5009,9 +5078,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************
|
|
||||||
// przelaczniki
|
// przelaczniki
|
||||||
|
|
||||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||||
if( Console::Pressed( Global::Keys[ k_Horn ] ) )
|
if( Console::Pressed( Global::Keys[ k_Horn ] ) )
|
||||||
{
|
{
|
||||||
@@ -5748,6 +5815,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
ggPantCompressorButton.Update();
|
ggPantCompressorButton.Update();
|
||||||
ggPantCompressorValve.Update();
|
ggPantCompressorValve.Update();
|
||||||
|
|
||||||
|
ggLightsButton.Update();
|
||||||
ggUpperLightButton.Update();
|
ggUpperLightButton.Update();
|
||||||
ggLeftLightButton.Update();
|
ggLeftLightButton.Update();
|
||||||
ggRightLightButton.Update();
|
ggRightLightButton.Update();
|
||||||
@@ -5759,6 +5827,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
ggRearRightLightButton.Update();
|
ggRearRightLightButton.Update();
|
||||||
ggRearLeftEndLightButton.Update();
|
ggRearLeftEndLightButton.Update();
|
||||||
ggRearRightEndLightButton.Update();
|
ggRearRightEndLightButton.Update();
|
||||||
|
ggDimHeadlightsButton.Update();
|
||||||
//------------
|
//------------
|
||||||
ggConverterButton.Update();
|
ggConverterButton.Update();
|
||||||
ggConverterLocalButton.Update();
|
ggConverterLocalButton.Update();
|
||||||
@@ -5769,14 +5838,14 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
ggHornButton.Update();
|
ggHornButton.Update();
|
||||||
ggHornLowButton.Update();
|
ggHornLowButton.Update();
|
||||||
ggHornHighButton.Update();
|
ggHornHighButton.Update();
|
||||||
/*
|
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||||
ggUniversal1Button.Update();
|
ggUniversal1Button.Update();
|
||||||
ggUniversal2Button.Update();
|
ggUniversal2Button.Update();
|
||||||
if( Universal4Active ) {
|
if( Universal4Active ) {
|
||||||
ggUniversal4Button.PermIncValue( dt );
|
ggUniversal4Button.PermIncValue( dt );
|
||||||
}
|
}
|
||||||
ggUniversal4Button.Update();
|
ggUniversal4Button.Update();
|
||||||
*/
|
#endif
|
||||||
for( auto &universal : ggUniversals ) {
|
for( auto &universal : ggUniversals ) {
|
||||||
universal.Update();
|
universal.Update();
|
||||||
}
|
}
|
||||||
@@ -6733,6 +6802,17 @@ void TTrain::clear_cab_controls()
|
|||||||
btLampkaWylSzybkiB.Clear();
|
btLampkaWylSzybkiB.Clear();
|
||||||
btLampkaForward.Clear();
|
btLampkaForward.Clear();
|
||||||
btLampkaBackward.Clear();
|
btLampkaBackward.Clear();
|
||||||
|
// light indicators
|
||||||
|
btLampkaUpperLight.Clear();
|
||||||
|
btLampkaLeftLight.Clear();
|
||||||
|
btLampkaRightLight.Clear();
|
||||||
|
btLampkaLeftEndLight.Clear();
|
||||||
|
btLampkaRightEndLight.Clear();
|
||||||
|
btLampkaRearUpperLight.Clear();
|
||||||
|
btLampkaRearLeftLight.Clear();
|
||||||
|
btLampkaRearRightLight.Clear();
|
||||||
|
btLampkaRearLeftEndLight.Clear();
|
||||||
|
btLampkaRearRightEndLight.Clear();
|
||||||
btCabLight.Clear(); // hunter-171012
|
btCabLight.Clear(); // hunter-171012
|
||||||
ggLeftLightButton.Clear();
|
ggLeftLightButton.Clear();
|
||||||
ggRightLightButton.Clear();
|
ggRightLightButton.Clear();
|
||||||
@@ -6842,21 +6922,23 @@ void TTrain::set_cab_controls() {
|
|||||||
ggMaxCurrentCtrl.PutValue( 1.0 );
|
ggMaxCurrentCtrl.PutValue( 1.0 );
|
||||||
}
|
}
|
||||||
// lights
|
// lights
|
||||||
int const lightsindex =
|
ggLightsButton.PutValue( mvOccupied->LightsPos - 1 );
|
||||||
( mvOccupied->ActiveCab == 1 ?
|
|
||||||
0 :
|
|
||||||
1 );
|
|
||||||
|
|
||||||
if( ( DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_left ) != 0 ) {
|
int const vehicleside =
|
||||||
|
( mvOccupied->ActiveCab == 1 ?
|
||||||
|
side::front :
|
||||||
|
side::rear );
|
||||||
|
|
||||||
|
if( ( DynamicObject->iLights[ vehicleside ] & light::headlight_left ) != 0 ) {
|
||||||
ggLeftLightButton.PutValue( 1.0 );
|
ggLeftLightButton.PutValue( 1.0 );
|
||||||
}
|
}
|
||||||
if( ( DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_right ) != 0 ) {
|
if( ( DynamicObject->iLights[ vehicleside ] & light::headlight_right ) != 0 ) {
|
||||||
ggRightLightButton.PutValue( 1.0 );
|
ggRightLightButton.PutValue( 1.0 );
|
||||||
}
|
}
|
||||||
if( ( DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_upper ) != 0 ) {
|
if( ( DynamicObject->iLights[ vehicleside ] & light::headlight_upper ) != 0 ) {
|
||||||
ggUpperLightButton.PutValue( 1.0 );
|
ggUpperLightButton.PutValue( 1.0 );
|
||||||
}
|
}
|
||||||
if( ( DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::redmarker_left ) != 0 ) {
|
if( ( DynamicObject->iLights[ vehicleside ] & light::redmarker_left ) != 0 ) {
|
||||||
if( ggLeftEndLightButton.SubModel != nullptr ) {
|
if( ggLeftEndLightButton.SubModel != nullptr ) {
|
||||||
ggLeftEndLightButton.PutValue( 1.0 );
|
ggLeftEndLightButton.PutValue( 1.0 );
|
||||||
}
|
}
|
||||||
@@ -6864,7 +6946,7 @@ void TTrain::set_cab_controls() {
|
|||||||
ggLeftLightButton.PutValue( -1.0 );
|
ggLeftLightButton.PutValue( -1.0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( ( DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::redmarker_right ) != 0 ) {
|
if( ( DynamicObject->iLights[ vehicleside ] & light::redmarker_right ) != 0 ) {
|
||||||
if( ggRightEndLightButton.SubModel != nullptr ) {
|
if( ggRightEndLightButton.SubModel != nullptr ) {
|
||||||
ggRightEndLightButton.PutValue( 1.0 );
|
ggRightEndLightButton.PutValue( 1.0 );
|
||||||
}
|
}
|
||||||
@@ -6938,227 +7020,88 @@ void TTrain::set_cab_controls() {
|
|||||||
// TODO: when cleaning up break setting indicator state into a separate function, so we can reuse it
|
// TODO: when cleaning up break setting indicator state into a separate function, so we can reuse it
|
||||||
}
|
}
|
||||||
|
|
||||||
// initializes a button matching provided label. returns: true if the label was found, false
|
// initializes a button matching provided label. returns: true if the label was found, false otherwise
|
||||||
// otherwise
|
|
||||||
// NOTE: this is temporary work-around for compiler else-if limit
|
|
||||||
// TODO: refactor the cabin controls into some sensible structure
|
// TODO: refactor the cabin controls into some sensible structure
|
||||||
bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int const Cabindex)
|
bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int const Cabindex) {
|
||||||
{
|
|
||||||
/*
|
std::unordered_map<std::string, TButton &> const lights = {
|
||||||
TButton *bt; // roboczy wskaźnik na obiekt animujący lampkę
|
{ "i-maxft:", btLampkaMaxSila },
|
||||||
*/
|
{ "i-maxftt:", btLampkaPrzekrMaxSila },
|
||||||
// SEKCJA LAMPEK
|
{ "i-radio:", btLampkaRadio },
|
||||||
if (Label == "i-maxft:")
|
{ "i-manual_brake:", btLampkaHamulecReczny },
|
||||||
{
|
{ "i-door_blocked:", btLampkaBlokadaDrzwi },
|
||||||
btLampkaMaxSila.Load(Parser, DynamicObject->mdKabina);
|
{ "i-slippery:", btLampkaPoslizg },
|
||||||
|
{ "i-contactors:", btLampkaStyczn },
|
||||||
|
{ "i-conv_ovld:", btLampkaNadmPrzetw },
|
||||||
|
{ "i-converter:", btLampkaPrzetw },
|
||||||
|
{ "i-diff_relay:", btLampkaPrzekRozn },
|
||||||
|
{ "i-diff_relay2:", btLampkaPrzekRoznPom },
|
||||||
|
{ "i-motor_ovld:", btLampkaNadmSil },
|
||||||
|
{ "i-train_controll:", btLampkaUkrotnienie },
|
||||||
|
{ "i-brake_delay_r:", btLampkaHamPosp },
|
||||||
|
{ "i-mainbreaker:", btLampkaWylSzybki },
|
||||||
|
{ "i-vent_ovld:", btLampkaNadmWent },
|
||||||
|
{ "i-comp_ovld:", btLampkaNadmSpr },
|
||||||
|
{ "i-resistors:", btLampkaOpory },
|
||||||
|
{ "i-no_resistors:", btLampkaBezoporowa },
|
||||||
|
{ "i-no_resistors_b:", btLampkaBezoporowaB },
|
||||||
|
{ "i-highcurrent:", btLampkaWysRozr },
|
||||||
|
{ "i-vent_trim:", btLampkaWentZaluzje },
|
||||||
|
{ "i-trainheating:", btLampkaOgrzewanieSkladu },
|
||||||
|
{ "i-security_aware:", btLampkaCzuwaka },
|
||||||
|
{ "i-security_cabsignal:", btLampkaSHP },
|
||||||
|
{ "i-door_left:", btLampkaDoorLeft },
|
||||||
|
{ "i-door_right:", btLampkaDoorRight },
|
||||||
|
{ "i-departure_signal:", btLampkaDepartureSignal },
|
||||||
|
{ "i-reserve:", btLampkaRezerwa },
|
||||||
|
{ "i-scnd:", btLampkaBoczniki },
|
||||||
|
{ "i-scnd1:", btLampkaBocznik1 },
|
||||||
|
{ "i-scnd2:", btLampkaBocznik2 },
|
||||||
|
{ "i-scnd3:", btLampkaBocznik3 },
|
||||||
|
{ "i-scnd4:", btLampkaBocznik4 },
|
||||||
|
{ "i-braking:", btLampkaHamienie },
|
||||||
|
{ "i-dynamicbrake:", btLampkaED },
|
||||||
|
{ "i-braking-ezt:", btLampkaHamowanie1zes },
|
||||||
|
{ "i-braking-ezt2:", btLampkaHamowanie2zes },
|
||||||
|
{ "i-compressor:", btLampkaSprezarka },
|
||||||
|
{ "i-compressorb:", btLampkaSprezarkaB },
|
||||||
|
{ "i-voltbrake:", btLampkaNapNastHam },
|
||||||
|
{ "i-mainbreakerb:", btLampkaWylSzybkiB },
|
||||||
|
{ "i-resistorsb:", btLampkaOporyB },
|
||||||
|
{ "i-contactorsb:", btLampkaStycznB },
|
||||||
|
{ "i-conv_ovldb:", btLampkaNadmPrzetwB },
|
||||||
|
{ "i-converterb:", btLampkaPrzetwB },
|
||||||
|
{ "i-forward:", btLampkaForward },
|
||||||
|
{ "i-backward:", btLampkaBackward },
|
||||||
|
{ "i-upperlight:", btLampkaUpperLight },
|
||||||
|
{ "i-leftlight:", btLampkaLeftLight },
|
||||||
|
{ "i-rightlight:", btLampkaRightLight },
|
||||||
|
{ "i-leftend:", btLampkaLeftEndLight },
|
||||||
|
{ "i-rightend:", btLampkaRightEndLight },
|
||||||
|
{ "i-rearupperlight:", btLampkaRearUpperLight },
|
||||||
|
{ "i-rearleftlight:", btLampkaRearLeftLight },
|
||||||
|
{ "i-rearrightlight:", btLampkaRearRightLight },
|
||||||
|
{ "i-rearleftend:", btLampkaRearLeftEndLight },
|
||||||
|
{ "i-rearrightend:", btLampkaRearRightEndLight },
|
||||||
|
{ "i-cablight:", btCabLight }
|
||||||
|
};
|
||||||
|
auto lookup = lights.find( Label );
|
||||||
|
if( lookup != lights.end() ) {
|
||||||
|
lookup->second.Load( Parser, DynamicObject->mdKabina );
|
||||||
}
|
}
|
||||||
else if (Label == "i-maxftt:")
|
|
||||||
{
|
else if( Label == "i-instrumentlight:" ) {
|
||||||
btLampkaPrzekrMaxSila.Load(Parser, DynamicObject->mdKabina);
|
btInstrumentLight.Load( Parser, DynamicObject->mdKabina, DynamicObject->mdModel );
|
||||||
}
|
|
||||||
else if (Label == "i-radio:")
|
|
||||||
{
|
|
||||||
btLampkaRadio.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-manual_brake:")
|
|
||||||
{
|
|
||||||
btLampkaHamulecReczny.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-door_blocked:")
|
|
||||||
{
|
|
||||||
btLampkaBlokadaDrzwi.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-slippery:")
|
|
||||||
{
|
|
||||||
btLampkaPoslizg.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-contactors:")
|
|
||||||
{
|
|
||||||
btLampkaStyczn.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-conv_ovld:")
|
|
||||||
{
|
|
||||||
btLampkaNadmPrzetw.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-converter:")
|
|
||||||
{
|
|
||||||
btLampkaPrzetw.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-diff_relay:")
|
|
||||||
{
|
|
||||||
btLampkaPrzekRozn.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-diff_relay2:")
|
|
||||||
{
|
|
||||||
btLampkaPrzekRoznPom.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-motor_ovld:")
|
|
||||||
{
|
|
||||||
btLampkaNadmSil.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-train_controll:")
|
|
||||||
{
|
|
||||||
btLampkaUkrotnienie.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-brake_delay_r:")
|
|
||||||
{
|
|
||||||
btLampkaHamPosp.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-mainbreaker:")
|
|
||||||
{
|
|
||||||
btLampkaWylSzybki.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-vent_ovld:")
|
|
||||||
{
|
|
||||||
btLampkaNadmWent.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-comp_ovld:")
|
|
||||||
{
|
|
||||||
btLampkaNadmSpr.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-resistors:")
|
|
||||||
{
|
|
||||||
btLampkaOpory.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-no_resistors:")
|
|
||||||
{
|
|
||||||
btLampkaBezoporowa.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-no_resistors_b:")
|
|
||||||
{
|
|
||||||
btLampkaBezoporowaB.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-highcurrent:")
|
|
||||||
{
|
|
||||||
btLampkaWysRozr.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-instrumentlight:")
|
|
||||||
{
|
|
||||||
btInstrumentLight.Load(Parser, DynamicObject->mdKabina, DynamicObject->mdModel);
|
|
||||||
InstrumentLightType = 0;
|
InstrumentLightType = 0;
|
||||||
}
|
}
|
||||||
else if (Label == "i-instrumentlight_M:")
|
else if( Label == "i-instrumentlight_M:" ) {
|
||||||
{
|
btInstrumentLight.Load( Parser, DynamicObject->mdKabina, DynamicObject->mdModel );
|
||||||
btInstrumentLight.Load(Parser, DynamicObject->mdKabina, DynamicObject->mdModel);
|
|
||||||
InstrumentLightType = 1;
|
InstrumentLightType = 1;
|
||||||
}
|
}
|
||||||
else if (Label == "i-instrumentlight_C:")
|
else if( Label == "i-instrumentlight_C:" ) {
|
||||||
{
|
btInstrumentLight.Load( Parser, DynamicObject->mdKabina, DynamicObject->mdModel );
|
||||||
btInstrumentLight.Load(Parser, DynamicObject->mdKabina, DynamicObject->mdModel);
|
|
||||||
InstrumentLightType = 2;
|
InstrumentLightType = 2;
|
||||||
}
|
}
|
||||||
else if (Label == "i-vent_trim:")
|
|
||||||
{
|
|
||||||
btLampkaWentZaluzje.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-trainheating:")
|
|
||||||
{
|
|
||||||
btLampkaOgrzewanieSkladu.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-security_aware:")
|
|
||||||
{
|
|
||||||
btLampkaCzuwaka.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-security_cabsignal:")
|
|
||||||
{
|
|
||||||
btLampkaSHP.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-door_left:")
|
|
||||||
{
|
|
||||||
btLampkaDoorLeft.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-door_right:")
|
|
||||||
{
|
|
||||||
btLampkaDoorRight.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-departure_signal:")
|
|
||||||
{
|
|
||||||
btLampkaDepartureSignal.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-reserve:")
|
|
||||||
{
|
|
||||||
btLampkaRezerwa.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-scnd:")
|
|
||||||
{
|
|
||||||
btLampkaBoczniki.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-scnd1:")
|
|
||||||
{
|
|
||||||
btLampkaBocznik1.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-scnd2:")
|
|
||||||
{
|
|
||||||
btLampkaBocznik2.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-scnd3:")
|
|
||||||
{
|
|
||||||
btLampkaBocznik3.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-scnd4:")
|
|
||||||
{
|
|
||||||
btLampkaBocznik4.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-braking:")
|
|
||||||
{
|
|
||||||
btLampkaHamienie.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if( Label == "i-dynamicbrake:" ) {
|
|
||||||
|
|
||||||
btLampkaED.Load( Parser, DynamicObject->mdKabina );
|
|
||||||
}
|
|
||||||
else if (Label == "i-braking-ezt:")
|
|
||||||
{
|
|
||||||
btLampkaHamowanie1zes.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-braking-ezt2:")
|
|
||||||
{
|
|
||||||
btLampkaHamowanie2zes.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-compressor:")
|
|
||||||
{
|
|
||||||
btLampkaSprezarka.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-compressorb:")
|
|
||||||
{
|
|
||||||
btLampkaSprezarkaB.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-voltbrake:")
|
|
||||||
{
|
|
||||||
btLampkaNapNastHam.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-mainbreakerb:")
|
|
||||||
{
|
|
||||||
btLampkaWylSzybkiB.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-resistorsb:")
|
|
||||||
{
|
|
||||||
btLampkaOporyB.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-contactorsb:")
|
|
||||||
{
|
|
||||||
btLampkaStycznB.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-conv_ovldb:")
|
|
||||||
{
|
|
||||||
btLampkaNadmPrzetwB.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-converterb:")
|
|
||||||
{
|
|
||||||
btLampkaPrzetwB.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-forward:")
|
|
||||||
{
|
|
||||||
btLampkaForward.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-backward:")
|
|
||||||
{
|
|
||||||
btLampkaBackward.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-cablight:")
|
|
||||||
{ // hunter-171012
|
|
||||||
btCabLight.Load(Parser, DynamicObject->mdKabina);
|
|
||||||
}
|
|
||||||
else if (Label == "i-doors:")
|
else if (Label == "i-doors:")
|
||||||
{
|
{
|
||||||
int i = Parser.getToken<int>() - 1;
|
int i = Parser.getToken<int>() - 1;
|
||||||
@@ -7175,15 +7118,10 @@ bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int co
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// initializes a gauge matching provided label. returns: true if the label was found, false
|
// initializes a gauge matching provided label. returns: true if the label was found, false otherwise
|
||||||
// otherwise
|
|
||||||
// NOTE: this is temporary work-around for compiler else-if limit
|
|
||||||
// TODO: refactor the cabin controls into some sensible structure
|
// TODO: refactor the cabin controls into some sensible structure
|
||||||
bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int const Cabindex) {
|
bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int const Cabindex) {
|
||||||
|
|
||||||
/*
|
|
||||||
TGauge *gg { nullptr }; // roboczy wskaźnik na obiekt animujący gałkę
|
|
||||||
*/
|
|
||||||
std::unordered_map<std::string, TGauge &> const gauges = {
|
std::unordered_map<std::string, TGauge &> const gauges = {
|
||||||
{ "mainctrl:", ggMainCtrl },
|
{ "mainctrl:", ggMainCtrl },
|
||||||
{ "scndctrl:", ggScndCtrl },
|
{ "scndctrl:", ggScndCtrl },
|
||||||
|
|||||||
13
Train.h
13
Train.h
@@ -171,6 +171,8 @@ class TTrain
|
|||||||
static void OnCommand_motoroverloadrelaythresholdtoggle( TTrain *Train, command_data const &Command );
|
static void OnCommand_motoroverloadrelaythresholdtoggle( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_motoroverloadrelayreset( TTrain *Train, command_data const &Command );
|
static void OnCommand_motoroverloadrelayreset( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_heatingtoggle( TTrain *Train, command_data const &Command );
|
static void OnCommand_heatingtoggle( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_lightspresetactivatenext( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_lightspresetactivateprevious( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_headlighttoggleleft( TTrain *Train, command_data const &Command );
|
static void OnCommand_headlighttoggleleft( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_headlighttoggleright( TTrain *Train, command_data const &Command );
|
static void OnCommand_headlighttoggleright( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_headlighttoggleupper( TTrain *Train, command_data const &Command );
|
static void OnCommand_headlighttoggleupper( TTrain *Train, command_data const &Command );
|
||||||
@@ -366,6 +368,17 @@ public: // reszta może by?publiczna
|
|||||||
TButton btLampkaHamulecReczny;
|
TButton btLampkaHamulecReczny;
|
||||||
TButton btLampkaForward; // Ra: lampki w przód i w ty?dla komputerowych kabin
|
TButton btLampkaForward; // Ra: lampki w przód i w ty?dla komputerowych kabin
|
||||||
TButton btLampkaBackward;
|
TButton btLampkaBackward;
|
||||||
|
// light indicators
|
||||||
|
TButton btLampkaUpperLight;
|
||||||
|
TButton btLampkaLeftLight;
|
||||||
|
TButton btLampkaRightLight;
|
||||||
|
TButton btLampkaLeftEndLight;
|
||||||
|
TButton btLampkaRightEndLight;
|
||||||
|
TButton btLampkaRearUpperLight;
|
||||||
|
TButton btLampkaRearLeftLight;
|
||||||
|
TButton btLampkaRearRightLight;
|
||||||
|
TButton btLampkaRearLeftEndLight;
|
||||||
|
TButton btLampkaRearRightEndLight;
|
||||||
|
|
||||||
TButton btCabLight; // hunter-171012: lampa oswietlajaca kabine
|
TButton btCabLight; // hunter-171012: lampa oswietlajaca kabine
|
||||||
// Ra 2013-12: wirtualne "lampki" do odbijania na haslerze w PoKeys
|
// Ra 2013-12: wirtualne "lampki" do odbijania na haslerze w PoKeys
|
||||||
|
|||||||
22
World.cpp
22
World.cpp
@@ -690,7 +690,7 @@ void TWorld::OnKeyDown(int cKey)
|
|||||||
*/
|
*/
|
||||||
if (cKey == Global::Keys[k_Heating]) // Ra: klawisz nie jest najszczęśliwszy
|
if (cKey == Global::Keys[k_Heating]) // Ra: klawisz nie jest najszczęśliwszy
|
||||||
{ // zmiana próżny/ładowny; Ra: zabrane z kabiny
|
{ // zmiana próżny/ładowny; Ra: zabrane z kabiny
|
||||||
auto *vehicle { std::get<TDynamicObject *>( simulation::Region->find_vehicle( Global::pCameraPosition, 20, false, false ) ) };
|
auto *vehicle { std::get<TDynamicObject *>( simulation::Region->find_vehicle( Global::pCameraPosition, 10, false, false ) ) };
|
||||||
if (vehicle)
|
if (vehicle)
|
||||||
{
|
{
|
||||||
if (Global::shiftState ? vehicle->MoverParameters->IncBrakeMult() :
|
if (Global::shiftState ? vehicle->MoverParameters->IncBrakeMult() :
|
||||||
@@ -703,7 +703,7 @@ void TWorld::OnKeyDown(int cKey)
|
|||||||
}
|
}
|
||||||
else if (cKey == Global::Keys[k_EndSign])
|
else if (cKey == Global::Keys[k_EndSign])
|
||||||
{ // Ra 2014-07: zabrane z kabiny
|
{ // Ra 2014-07: zabrane z kabiny
|
||||||
auto *vehicle { std::get<TDynamicObject *>( simulation::Region->find_vehicle( Global::pCameraPosition, 20, false, true ) ) };
|
auto *vehicle { std::get<TDynamicObject *>( simulation::Region->find_vehicle( Global::pCameraPosition, 10, false, true ) ) };
|
||||||
if (vehicle)
|
if (vehicle)
|
||||||
{
|
{
|
||||||
int CouplNr = (LengthSquared3(vehicle->HeadPosition() - Camera.Pos) >
|
int CouplNr = (LengthSquared3(vehicle->HeadPosition() - Camera.Pos) >
|
||||||
@@ -715,9 +715,9 @@ void TWorld::OnKeyDown(int cKey)
|
|||||||
CouplNr = 0; // z [-1,1] zrobić [0,1]
|
CouplNr = 0; // z [-1,1] zrobić [0,1]
|
||||||
int mask, set = 0; // Ra: [Shift]+[Ctrl]+[T] odpala mi jakąś idiotyczną zmianę tapety pulpitu :/
|
int mask, set = 0; // Ra: [Shift]+[Ctrl]+[T] odpala mi jakąś idiotyczną zmianę tapety pulpitu :/
|
||||||
if (Global::shiftState) // z [Shift] zapalanie
|
if (Global::shiftState) // z [Shift] zapalanie
|
||||||
set = mask = TMoverParameters::light::rearendsignals; // bez [Ctrl] założyć tabliczki
|
set = mask = light::rearendsignals; // bez [Ctrl] założyć tabliczki
|
||||||
else if (Global::ctrlState)
|
else if (Global::ctrlState)
|
||||||
set = mask = ( TMoverParameters::light::redmarker_left | TMoverParameters::light::redmarker_right ); // z [Ctrl] zapalić światła czerwone
|
set = mask = ( light::redmarker_left | light::redmarker_right ); // z [Ctrl] zapalić światła czerwone
|
||||||
else
|
else
|
||||||
mask = 2 + 32 + 64; // wyłączanie ściąga wszystko
|
mask = 2 + 32 + 64; // wyłączanie ściąga wszystko
|
||||||
if (((vehicle->iLights[CouplNr]) & mask) != set)
|
if (((vehicle->iLights[CouplNr]) & mask) != set)
|
||||||
@@ -732,7 +732,7 @@ void TWorld::OnKeyDown(int cKey)
|
|||||||
}
|
}
|
||||||
else if (cKey == Global::Keys[k_IncLocalBrakeLevel])
|
else if (cKey == Global::Keys[k_IncLocalBrakeLevel])
|
||||||
{ // zahamowanie dowolnego pojazdu
|
{ // zahamowanie dowolnego pojazdu
|
||||||
auto *vehicle { std::get<TDynamicObject *>( simulation::Region->find_vehicle( Global::pCameraPosition, 20, false, false ) ) };
|
auto *vehicle { std::get<TDynamicObject *>( simulation::Region->find_vehicle( Global::pCameraPosition, 10, false, false ) ) };
|
||||||
if (vehicle)
|
if (vehicle)
|
||||||
{
|
{
|
||||||
if (Global::ctrlState)
|
if (Global::ctrlState)
|
||||||
@@ -751,7 +751,7 @@ void TWorld::OnKeyDown(int cKey)
|
|||||||
}
|
}
|
||||||
else if (cKey == Global::Keys[k_DecLocalBrakeLevel])
|
else if (cKey == Global::Keys[k_DecLocalBrakeLevel])
|
||||||
{ // odhamowanie dowolnego pojazdu
|
{ // odhamowanie dowolnego pojazdu
|
||||||
auto *vehicle { std::get<TDynamicObject *>( simulation::Region->find_vehicle( Global::pCameraPosition, 20, false, false ) ) };
|
auto *vehicle { std::get<TDynamicObject *>( simulation::Region->find_vehicle( Global::pCameraPosition, 10, false, false ) ) };
|
||||||
if (vehicle)
|
if (vehicle)
|
||||||
{
|
{
|
||||||
if (Global::ctrlState)
|
if (Global::ctrlState)
|
||||||
@@ -1456,15 +1456,15 @@ TWorld::Update_UI() {
|
|||||||
"; TC:"
|
"; TC:"
|
||||||
+ to_string( vehicle->MoverParameters->TotalCurrent, 0 );
|
+ to_string( vehicle->MoverParameters->TotalCurrent, 0 );
|
||||||
auto const frontcouplerhighvoltage =
|
auto const frontcouplerhighvoltage =
|
||||||
to_string( vehicle->MoverParameters->Couplers[ TMoverParameters::side::front ].power_high.voltage, 0 )
|
to_string( vehicle->MoverParameters->Couplers[ side::front ].power_high.voltage, 0 )
|
||||||
+ "@"
|
+ "@"
|
||||||
+ to_string( vehicle->MoverParameters->Couplers[ TMoverParameters::side::front ].power_high.current, 0 );
|
+ to_string( vehicle->MoverParameters->Couplers[ side::front ].power_high.current, 0 );
|
||||||
auto const rearcouplerhighvoltage =
|
auto const rearcouplerhighvoltage =
|
||||||
to_string( vehicle->MoverParameters->Couplers[ TMoverParameters::side::rear ].power_high.voltage, 0 )
|
to_string( vehicle->MoverParameters->Couplers[ side::rear ].power_high.voltage, 0 )
|
||||||
+ "@"
|
+ "@"
|
||||||
+ to_string( vehicle->MoverParameters->Couplers[ TMoverParameters::side::rear ].power_high.current, 0 );
|
+ to_string( vehicle->MoverParameters->Couplers[ side::rear ].power_high.current, 0 );
|
||||||
uitextline2 += ", HV: ";
|
uitextline2 += ", HV: ";
|
||||||
if( vehicle->MoverParameters->Couplers[ TMoverParameters::side::front ].power_high.local == false ) {
|
if( vehicle->MoverParameters->Couplers[ side::front ].power_high.local == false ) {
|
||||||
uitextline2 +=
|
uitextline2 +=
|
||||||
"(" + frontcouplerhighvoltage + ")-"
|
"(" + frontcouplerhighvoltage + ")-"
|
||||||
+ ":F" + ( vehicle->DirectionGet() ? "<<" : ">>" ) + "R:"
|
+ ":F" + ( vehicle->DirectionGet() ? "<<" : ">>" ) + "R:"
|
||||||
|
|||||||
@@ -105,6 +105,8 @@ const int k_ProgramHelp = 48;
|
|||||||
/*
|
/*
|
||||||
// const int k_FreeFlyMode= 59;
|
// const int k_FreeFlyMode= 59;
|
||||||
*/
|
*/
|
||||||
|
{ "lightspresetactivatenext", command_target::vehicle },
|
||||||
|
{ "lightspresetactivateprevious", command_target::vehicle },
|
||||||
{ "headlighttoggleleft", command_target::vehicle },
|
{ "headlighttoggleleft", command_target::vehicle },
|
||||||
{ "headlighttoggleright", command_target::vehicle },
|
{ "headlighttoggleright", command_target::vehicle },
|
||||||
{ "headlighttoggleupper", command_target::vehicle },
|
{ "headlighttoggleupper", command_target::vehicle },
|
||||||
|
|||||||
@@ -100,6 +100,8 @@ const int k_ProgramHelp = 48;
|
|||||||
/*
|
/*
|
||||||
// const int k_FreeFlyMode= 59;
|
// const int k_FreeFlyMode= 59;
|
||||||
*/
|
*/
|
||||||
|
lightspresetactivatenext,
|
||||||
|
lightspresetactivateprevious,
|
||||||
headlighttoggleleft,
|
headlighttoggleleft,
|
||||||
headlighttoggleright,
|
headlighttoggleright,
|
||||||
headlighttoggleupper,
|
headlighttoggleupper,
|
||||||
@@ -117,10 +119,6 @@ const int k_ProgramHelp = 48;
|
|||||||
interiorlightdimtoggle,
|
interiorlightdimtoggle,
|
||||||
instrumentlighttoggle,
|
instrumentlighttoggle,
|
||||||
/*
|
/*
|
||||||
const int k_Univ1 = 66;
|
|
||||||
const int k_Univ2 = 67;
|
|
||||||
const int k_Univ3 = 68;
|
|
||||||
const int k_Univ4 = 69;
|
|
||||||
const int k_EndSign = 70;
|
const int k_EndSign = 70;
|
||||||
const int k_Active = 71;
|
const int k_Active = 71;
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -318,6 +318,10 @@ const int k_ProgramHelp = 48;
|
|||||||
/*
|
/*
|
||||||
// const int k_FreeFlyMode= 59;
|
// const int k_FreeFlyMode= 59;
|
||||||
*/
|
*/
|
||||||
|
// lightspresetactivatenext
|
||||||
|
{ GLFW_KEY_T | keymodifier::shift },
|
||||||
|
// lightspresetactivateprevious
|
||||||
|
{ GLFW_KEY_T },
|
||||||
// headlighttoggleleft
|
// headlighttoggleleft
|
||||||
{ GLFW_KEY_Y },
|
{ GLFW_KEY_Y },
|
||||||
// headlighttoggleright
|
// headlighttoggleright
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ light_array::insert( TDynamicObject const *Owner ) {
|
|||||||
|
|
||||||
// we're only storing lights for locos, which have two sets of lights, front and rear
|
// we're only storing lights for locos, which have two sets of lights, front and rear
|
||||||
// for a more generic role this function would have to be tweaked to add vehicle type-specific light combinations
|
// for a more generic role this function would have to be tweaked to add vehicle type-specific light combinations
|
||||||
data.emplace_back( Owner, 0 );
|
data.emplace_back( Owner, side::front );
|
||||||
data.emplace_back( Owner, 1 );
|
data.emplace_back( Owner, side::rear );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -44,7 +44,7 @@ light_array::update() {
|
|||||||
|
|
||||||
for( auto &light : data ) {
|
for( auto &light : data ) {
|
||||||
// update light parameters to match current data of the owner
|
// update light parameters to match current data of the owner
|
||||||
if( light.index == 0 ) {
|
if( light.index == side::front ) {
|
||||||
// front light set
|
// front light set
|
||||||
light.position = light.owner->GetPosition() + ( light.owner->VectorFront() * light.owner->GetLength() * 0.4 );
|
light.position = light.owner->GetPosition() + ( light.owner->VectorFront() * light.owner->GetLength() * 0.4 );
|
||||||
light.direction = glm::make_vec3( light.owner->VectorFront().getArray() );
|
light.direction = glm::make_vec3( light.owner->VectorFront().getArray() );
|
||||||
@@ -57,34 +57,25 @@ light_array::update() {
|
|||||||
light.direction.z = -light.direction.z;
|
light.direction.z = -light.direction.z;
|
||||||
}
|
}
|
||||||
// determine intensity of this light set
|
// determine intensity of this light set
|
||||||
if( ( true == light.owner->MoverParameters->Battery ) || ( true == light.owner->MoverParameters->ConverterFlag ) ) {
|
if( ( true == light.owner->MoverParameters->Battery )
|
||||||
|
|| ( true == light.owner->MoverParameters->ConverterFlag ) ) {
|
||||||
// with power on, the intensity depends on the state of activated switches
|
// with power on, the intensity depends on the state of activated switches
|
||||||
auto const &lightbits = light.owner->iLights[ light.index ];
|
// first we cross-check the list of enabled lights with the lights installed in the vehicle...
|
||||||
|
auto const lights { light.owner->iLights[ light.index ] & light.owner->LightList( static_cast<side>( light.index ) ) };
|
||||||
|
// ...then check their individual state
|
||||||
light.count = 0
|
light.count = 0
|
||||||
+ ( ( lightbits & TMoverParameters::light::headlight_left ) ? 1 : 0 )
|
+ ( ( lights & light::headlight_left ) ? 1 : 0 )
|
||||||
+ ( ( lightbits & TMoverParameters::light::headlight_right ) ? 1 : 0 )
|
+ ( ( lights & light::headlight_right ) ? 1 : 0 )
|
||||||
+ ( ( lightbits & TMoverParameters::light::headlight_upper ) ? 1 : 0 );
|
+ ( ( lights & light::headlight_upper ) ? 1 : 0 );
|
||||||
|
|
||||||
if( light.count > 0 ) {
|
if( light.count > 0 ) {
|
||||||
// TODO: intensity can be affected further by dim switch or other factors
|
|
||||||
light.intensity = std::max( 0.0f, std::log( (float)light.count + 1.0f ) );
|
light.intensity = std::max( 0.0f, std::log( (float)light.count + 1.0f ) );
|
||||||
light.intensity *= ( light.owner->DimHeadlights ? 0.6f : 1.0f );
|
light.intensity *= ( light.owner->DimHeadlights ? 0.6f : 1.0f );
|
||||||
|
// TBD, TODO: intensity can be affected further by other factors
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
light.intensity = 0.0f;
|
light.intensity = 0.0f;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
// crude catch for unmanned modules which share the light state with the controlled unit.
|
|
||||||
// why don't they get their own light bits btw ._.
|
|
||||||
// TODO, TBD: have separate light bits for each vehicle, so this override isn't necessary
|
|
||||||
// NOTE: should be no longer needed, test and delete if there's no ill effects
|
|
||||||
if( ( light.owner->Controller == AIdriver )
|
|
||||||
&& ( light.owner->Mechanik == nullptr ) ) {
|
|
||||||
|
|
||||||
light.intensity = 0.0f;
|
|
||||||
light.count = 0;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// with battery off the lights are off
|
// with battery off the lights are off
|
||||||
|
|||||||
@@ -304,8 +304,8 @@ mouse_input::default_bindings() {
|
|||||||
user_command::redmarkertoggleright,
|
user_command::redmarkertoggleright,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
{ "lights_sw:", {
|
{ "lights_sw:", {
|
||||||
user_command::none,
|
user_command::lightspresetactivatenext,
|
||||||
user_command::none } }, // TODO: implement commands for lights controller
|
user_command::lightspresetactivateprevious } },
|
||||||
{ "rearupperlight_sw:", {
|
{ "rearupperlight_sw:", {
|
||||||
user_command::headlighttogglerearupper,
|
user_command::headlighttogglerearupper,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
|||||||
@@ -199,8 +199,10 @@ private:
|
|||||||
bind_buffer();
|
bind_buffer();
|
||||||
void
|
void
|
||||||
delete_buffer();
|
delete_buffer();
|
||||||
|
static
|
||||||
void
|
void
|
||||||
bind_streams( stream_units const &Units, unsigned int const Streams );
|
bind_streams( stream_units const &Units, unsigned int const Streams );
|
||||||
|
static
|
||||||
void
|
void
|
||||||
release_streams();
|
release_streams();
|
||||||
|
|
||||||
@@ -310,7 +312,7 @@ private:
|
|||||||
// methods
|
// methods
|
||||||
inline
|
inline
|
||||||
bool
|
bool
|
||||||
valid( geometry_handle const &Geometry ) {
|
valid( geometry_handle const &Geometry ) const {
|
||||||
return ( ( Geometry.bank != 0 )
|
return ( ( Geometry.bank != 0 )
|
||||||
&& ( Geometry.bank <= m_geometrybanks.size() ) ); }
|
&& ( Geometry.bank <= m_geometrybanks.size() ) ); }
|
||||||
inline
|
inline
|
||||||
|
|||||||
22
scene.cpp
22
scene.cpp
@@ -384,7 +384,7 @@ basic_cell::register_end( TTraction *Traction ) {
|
|||||||
|
|
||||||
// find a vehicle located nearest to specified point, within specified radius, optionally ignoring vehicles without drivers. reurns: located vehicle and distance
|
// find a vehicle located nearest to specified point, within specified radius, optionally ignoring vehicles without drivers. reurns: located vehicle and distance
|
||||||
std::tuple<TDynamicObject *, float>
|
std::tuple<TDynamicObject *, float>
|
||||||
basic_cell::find( glm::dvec3 const &Point, float const Radius, bool const Onlycontrolled, bool const Findbycoupler ) {
|
basic_cell::find( glm::dvec3 const &Point, float const Radius, bool const Onlycontrolled, bool const Findbycoupler ) const {
|
||||||
|
|
||||||
TDynamicObject *vehiclenearest { nullptr };
|
TDynamicObject *vehiclenearest { nullptr };
|
||||||
float leastdistance { std::numeric_limits<float>::max() };
|
float leastdistance { std::numeric_limits<float>::max() };
|
||||||
@@ -419,7 +419,7 @@ basic_cell::find( glm::dvec3 const &Point, float const Radius, bool const Onlyco
|
|||||||
|
|
||||||
// finds a path with one of its ends located in specified point. returns: located path and id of the matching endpoint
|
// finds a path with one of its ends located in specified point. returns: located path and id of the matching endpoint
|
||||||
std::tuple<TTrack *, int>
|
std::tuple<TTrack *, int>
|
||||||
basic_cell::find( glm::dvec3 const &Point, TTrack const *Exclude ) {
|
basic_cell::find( glm::dvec3 const &Point, TTrack const *Exclude ) const {
|
||||||
|
|
||||||
Math3D::vector3 point { Point.x, Point.y, Point.z }; // sad workaround until math classes unification
|
Math3D::vector3 point { Point.x, Point.y, Point.z }; // sad workaround until math classes unification
|
||||||
int endpointid;
|
int endpointid;
|
||||||
@@ -439,7 +439,7 @@ basic_cell::find( glm::dvec3 const &Point, TTrack const *Exclude ) {
|
|||||||
|
|
||||||
// finds a traction piece with one of its ends located in specified point. returns: located traction piece and id of the matching endpoint
|
// finds a traction piece with one of its ends located in specified point. returns: located traction piece and id of the matching endpoint
|
||||||
std::tuple<TTraction *, int>
|
std::tuple<TTraction *, int>
|
||||||
basic_cell::find( glm::dvec3 const &Point, TTraction const *Exclude ) {
|
basic_cell::find( glm::dvec3 const &Point, TTraction const *Exclude ) const {
|
||||||
|
|
||||||
int endpointid;
|
int endpointid;
|
||||||
|
|
||||||
@@ -458,7 +458,7 @@ basic_cell::find( glm::dvec3 const &Point, TTraction const *Exclude ) {
|
|||||||
|
|
||||||
// finds a traction piece located nearest to specified point, sharing section with specified other piece and powered in specified direction. returns: located traction piece
|
// finds a traction piece located nearest to specified point, sharing section with specified other piece and powered in specified direction. returns: located traction piece
|
||||||
std::tuple<TTraction *, int, float>
|
std::tuple<TTraction *, int, float>
|
||||||
basic_cell::find( glm::dvec3 const &Point, TTraction const *Other, int const Currentdirection ) {
|
basic_cell::find( glm::dvec3 const &Point, TTraction const *Other, int const Currentdirection ) const {
|
||||||
|
|
||||||
TTraction
|
TTraction
|
||||||
*tractionnearest { nullptr };
|
*tractionnearest { nullptr };
|
||||||
@@ -862,7 +862,12 @@ basic_region::update_traction( TDynamicObject *Vehicle, int const Pantographinde
|
|||||||
void
|
void
|
||||||
basic_region::serialize( std::string const &Scenariofile ) const {
|
basic_region::serialize( std::string const &Scenariofile ) const {
|
||||||
|
|
||||||
auto filename { Global::asCurrentSceneryPath + Scenariofile };
|
auto filename { Scenariofile };
|
||||||
|
if( filename[ 0 ] == '$' ) {
|
||||||
|
// trim leading $ char rainsted utility may add to the base name for modified .scn files
|
||||||
|
filename.erase( 0, 1 );
|
||||||
|
}
|
||||||
|
filename = Global::asCurrentSceneryPath + filename;
|
||||||
if( ( filename.rfind( '.' ) != std::string::npos )
|
if( ( filename.rfind( '.' ) != std::string::npos )
|
||||||
&& ( filename.rfind( '.' ) != filename.rfind( ".." ) + 1 ) ) {
|
&& ( filename.rfind( '.' ) != filename.rfind( ".." ) + 1 ) ) {
|
||||||
// trim extension, it's typically going to be for different file type
|
// trim extension, it's typically going to be for different file type
|
||||||
@@ -900,7 +905,12 @@ basic_region::serialize( std::string const &Scenariofile ) const {
|
|||||||
bool
|
bool
|
||||||
basic_region::deserialize( std::string const &Scenariofile ) {
|
basic_region::deserialize( std::string const &Scenariofile ) {
|
||||||
|
|
||||||
auto filename { Global::asCurrentSceneryPath + Scenariofile };
|
auto filename { Scenariofile };
|
||||||
|
if( filename[ 0 ] == '$' ) {
|
||||||
|
// trim leading $ char rainsted utility may add to the base name for modified .scn files
|
||||||
|
filename.erase( 0, 1 );
|
||||||
|
}
|
||||||
|
filename = Global::asCurrentSceneryPath + filename;
|
||||||
if( ( filename.rfind( '.' ) != std::string::npos )
|
if( ( filename.rfind( '.' ) != std::string::npos )
|
||||||
&& ( filename.rfind( '.' ) != filename.rfind( ".." ) + 1 ) ) {
|
&& ( filename.rfind( '.' ) != filename.rfind( ".." ) + 1 ) ) {
|
||||||
// trim extension, it's typically going to be for different file type
|
// trim extension, it's typically going to be for different file type
|
||||||
|
|||||||
9
scene.h
9
scene.h
@@ -117,16 +117,16 @@ public:
|
|||||||
register_end( TTraction *Traction );
|
register_end( TTraction *Traction );
|
||||||
// find a vehicle located nearest to specified point, within specified radius. reurns: located vehicle and distance
|
// find a vehicle located nearest to specified point, within specified radius. reurns: located vehicle and distance
|
||||||
std::tuple<TDynamicObject *, float>
|
std::tuple<TDynamicObject *, float>
|
||||||
find( glm::dvec3 const &Point, float const Radius, bool const Onlycontrolled, bool const Findbycoupler );
|
find( glm::dvec3 const &Point, float const Radius, bool const Onlycontrolled, bool const Findbycoupler ) const;
|
||||||
// finds a path with one of its ends located in specified point. returns: located path and id of the matching endpoint
|
// finds a path with one of its ends located in specified point. returns: located path and id of the matching endpoint
|
||||||
std::tuple<TTrack *, int>
|
std::tuple<TTrack *, int>
|
||||||
find( glm::dvec3 const &Point, TTrack const *Exclude );
|
find( glm::dvec3 const &Point, TTrack const *Exclude ) const;
|
||||||
// finds a traction piece with one of its ends located in specified point. returns: located traction piece and id of the matching endpoint
|
// finds a traction piece with one of its ends located in specified point. returns: located traction piece and id of the matching endpoint
|
||||||
std::tuple<TTraction *, int>
|
std::tuple<TTraction *, int>
|
||||||
find( glm::dvec3 const &Point, TTraction const *Exclude );
|
find( glm::dvec3 const &Point, TTraction const *Exclude ) const;
|
||||||
// finds a traction piece located nearest to specified point, sharing section with specified other piece and powered in specified direction. returns: located traction piece
|
// finds a traction piece located nearest to specified point, sharing section with specified other piece and powered in specified direction. returns: located traction piece
|
||||||
std::tuple<TTraction *, int, float>
|
std::tuple<TTraction *, int, float>
|
||||||
find( glm::dvec3 const &Point, TTraction const *Other, int const Currentdirection );
|
find( glm::dvec3 const &Point, TTraction const *Other, int const Currentdirection ) const;
|
||||||
// sets center point of the cell
|
// sets center point of the cell
|
||||||
void
|
void
|
||||||
center( glm::dvec3 Center );
|
center( glm::dvec3 Center );
|
||||||
@@ -351,6 +351,7 @@ private:
|
|||||||
bool
|
bool
|
||||||
point_inside( glm::dvec3 const &Location );
|
point_inside( glm::dvec3 const &Location );
|
||||||
// legacy method, trims provided shape to fit into a section. adds trimmed part at the end of provided list, returns true if changes were made
|
// legacy method, trims provided shape to fit into a section. adds trimmed part at the end of provided list, returns true if changes were made
|
||||||
|
static
|
||||||
bool
|
bool
|
||||||
RaTriangleDivider( shape_node &Shape, std::deque<shape_node> &Shapes );
|
RaTriangleDivider( shape_node &Shape, std::deque<shape_node> &Shapes );
|
||||||
// provides access to section enclosing specified point
|
// provides access to section enclosing specified point
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ struct basic_node {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
basic_node( scene::node_data const &Nodedata );
|
explicit basic_node( scene::node_data const &Nodedata );
|
||||||
// destructor
|
// destructor
|
||||||
virtual ~basic_node() = default;
|
virtual ~basic_node() = default;
|
||||||
// methods
|
// methods
|
||||||
|
|||||||
@@ -316,11 +316,8 @@ state_manager::deserialize_node( cParser &Input, scene::scratch_data &Scratchpad
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( ( vehicle->MoverParameters->CategoryFlag == 1 ) // trains only
|
if( ( vehicle->MoverParameters->CategoryFlag == 1 ) // trains only
|
||||||
&& ( ( vehicle->MoverParameters->SecuritySystem.SystemType != 0 )
|
&& ( ( vehicle->LightList( side::front ) & ( light::headlight_left | light::headlight_right | light::headlight_upper ) != 0 )
|
||||||
|| ( vehicle->MoverParameters->SandCapacity > 0.0 ) ) ) {
|
|| ( vehicle->LightList( side::rear ) & ( light::headlight_left | light::headlight_right | light::headlight_upper ) != 0 ) ) ) {
|
||||||
// we check for presence of security system or sand load, as a way to determine whether the vehicle is a controllable engine
|
|
||||||
// NOTE: this isn't 100% precise, e.g. middle EZT module comes with security system, while it has no lights, and some engines
|
|
||||||
// don't have security systems fitted
|
|
||||||
simulation::Lights.insert( vehicle );
|
simulation::Lights.insert( vehicle );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -609,7 +606,7 @@ state_manager::deserialize_endtrainset( cParser &Input, scene::scratch_data &Scr
|
|||||||
}
|
}
|
||||||
if( Scratchpad.trainset.couplings.back() == coupling::faux ) {
|
if( Scratchpad.trainset.couplings.back() == coupling::faux ) {
|
||||||
// jeśli ostatni pojazd ma sprzęg 0 to założymy mu końcówki blaszane (jak AI się odpali, to sobie poprawi)
|
// jeśli ostatni pojazd ma sprzęg 0 to założymy mu końcówki blaszane (jak AI się odpali, to sobie poprawi)
|
||||||
Scratchpad.trainset.vehicles.back()->RaLightsSet( -1, TMoverParameters::light::rearendsignals );
|
Scratchpad.trainset.vehicles.back()->RaLightsSet( -1, light::rearendsignals );
|
||||||
}
|
}
|
||||||
// all done
|
// all done
|
||||||
Scratchpad.trainset.is_open = false;
|
Scratchpad.trainset.is_open = false;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
// methods
|
// methods
|
||||||
// legacy method, calculates changes in simulation state over specified time
|
// legacy method, calculates changes in simulation state over specified time
|
||||||
void
|
void
|
||||||
update( double dt, int iter );
|
update( double Deltatime, int Iterationcount );
|
||||||
bool
|
bool
|
||||||
deserialize( std::string const &Scenariofile );
|
deserialize( std::string const &Scenariofile );
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ Type_
|
|||||||
clamp_circular( Type_ Value, Type_ const Range = static_cast<Type_>(360) ) {
|
clamp_circular( Type_ Value, Type_ const Range = static_cast<Type_>(360) ) {
|
||||||
|
|
||||||
Value -= Range * (int)( Value / Range ); // clamp the range to 0-360
|
Value -= Range * (int)( Value / Range ); // clamp the range to 0-360
|
||||||
if( Value < 0.0 ) Value += Range;
|
if( Value < Type_(0) ) Value += Range;
|
||||||
|
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user