mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 00:29:19 +02:00
build 170428. command propagation based on coupler type, minor bug fixes
This commit is contained in:
41
DynObj.cpp
41
DynObj.cpp
@@ -2468,11 +2468,12 @@ bool TDynamicObject::Update(double dt, double dt1)
|
|||||||
// Ra 2013-12: Niebugocław mówi, że w EZT podnoszą się przy 2.5
|
// Ra 2013-12: Niebugocław mówi, że w EZT podnoszą się przy 2.5
|
||||||
if( true == MoverParameters->PantPressSwitchActive ) {
|
if( true == MoverParameters->PantPressSwitchActive ) {
|
||||||
// opuszczenie pantografów przy niskim ciśnieniu
|
// opuszczenie pantografów przy niskim ciśnieniu
|
||||||
MoverParameters->PantFront( false, MoverParameters->TrainType == dt_EZT );
|
MoverParameters->PantFront( false, ( MoverParameters->TrainType == dt_EZT ? command_range::unit : command_range::local ) );
|
||||||
MoverParameters->PantRear( false, MoverParameters->TrainType == dt_EZT );
|
MoverParameters->PantRear( false, ( MoverParameters->TrainType == dt_EZT ? command_range::unit : command_range::local ) );
|
||||||
// pressure switch safety measure -- open the line breaker, unless there's alternate source of traction voltage
|
// pressure switch safety measure -- open the line breaker, unless there's alternate source of traction voltage
|
||||||
if( MoverParameters->GetTrainsetVoltage() == 0.0 ) {
|
if( MoverParameters->GetTrainsetVoltage() < 0.5 * MoverParameters->EnginePowerSource.MaxVoltage ) {
|
||||||
MoverParameters->MainSwitch( false, false );
|
// TODO: check whether line breaker should be open EMU-wide
|
||||||
|
MoverParameters->MainSwitch( false, ( MoverParameters->TrainType == dt_EZT ? command_range::unit : command_range::local ) );
|
||||||
}
|
}
|
||||||
// mark the pressure switch as spent
|
// mark the pressure switch as spent
|
||||||
MoverParameters->PantPressSwitchActive = false;
|
MoverParameters->PantPressSwitchActive = false;
|
||||||
@@ -2931,15 +2932,15 @@ bool TDynamicObject::Update(double dt, double dt1)
|
|||||||
&& ( MoverParameters->EngineType != DieselEngine )
|
&& ( MoverParameters->EngineType != DieselEngine )
|
||||||
&& ( MoverParameters->EngineType != WheelsDriven ) )
|
&& ( MoverParameters->EngineType != WheelsDriven ) )
|
||||||
{ // jeśli bateria wyłączona, a nie diesel ani drezyna reczna
|
{ // jeśli bateria wyłączona, a nie diesel ani drezyna reczna
|
||||||
if( MoverParameters->MainSwitch( false, MoverParameters->TrainType == dt_EZT ) ) {
|
if( MoverParameters->MainSwitch( false, ( MoverParameters->TrainType == dt_EZT ? command_range::unit : command_range::local ) ) ) {
|
||||||
// wyłączyć zasilanie
|
// wyłączyć zasilanie
|
||||||
// NOTE: we turn off entire EMU, but only the affected unit for other multi-unit consists
|
// NOTE: we turn off entire EMU, but only the affected unit for other multi-unit consists
|
||||||
MoverParameters->EventFlag = true;
|
MoverParameters->EventFlag = true;
|
||||||
// drop pantographs
|
// drop pantographs
|
||||||
// NOTE: this isn't universal behaviour
|
// NOTE: this isn't universal behaviour
|
||||||
// TODO: have this dependant on .fiz-driven flag
|
// TODO: have this dependant on .fiz-driven flag
|
||||||
MoverParameters->PantFront( false, MoverParameters->TrainType == dt_EZT );
|
MoverParameters->PantFront( false, ( MoverParameters->TrainType == dt_EZT ? command_range::unit : command_range::local ) );
|
||||||
MoverParameters->PantRear( false, MoverParameters->TrainType == dt_EZT );
|
MoverParameters->PantRear( false, ( MoverParameters->TrainType == dt_EZT ? command_range::unit : command_range::local ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (MoverParameters->TrainType == dt_ET42)
|
if (MoverParameters->TrainType == dt_ET42)
|
||||||
@@ -4148,22 +4149,20 @@ void TDynamicObject::RenderSounds()
|
|||||||
sConverter.TurnOff(MechInside, GetPosition());
|
sConverter.TurnOff(MechInside, GetPosition());
|
||||||
sConverter.Update(MechInside, GetPosition());
|
sConverter.Update(MechInside, GetPosition());
|
||||||
}
|
}
|
||||||
if (MoverParameters->WarningSignal > 0)
|
|
||||||
{
|
if( TestFlag( MoverParameters->WarningSignal, 1 ) ) {
|
||||||
if (TestFlag(MoverParameters->WarningSignal, 1))
|
sHorn1.TurnOn( MechInside, GetPosition() );
|
||||||
sHorn1.TurnOn(MechInside, GetPosition());
|
|
||||||
else
|
|
||||||
sHorn1.TurnOff(MechInside, GetPosition());
|
|
||||||
if (TestFlag(MoverParameters->WarningSignal, 2))
|
|
||||||
sHorn2.TurnOn(MechInside, GetPosition());
|
|
||||||
else
|
|
||||||
sHorn2.TurnOff(MechInside, GetPosition());
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
sHorn1.TurnOff( MechInside, GetPosition() );
|
||||||
sHorn1.TurnOff(MechInside, GetPosition());
|
|
||||||
sHorn2.TurnOff(MechInside, GetPosition());
|
|
||||||
}
|
}
|
||||||
|
if( TestFlag( MoverParameters->WarningSignal, 2 ) ) {
|
||||||
|
sHorn2.TurnOn( MechInside, GetPosition() );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sHorn2.TurnOff( MechInside, GetPosition() );
|
||||||
|
}
|
||||||
|
|
||||||
if (MoverParameters->DoorClosureWarning)
|
if (MoverParameters->DoorClosureWarning)
|
||||||
{
|
{
|
||||||
if (MoverParameters->DepartureSignal) // NBMX sygnal odjazdu, MC: pod warunkiem ze jest
|
if (MoverParameters->DepartureSignal) // NBMX sygnal odjazdu, MC: pod warunkiem ze jest
|
||||||
|
|||||||
@@ -149,6 +149,12 @@ enum coupling {
|
|||||||
mainhose = 0x20,
|
mainhose = 0x20,
|
||||||
heating = 0x40,
|
heating = 0x40,
|
||||||
permanent = 0x80
|
permanent = 0x80
|
||||||
|
};
|
||||||
|
/*! przesylanie komend sterujacych*/
|
||||||
|
enum command_range {
|
||||||
|
local,
|
||||||
|
unit,
|
||||||
|
consist
|
||||||
};
|
};
|
||||||
/*typ hamulca elektrodynamicznego*/
|
/*typ hamulca elektrodynamicznego*/
|
||||||
static int const dbrake_none = 0;
|
static int const dbrake_none = 0;
|
||||||
@@ -279,6 +285,7 @@ struct TCommand
|
|||||||
std::string Command; /*komenda*/
|
std::string Command; /*komenda*/
|
||||||
double Value1 = 0.0; /*argumenty komendy*/
|
double Value1 = 0.0; /*argumenty komendy*/
|
||||||
double Value2 = 0.0;
|
double Value2 = 0.0;
|
||||||
|
int Coupling{ ctrain_controll }; // coupler flag used to determine command propagation
|
||||||
TLocation Location;
|
TLocation Location;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1012,11 +1019,11 @@ public:
|
|||||||
|
|
||||||
/*! przesylanie komend sterujacych*/
|
/*! przesylanie komend sterujacych*/
|
||||||
bool SendCtrlBroadcast(std::string CtrlCommand, double ctrlvalue);
|
bool SendCtrlBroadcast(std::string CtrlCommand, double ctrlvalue);
|
||||||
bool SendCtrlToNext(std::string CtrlCommand, double ctrlvalue, double dir);
|
bool SendCtrlToNext(std::string const CtrlCommand, double const ctrlvalue, double const dir, int const Couplertype = ctrain_controll);
|
||||||
bool SetInternalCommand(std::string NewCommand, double NewValue1, double NewValue2);
|
bool SetInternalCommand( std::string NewCommand, double NewValue1, double NewValue2, int const Couplertype = ctrain_controll );
|
||||||
double GetExternalCommand(std::string &Command);
|
double GetExternalCommand(std::string &Command);
|
||||||
bool RunCommand(std::string Command, double CValue1, double CValue2);
|
bool RunCommand( std::string Command, double CValue1, double CValue2, int const Couplertype = ctrain_controll );
|
||||||
bool RunInternalCommand(void);
|
bool RunInternalCommand();
|
||||||
void PutCommand(std::string NewCommand, double NewValue1, double NewValue2, const TLocation &NewLocation);
|
void PutCommand(std::string NewCommand, double NewValue1, double NewValue2, const TLocation &NewLocation);
|
||||||
bool CabActivisation(void);
|
bool CabActivisation(void);
|
||||||
bool CabDeactivisation(void);
|
bool CabDeactivisation(void);
|
||||||
@@ -1088,7 +1095,7 @@ public:
|
|||||||
|
|
||||||
/*--funkcje dla lokomotyw*/
|
/*--funkcje dla lokomotyw*/
|
||||||
bool DirectionBackward(void);/*! kierunek ruchu*/
|
bool DirectionBackward(void);/*! kierunek ruchu*/
|
||||||
bool MainSwitch( bool const State, bool const Multiunitcontrol = true );/*! wylacznik glowny*/
|
bool MainSwitch( bool const State, int const Notify = command_range::consist );/*! wylacznik glowny*/
|
||||||
bool ConverterSwitch(bool State);/*! wl/wyl przetwornicy*/
|
bool ConverterSwitch(bool State);/*! wl/wyl przetwornicy*/
|
||||||
bool CompressorSwitch(bool State);/*! wl/wyl sprezarki*/
|
bool CompressorSwitch(bool State);/*! wl/wyl sprezarki*/
|
||||||
|
|
||||||
@@ -1116,8 +1123,8 @@ public:
|
|||||||
bool AutoRelayCheck(void);//symulacja automatycznego rozruchu
|
bool AutoRelayCheck(void);//symulacja automatycznego rozruchu
|
||||||
|
|
||||||
bool ResistorsFlagCheck(void); //sprawdzenie kontrolki oporow rozruchowych NBMX
|
bool ResistorsFlagCheck(void); //sprawdzenie kontrolki oporow rozruchowych NBMX
|
||||||
bool PantFront(bool const State, bool const Multiunitcontrol = true ); //obsluga pantografou przedniego
|
bool PantFront( bool const State, int const Notify = command_range::consist ); //obsluga pantografou przedniego
|
||||||
bool PantRear(bool const State, bool const Multiunitcontrol = true ); //obsluga pantografu tylnego
|
bool PantRear( bool const State, int const Notify = command_range::consist ); //obsluga pantografu tylnego
|
||||||
|
|
||||||
/*-funkcje typowe dla lokomotywy spalinowej z przekladnia mechaniczna*/
|
/*-funkcje typowe dla lokomotywy spalinowej z przekladnia mechaniczna*/
|
||||||
bool dizel_EngageSwitch(double state);
|
bool dizel_EngageSwitch(double state);
|
||||||
|
|||||||
@@ -744,9 +744,9 @@ void TMoverParameters::UpdatePantVolume(double dt)
|
|||||||
if( ( true == PantPressSwitchActive )
|
if( ( true == PantPressSwitchActive )
|
||||||
&& ( PantPress < EnginePowerSource.CollectorParameters.MinPress ) ) {
|
&& ( PantPress < EnginePowerSource.CollectorParameters.MinPress ) ) {
|
||||||
// wywalenie szybkiego z powodu niskiego ciśnienia
|
// wywalenie szybkiego z powodu niskiego ciśnienia
|
||||||
if( GetTrainsetVoltage() < EnginePowerSource.CollectorParameters.MinV ) {
|
if( GetTrainsetVoltage() < 0.5 * EnginePowerSource.MaxVoltage ) {
|
||||||
// to jest trochę proteza; zasilanie członu może być przez sprzęg WN
|
// to jest trochę proteza; zasilanie członu może być przez sprzęg WN
|
||||||
if( MainSwitch( false, TrainType == dt_EZT ) ) {
|
if( MainSwitch( false, ( TrainType == dt_EZT ? command_range::unit : command_range::local ) ) ) {
|
||||||
EventFlag = true;
|
EventFlag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2271,7 +2271,7 @@ bool TMoverParameters::AntiSlippingButton(void)
|
|||||||
// Q: 20160713
|
// Q: 20160713
|
||||||
// włączenie / wyłączenie obwodu głownego
|
// włączenie / wyłączenie obwodu głownego
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
bool TMoverParameters::MainSwitch( bool const State, bool const Multiunitcontrol )
|
bool TMoverParameters::MainSwitch( bool const State, int const Notify )
|
||||||
{
|
{
|
||||||
bool MS;
|
bool MS;
|
||||||
|
|
||||||
@@ -2285,17 +2285,25 @@ bool TMoverParameters::MainSwitch( bool const State, bool const Multiunitcontrol
|
|||||||
{
|
{
|
||||||
if( Mains ) {
|
if( Mains ) {
|
||||||
// jeśli był załączony
|
// jeśli był załączony
|
||||||
if( true == Multiunitcontrol ) {
|
if( Notify != command_range::local ) {
|
||||||
// wysłanie wyłączenia do pozostałych?
|
// wysłanie wyłączenia do pozostałych?
|
||||||
SendCtrlToNext( "MainSwitch", int( State ), CabNo );
|
SendCtrlToNext(
|
||||||
|
"MainSwitch", int( State ), CabNo,
|
||||||
|
( Notify == command_range::unit ?
|
||||||
|
ctrain_controll | ctrain_depot :
|
||||||
|
ctrain_controll ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Mains = State;
|
Mains = State;
|
||||||
if( Mains ) {
|
if( Mains ) {
|
||||||
// jeśli został załączony
|
// jeśli został załączony
|
||||||
if( true == Multiunitcontrol ) {
|
if( Notify != command_range::local ) {
|
||||||
// wyslanie po wlaczeniu albo przed wylaczeniem
|
// wysłanie wyłączenia do pozostałych?
|
||||||
SendCtrlToNext( "MainSwitch", int( State ), CabNo );
|
SendCtrlToNext(
|
||||||
|
"MainSwitch", int( State ), CabNo,
|
||||||
|
( Notify == command_range::unit ?
|
||||||
|
ctrain_controll | ctrain_depot :
|
||||||
|
ctrain_controll ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MS = true; // wartość zwrotna
|
MS = true; // wartość zwrotna
|
||||||
@@ -4068,7 +4076,7 @@ double TMoverParameters::TractionForce(double dt)
|
|||||||
if ( (std::max(GetTrainsetVoltage(), std::abs(Voltage)) < EnginePowerSource.CollectorParameters.MinV) ||
|
if ( (std::max(GetTrainsetVoltage(), std::abs(Voltage)) < EnginePowerSource.CollectorParameters.MinV) ||
|
||||||
(std::max(GetTrainsetVoltage(), std::abs(Voltage)) * EnginePowerSource.CollectorParameters.OVP >
|
(std::max(GetTrainsetVoltage(), std::abs(Voltage)) * EnginePowerSource.CollectorParameters.OVP >
|
||||||
EnginePowerSource.CollectorParameters.MaxV))
|
EnginePowerSource.CollectorParameters.MaxV))
|
||||||
if (MainSwitch(false, TrainType == dt_EZT)) // TODO: check whether we need to send this EMU-wide
|
if( MainSwitch( false, ( TrainType == dt_EZT ? command_range::unit : command_range::local ) ) ) // TODO: check whether we need to send this EMU-wide
|
||||||
EventFlag = true; // wywalanie szybkiego z powodu niewłaściwego napięcia
|
EventFlag = true; // wywalanie szybkiego z powodu niewłaściwego napięcia
|
||||||
|
|
||||||
if (((DynamicBrakeType == dbrake_automatic) || (DynamicBrakeType == dbrake_switch)) &&
|
if (((DynamicBrakeType == dbrake_automatic) || (DynamicBrakeType == dbrake_switch)) &&
|
||||||
@@ -4355,7 +4363,7 @@ double TMoverParameters::TractionForce(double dt)
|
|||||||
// nie wchodzić w funkcję bez potrzeby
|
// nie wchodzić w funkcję bez potrzeby
|
||||||
if( ( std::max( std::abs( Voltage ), GetTrainsetVoltage() ) < EnginePowerSource.CollectorParameters.MinV )
|
if( ( std::max( std::abs( Voltage ), GetTrainsetVoltage() ) < EnginePowerSource.CollectorParameters.MinV )
|
||||||
|| ( std::max( std::abs( Voltage ), GetTrainsetVoltage() ) > EnginePowerSource.CollectorParameters.MaxV + 200 ) ) {
|
|| ( std::max( std::abs( Voltage ), GetTrainsetVoltage() ) > EnginePowerSource.CollectorParameters.MaxV + 200 ) ) {
|
||||||
MainSwitch( false, TrainType == dt_EZT ); // TODO: check whether we need to send this EMU-wide
|
MainSwitch( false, ( TrainType == dt_EZT ? command_range::unit : command_range::local ) ); // TODO: check whether we need to send this EMU-wide
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tmpV = abs(nrot) * (PI * WheelDiameter) * 3.6; //*DirAbsolute*eimc[eimc_s_p]; - do przemyslenia dzialanie pp
|
tmpV = abs(nrot) * (PI * WheelDiameter) * 3.6; //*DirAbsolute*eimc[eimc_s_p]; - do przemyslenia dzialanie pp
|
||||||
@@ -5069,7 +5077,7 @@ bool TMoverParameters::AutoRelayCheck(void)
|
|||||||
// Q: 20160713
|
// Q: 20160713
|
||||||
// Podnosi / opuszcza przedni pantograf. Returns: state of the pantograph after the operation
|
// Podnosi / opuszcza przedni pantograf. Returns: state of the pantograph after the operation
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
bool TMoverParameters::PantFront(bool const State, bool const Multiunitcontrol)
|
bool TMoverParameters::PantFront( bool const State, int const Notify )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
if( ( true == Battery )
|
if( ( true == Battery )
|
||||||
@@ -5079,14 +5087,24 @@ bool TMoverParameters::PantFront(bool const State, bool const Multiunitcontrol)
|
|||||||
PantFrontUp = State;
|
PantFrontUp = State;
|
||||||
if( State == true ) {
|
if( State == true ) {
|
||||||
PantFrontStart = 0;
|
PantFrontStart = 0;
|
||||||
if( true == Multiunitcontrol ) {
|
if( Notify != command_range::local ) {
|
||||||
SendCtrlToNext( "PantFront", 1, CabNo );
|
// wysłanie wyłączenia do pozostałych?
|
||||||
|
SendCtrlToNext(
|
||||||
|
"PantFront", 1, CabNo,
|
||||||
|
( Notify == command_range::unit ?
|
||||||
|
ctrain_controll | ctrain_depot :
|
||||||
|
ctrain_controll ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PantFrontStart = 1;
|
PantFrontStart = 1;
|
||||||
if( true == Multiunitcontrol ) {
|
if( Notify != command_range::local ) {
|
||||||
SendCtrlToNext( "PantFront", 0, CabNo );
|
// wysłanie wyłączenia do pozostałych?
|
||||||
|
SendCtrlToNext(
|
||||||
|
"PantFront", 0, CabNo,
|
||||||
|
( Notify == command_range::unit ?
|
||||||
|
ctrain_controll | ctrain_depot :
|
||||||
|
ctrain_controll ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5112,7 +5130,7 @@ bool TMoverParameters::PantFront(bool const State, bool const Multiunitcontrol)
|
|||||||
// Q: 20160713
|
// Q: 20160713
|
||||||
// Podnoszenie / opuszczanie pantografu tylnego
|
// Podnoszenie / opuszczanie pantografu tylnego
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
bool TMoverParameters::PantRear(bool const State, bool const Multiunitcontrol)
|
bool TMoverParameters::PantRear( bool const State, int const Notify )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
if( ( true == Battery )
|
if( ( true == Battery )
|
||||||
@@ -5122,14 +5140,24 @@ bool TMoverParameters::PantRear(bool const State, bool const Multiunitcontrol)
|
|||||||
PantRearUp = State;
|
PantRearUp = State;
|
||||||
if( State == true ) {
|
if( State == true ) {
|
||||||
PantRearStart = 0;
|
PantRearStart = 0;
|
||||||
if( true == Multiunitcontrol ) {
|
if( Notify != command_range::local ) {
|
||||||
SendCtrlToNext( "PantRear", 1, CabNo );
|
// wysłanie wyłączenia do pozostałych?
|
||||||
|
SendCtrlToNext(
|
||||||
|
"PantRear", 1, CabNo,
|
||||||
|
( Notify == command_range::unit ?
|
||||||
|
ctrain_controll | ctrain_depot :
|
||||||
|
ctrain_controll ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PantRearStart = 1;
|
PantRearStart = 1;
|
||||||
if( true == Multiunitcontrol ) {
|
if( Notify != command_range::local ) {
|
||||||
SendCtrlToNext( "PantRear", 0, CabNo );
|
// wysłanie wyłączenia do pozostałych?
|
||||||
|
SendCtrlToNext(
|
||||||
|
"PantRear", 0, CabNo,
|
||||||
|
( Notify == command_range::unit ?
|
||||||
|
ctrain_controll | ctrain_depot :
|
||||||
|
ctrain_controll ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7653,18 +7681,20 @@ bool TMoverParameters::SendCtrlBroadcast(std::string CtrlCommand, double ctrlval
|
|||||||
// Q: 20160714
|
// Q: 20160714
|
||||||
// Ustawienie komendy wraz z parametrami
|
// Ustawienie komendy wraz z parametrami
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
bool TMoverParameters::SetInternalCommand(std::string NewCommand, double NewValue1,
|
bool TMoverParameters::SetInternalCommand(std::string NewCommand, double NewValue1, double NewValue2, int const Couplertype)
|
||||||
double NewValue2)
|
|
||||||
{
|
{
|
||||||
bool SIC;
|
bool SIC;
|
||||||
if ((CommandIn.Command == NewCommand) && (CommandIn.Value1 == NewValue1) &&
|
if( ( CommandIn.Command == NewCommand )
|
||||||
(CommandIn.Value2 == NewValue2))
|
&& ( CommandIn.Value1 == NewValue1 )
|
||||||
|
&& ( CommandIn.Value2 == NewValue2 )
|
||||||
|
&& ( CommandIn.Coupling == Couplertype ) )
|
||||||
SIC = false;
|
SIC = false;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CommandIn.Command = NewCommand;
|
CommandIn.Command = NewCommand;
|
||||||
CommandIn.Value1 = NewValue1;
|
CommandIn.Value1 = NewValue1;
|
||||||
CommandIn.Value2 = NewValue2;
|
CommandIn.Value2 = NewValue2;
|
||||||
|
CommandIn.Coupling = Couplertype;
|
||||||
SIC = true;
|
SIC = true;
|
||||||
LastLoadChangeTime = 0; // zerowanie czasu (roz)ładowania
|
LastLoadChangeTime = 0; // zerowanie czasu (roz)ładowania
|
||||||
}
|
}
|
||||||
@@ -7676,7 +7706,7 @@ bool TMoverParameters::SetInternalCommand(std::string NewCommand, double NewValu
|
|||||||
// Q: 20160714
|
// Q: 20160714
|
||||||
// wysyłanie komendy w kierunku dir (1=przód, -1=tył) do kolejnego pojazdu (jednego)
|
// wysyłanie komendy w kierunku dir (1=przód, -1=tył) do kolejnego pojazdu (jednego)
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
bool TMoverParameters::SendCtrlToNext( std::string CtrlCommand, double ctrlvalue, double dir ) {
|
bool TMoverParameters::SendCtrlToNext( std::string const CtrlCommand, double const ctrlvalue, double const dir, int const Couplertype ) {
|
||||||
bool OK;
|
bool OK;
|
||||||
int d; // numer sprzęgu w kierunku którego wysyłamy
|
int d; // numer sprzęgu w kierunku którego wysyłamy
|
||||||
|
|
||||||
@@ -7687,15 +7717,15 @@ bool TMoverParameters::SendCtrlToNext( std::string CtrlCommand, double ctrlvalue
|
|||||||
if( OK ) {
|
if( OK ) {
|
||||||
// musi być wybrana niezerowa kabina
|
// musi być wybrana niezerowa kabina
|
||||||
if( ( Couplers[ d ].Connected != nullptr )
|
if( ( Couplers[ d ].Connected != nullptr )
|
||||||
&& ( TestFlag( Couplers[ d ].CouplingFlag, ctrain_controll ) ) ) {
|
&& ( TestFlag( Couplers[ d ].CouplingFlag, Couplertype ) ) ) {
|
||||||
if( Couplers[ d ].ConnectedNr != d ) {
|
if( Couplers[ d ].ConnectedNr != d ) {
|
||||||
// jeśli ten nastpęny jest zgodny z aktualnym
|
// jeśli ten nastpęny jest zgodny z aktualnym
|
||||||
if( Couplers[ d ].Connected->SetInternalCommand( CtrlCommand, ctrlvalue, dir ) )
|
if( Couplers[ d ].Connected->SetInternalCommand( CtrlCommand, ctrlvalue, dir, Couplertype ) )
|
||||||
OK = ( Couplers[ d ].Connected->RunInternalCommand() && OK ); // tu jest rekurencja
|
OK = ( Couplers[ d ].Connected->RunInternalCommand() && OK ); // tu jest rekurencja
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// jeśli następny jest ustawiony przeciwnie, zmieniamy kierunek
|
// jeśli następny jest ustawiony przeciwnie, zmieniamy kierunek
|
||||||
if( Couplers[ d ].Connected->SetInternalCommand( CtrlCommand, ctrlvalue, -dir ) )
|
if( Couplers[ d ].Connected->SetInternalCommand( CtrlCommand, ctrlvalue, -dir, Couplertype ) )
|
||||||
OK = ( Couplers[ d ].Connected->RunInternalCommand() && OK ); // tu jest rekurencja
|
OK = ( Couplers[ d ].Connected->RunInternalCommand() && OK ); // tu jest rekurencja
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7714,7 +7744,7 @@ bool TMoverParameters::SendCtrlToNext( std::string CtrlCommand, double ctrlvalue
|
|||||||
// Komenda musi być zdefiniowana tutaj, a jeśli się wywołuje funkcję, to ona nie może
|
// Komenda musi być zdefiniowana tutaj, a jeśli się wywołuje funkcję, to ona nie może
|
||||||
// sama przesyłać do kolejnych pojazdów. Należy też się zastanowić, czy dla uzyskania
|
// sama przesyłać do kolejnych pojazdów. Należy też się zastanowić, czy dla uzyskania
|
||||||
// jakiejś zmiany (np. IncMainCtrl) lepiej wywołać funkcję, czy od razu wysłać komendę.
|
// jakiejś zmiany (np. IncMainCtrl) lepiej wywołać funkcję, czy od razu wysłać komendę.
|
||||||
bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CValue2)
|
bool TMoverParameters::RunCommand( std::string Command, double CValue1, double CValue2, int const Couplertype )
|
||||||
{
|
{
|
||||||
bool OK;
|
bool OK;
|
||||||
std::string testload;
|
std::string testload;
|
||||||
@@ -7724,7 +7754,7 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV
|
|||||||
{
|
{
|
||||||
if (MainCtrlPosNo >= floor(CValue1))
|
if (MainCtrlPosNo >= floor(CValue1))
|
||||||
MainCtrlPos = static_cast<int>(floor(CValue1));
|
MainCtrlPos = static_cast<int>(floor(CValue1));
|
||||||
OK = SendCtrlToNext(Command, CValue1, CValue2);
|
OK = SendCtrlToNext(Command, CValue1, CValue2, Couplertype);
|
||||||
}
|
}
|
||||||
else if (Command == "ScndCtrl")
|
else if (Command == "ScndCtrl")
|
||||||
{
|
{
|
||||||
@@ -7738,7 +7768,7 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV
|
|||||||
ScndCtrlActualPos = 0;
|
ScndCtrlActualPos = 0;
|
||||||
if (ScndCtrlPosNo >= floor(CValue1))
|
if (ScndCtrlPosNo >= floor(CValue1))
|
||||||
ScndCtrlPos = static_cast<int>(floor(CValue1));
|
ScndCtrlPos = static_cast<int>(floor(CValue1));
|
||||||
OK = SendCtrlToNext(Command, CValue1, CValue2);
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
}
|
}
|
||||||
/* else if command='BrakeCtrl' then
|
/* else if command='BrakeCtrl' then
|
||||||
begin
|
begin
|
||||||
@@ -7753,7 +7783,7 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV
|
|||||||
Hamulec->SetEPS(CValue1);
|
Hamulec->SetEPS(CValue1);
|
||||||
// fBrakeCtrlPos:=BrakeCtrlPos; //to powinnno być w jednym miejscu, aktualnie w C++!!!
|
// fBrakeCtrlPos:=BrakeCtrlPos; //to powinnno być w jednym miejscu, aktualnie w C++!!!
|
||||||
BrakePressureActual = BrakePressureTable[BrakeCtrlPos];
|
BrakePressureActual = BrakePressureTable[BrakeCtrlPos];
|
||||||
OK = SendCtrlToNext(Command, CValue1, CValue2);
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
} // youby - odluzniacz hamulcow, przyda sie
|
} // youby - odluzniacz hamulcow, przyda sie
|
||||||
else if (Command == "BrakeReleaser")
|
else if (Command == "BrakeReleaser")
|
||||||
{
|
{
|
||||||
@@ -7770,13 +7800,13 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
Mains = false;
|
Mains = false;
|
||||||
OK = SendCtrlToNext(Command, CValue1, CValue2);
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
}
|
}
|
||||||
else if (Command == "Direction")
|
else if (Command == "Direction")
|
||||||
{
|
{
|
||||||
ActiveDir = static_cast<int>(floor(CValue1));
|
ActiveDir = static_cast<int>(floor(CValue1));
|
||||||
DirAbsolute = ActiveDir * CabNo;
|
DirAbsolute = ActiveDir * CabNo;
|
||||||
OK = SendCtrlToNext(Command, CValue1, CValue2);
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
}
|
}
|
||||||
else if (Command == "CabActivisation")
|
else if (Command == "CabActivisation")
|
||||||
{
|
{
|
||||||
@@ -7797,7 +7827,7 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
DirAbsolute = ActiveDir * CabNo;
|
DirAbsolute = ActiveDir * CabNo;
|
||||||
OK = SendCtrlToNext(Command, CValue1, CValue2);
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
}
|
}
|
||||||
else if (Command == "AutoRelaySwitch")
|
else if (Command == "AutoRelaySwitch")
|
||||||
{
|
{
|
||||||
@@ -7805,7 +7835,7 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV
|
|||||||
AutoRelayFlag = true;
|
AutoRelayFlag = true;
|
||||||
else
|
else
|
||||||
AutoRelayFlag = false;
|
AutoRelayFlag = false;
|
||||||
OK = SendCtrlToNext(Command, CValue1, CValue2);
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
}
|
}
|
||||||
else if (Command == "FuseSwitch")
|
else if (Command == "FuseSwitch")
|
||||||
{
|
{
|
||||||
@@ -7817,7 +7847,7 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV
|
|||||||
// if ((EngineType=ElectricSeriesMotor)or(EngineType=DieselElectric)) and not FuseFlag and
|
// if ((EngineType=ElectricSeriesMotor)or(EngineType=DieselElectric)) and not FuseFlag and
|
||||||
// (CValue1=0) and Mains then
|
// (CValue1=0) and Mains then
|
||||||
// FuseFlag:=true;
|
// FuseFlag:=true;
|
||||||
OK = SendCtrlToNext(Command, CValue1, CValue2);
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
}
|
}
|
||||||
else if (Command == "ConverterSwitch") /*NBMX*/
|
else if (Command == "ConverterSwitch") /*NBMX*/
|
||||||
{
|
{
|
||||||
@@ -7825,7 +7855,7 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV
|
|||||||
ConverterAllow = true;
|
ConverterAllow = true;
|
||||||
else if ((CValue1 == 0))
|
else if ((CValue1 == 0))
|
||||||
ConverterAllow = false;
|
ConverterAllow = false;
|
||||||
OK = SendCtrlToNext(Command, CValue1, CValue2);
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
}
|
}
|
||||||
else if (Command == "BatterySwitch") /*NBMX*/
|
else if (Command == "BatterySwitch") /*NBMX*/
|
||||||
{
|
{
|
||||||
@@ -7837,7 +7867,7 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV
|
|||||||
SecuritySystem.Status = SecuritySystem.Status || s_waiting; // aktywacja czuwaka
|
SecuritySystem.Status = SecuritySystem.Status || s_waiting; // aktywacja czuwaka
|
||||||
else
|
else
|
||||||
SecuritySystem.Status = 0; // wyłączenie czuwaka
|
SecuritySystem.Status = 0; // wyłączenie czuwaka
|
||||||
OK = SendCtrlToNext(Command, CValue1, CValue2);
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
}
|
}
|
||||||
// else if command='EpFuseSwitch' then {NBMX}
|
// else if command='EpFuseSwitch' then {NBMX}
|
||||||
// begin
|
// begin
|
||||||
@@ -7851,7 +7881,7 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV
|
|||||||
CompressorAllow = true;
|
CompressorAllow = true;
|
||||||
else if ((CValue1 == 0))
|
else if ((CValue1 == 0))
|
||||||
CompressorAllow = false;
|
CompressorAllow = false;
|
||||||
OK = SendCtrlToNext(Command, CValue1, CValue2);
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
}
|
}
|
||||||
else if (Command == "DoorOpen") /*NBMX*/
|
else if (Command == "DoorOpen") /*NBMX*/
|
||||||
{ // Ra: uwzględnić trzeba jeszcze zgodność sprzęgów
|
{ // Ra: uwzględnić trzeba jeszcze zgodność sprzęgów
|
||||||
@@ -7869,7 +7899,7 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV
|
|||||||
if ((CValue1 == 1) || (CValue1 == 3))
|
if ((CValue1 == 1) || (CValue1 == 3))
|
||||||
DoorRightOpened = true;
|
DoorRightOpened = true;
|
||||||
}
|
}
|
||||||
OK = SendCtrlToNext(Command, CValue1, CValue2);
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
}
|
}
|
||||||
else if (Command == "DoorClose") /*NBMX*/
|
else if (Command == "DoorClose") /*NBMX*/
|
||||||
{ // Ra: uwzględnić trzeba jeszcze zgodność sprzęgów
|
{ // Ra: uwzględnić trzeba jeszcze zgodność sprzęgów
|
||||||
@@ -7887,7 +7917,7 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV
|
|||||||
if ((CValue1 == 1) || (CValue1 == 3))
|
if ((CValue1 == 1) || (CValue1 == 3))
|
||||||
DoorRightOpened = false;
|
DoorRightOpened = false;
|
||||||
}
|
}
|
||||||
OK = SendCtrlToNext(Command, CValue1, CValue2);
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
}
|
}
|
||||||
else if (Command == "PantFront") /*Winger 160204*/
|
else if (Command == "PantFront") /*Winger 160204*/
|
||||||
{ // Ra: uwzględnić trzeba jeszcze zgodność sprzęgów
|
{ // Ra: uwzględnić trzeba jeszcze zgodność sprzęgów
|
||||||
@@ -7932,7 +7962,7 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV
|
|||||||
PantRearStart = 1;
|
PantRearStart = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OK = SendCtrlToNext(Command, CValue1, CValue2);
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
}
|
}
|
||||||
else if (Command == "PantRear") /*Winger 160204, ABu 310105 i 030305*/
|
else if (Command == "PantRear") /*Winger 160204, ABu 310105 i 030305*/
|
||||||
{ // Ra: uwzględnić trzeba jeszcze zgodność sprzęgów
|
{ // Ra: uwzględnić trzeba jeszcze zgodność sprzęgów
|
||||||
@@ -7977,7 +8007,7 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV
|
|||||||
PantFrontStart = 1;
|
PantFrontStart = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OK = SendCtrlToNext(Command, CValue1, CValue2);
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
}
|
}
|
||||||
else if (Command == "MaxCurrentSwitch")
|
else if (Command == "MaxCurrentSwitch")
|
||||||
{
|
{
|
||||||
@@ -8063,19 +8093,19 @@ bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CV
|
|||||||
// Q: 20160714
|
// Q: 20160714
|
||||||
// Uruchamia funkcję RunCommand aż do skutku. Jeśli będzie pozytywny to kasuje komendę.
|
// Uruchamia funkcję RunCommand aż do skutku. Jeśli będzie pozytywny to kasuje komendę.
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
bool TMoverParameters::RunInternalCommand(void)
|
bool TMoverParameters::RunInternalCommand()
|
||||||
{
|
{
|
||||||
bool OK;
|
bool OK;
|
||||||
|
|
||||||
if (!CommandIn.Command.empty())
|
if (!CommandIn.Command.empty())
|
||||||
{
|
{
|
||||||
OK = RunCommand(CommandIn.Command, CommandIn.Value1, CommandIn.Value2);
|
OK = RunCommand( CommandIn.Command, CommandIn.Value1, CommandIn.Value2, CommandIn.Coupling );
|
||||||
if (OK)
|
if (OK) {
|
||||||
|
|
||||||
{
|
|
||||||
CommandIn.Command.clear(); // kasowanie bo rozkaz wykonany
|
CommandIn.Command.clear(); // kasowanie bo rozkaz wykonany
|
||||||
CommandIn.Value1 = 0;
|
CommandIn.Value1 = 0;
|
||||||
CommandIn.Value2 = 0;
|
CommandIn.Value2 = 0;
|
||||||
|
CommandIn.Coupling = 0;
|
||||||
CommandIn.Location.X = 0;
|
CommandIn.Location.X = 0;
|
||||||
CommandIn.Location.Y = 0;
|
CommandIn.Location.Y = 0;
|
||||||
CommandIn.Location.Z = 0;
|
CommandIn.Location.Z = 0;
|
||||||
|
|||||||
89
Train.cpp
89
Train.cpp
@@ -2783,7 +2783,7 @@ void TTrain::OnCommand_hornlowactivate( TTrain *Train, command_data const &Comma
|
|||||||
else if( Command.action == GLFW_RELEASE ) {
|
else if( Command.action == GLFW_RELEASE ) {
|
||||||
// turn off
|
// turn off
|
||||||
// NOTE: we turn off both low and high horn, due to unreliability of release event when shift key is involved
|
// NOTE: we turn off both low and high horn, due to unreliability of release event when shift key is involved
|
||||||
Train->mvControlled->WarningSignal &= ~( 1 | 2 );
|
Train->mvOccupied->WarningSignal &= ~( 1 | 2 );
|
||||||
// audio feedback
|
// audio feedback
|
||||||
if( ( Train->ggHornButton.GetValue() < -0.5 )
|
if( ( Train->ggHornButton.GetValue() < -0.5 )
|
||||||
|| ( Train->ggHornLowButton.GetValue() > 0.5 ) ) {
|
|| ( Train->ggHornLowButton.GetValue() > 0.5 ) ) {
|
||||||
@@ -2826,14 +2826,14 @@ void TTrain::OnCommand_hornhighactivate( TTrain *Train, command_data const &Comm
|
|||||||
else if( Command.action == GLFW_RELEASE ) {
|
else if( Command.action == GLFW_RELEASE ) {
|
||||||
// turn off
|
// turn off
|
||||||
// NOTE: we turn off both low and high horn, due to unreliability of release event when shift key is involved
|
// NOTE: we turn off both low and high horn, due to unreliability of release event when shift key is involved
|
||||||
Train->mvControlled->WarningSignal &= ~( 1 | 2 );
|
Train->mvOccupied->WarningSignal &= ~( 1 | 2 );
|
||||||
// audio feedback
|
// audio feedback
|
||||||
if( Train->ggHornButton.GetValue() > 0.5 ) {
|
if( Train->ggHornButton.GetValue() > 0.5 ) {
|
||||||
Train->play_sound( Train->dsbSwitch );
|
Train->play_sound( Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggHornButton.UpdateValue( 0.0 );
|
Train->ggHornButton.UpdateValue( 0.0 );
|
||||||
Train->ggHornButton.UpdateValue( 0.0 );
|
Train->ggHornHighButton.UpdateValue( 0.0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3507,45 +3507,6 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
DWORD stat;
|
DWORD stat;
|
||||||
double dt = Deltatime; // Timer::GetDeltaTime();
|
double dt = Deltatime; // Timer::GetDeltaTime();
|
||||||
|
|
||||||
// catch cases where the power goes out, and the linebreaker state is left as closed
|
|
||||||
if( ( m_linebreakerstate == 1 )
|
|
||||||
&& ( false == mvControlled->Mains )
|
|
||||||
&& ( ggMainButton.GetValue() < 0.05 ) ) {
|
|
||||||
// crude way to catch cases where the main was knocked out and the user is trying to restart it
|
|
||||||
// because the state of the line breaker isn't changed to match, we need to do it here manually
|
|
||||||
m_linebreakerstate = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: crude way to have the pantographs go back up if they're dropped due to insufficient pressure etc
|
|
||||||
// TODO: rework it into something more elegant, when redoing the whole consist/unit/cab etc arrangement
|
|
||||||
if( ( mvControlled->Battery )
|
|
||||||
|| ( mvControlled->ConverterFlag ) ) {
|
|
||||||
if( ( false == mvControlled->PantFrontUp )
|
|
||||||
&& ( ggPantFrontButton.GetValue() > 0.95 ) ) {
|
|
||||||
mvControlled->PantFront( true );
|
|
||||||
}
|
|
||||||
if( ( false == mvControlled->PantRearUp )
|
|
||||||
&& ( ggPantRearButton.GetValue() > 0.95 ) ) {
|
|
||||||
mvControlled->PantRear( true );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
// NOTE: disabled while switch state isn't preserved while moving between compartments
|
|
||||||
// check whether we should raise the pantographs, based on volume in pantograph tank
|
|
||||||
if( mvControlled->PantPress > (
|
|
||||||
mvControlled->TrainType == dt_EZT ?
|
|
||||||
2.4 :
|
|
||||||
3.5 ) ) {
|
|
||||||
if( ( false == mvControlled->PantFrontUp )
|
|
||||||
&& ( ggPantFrontButton.GetValue() > 0.95 ) ) {
|
|
||||||
mvControlled->PantFront( true );
|
|
||||||
}
|
|
||||||
if( ( false == mvControlled->PantRearUp )
|
|
||||||
&& ( ggPantRearButton.GetValue() > 0.95 ) ) {
|
|
||||||
mvControlled->PantRear( true );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (DynamicObject->mdKabina)
|
if (DynamicObject->mdKabina)
|
||||||
{ // Ra: TODO: odczyty klawiatury/pulpitu nie
|
{ // Ra: TODO: odczyty klawiatury/pulpitu nie
|
||||||
// powinny być uzależnione od istnienia modelu
|
// powinny być uzależnione od istnienia modelu
|
||||||
@@ -3780,7 +3741,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
// TODO: check whether it should affect entire consist for EMU
|
// TODO: check whether it should affect entire consist for EMU
|
||||||
// TODO: check whether it should happen if there's power supplied alternatively through hvcouplers
|
// TODO: check whether it should happen if there's power supplied alternatively through hvcouplers
|
||||||
// TODO: potentially move this to the mover module, as there isn't much reason to have this dependent on the operator presence
|
// TODO: potentially move this to the mover module, as there isn't much reason to have this dependent on the operator presence
|
||||||
mvControlled->MainSwitch( false, false );
|
mvControlled->MainSwitch( false, ( mvControlled->TrainType == dt_EZT ? command_range::unit : command_range::local ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3811,7 +3772,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
{
|
{
|
||||||
mvControlled->ConvOvldFlag = true;
|
mvControlled->ConvOvldFlag = true;
|
||||||
if (mvControlled->TrainType != dt_EZT)
|
if (mvControlled->TrainType != dt_EZT)
|
||||||
mvControlled->MainSwitch(false, mvControlled->TrainType == dt_EZT);
|
mvControlled->MainSwitch( false, ( mvControlled->TrainType == dt_EZT ? command_range::unit : command_range::local ) );
|
||||||
}
|
}
|
||||||
else if( fConverterTimer >= fConverterPrzekaznik ) {
|
else if( fConverterTimer >= fConverterPrzekaznik ) {
|
||||||
// changed switch from always true to take into account state of the compressor switch
|
// changed switch from always true to take into account state of the compressor switch
|
||||||
@@ -5827,6 +5788,46 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// catch cases where the power goes out, and the linebreaker state is left as closed
|
||||||
|
if( ( m_linebreakerstate == 1 )
|
||||||
|
&& ( false == mvControlled->Mains )
|
||||||
|
&& ( ggMainButton.GetValue() < 0.05 ) ) {
|
||||||
|
// crude way to catch cases where the main was knocked out and the user is trying to restart it
|
||||||
|
// because the state of the line breaker isn't changed to match, we need to do it here manually
|
||||||
|
m_linebreakerstate = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: crude way to have the pantographs go back up if they're dropped due to insufficient pressure etc
|
||||||
|
// TODO: rework it into something more elegant, when redoing the whole consist/unit/cab etc arrangement
|
||||||
|
if( ( mvControlled->Battery )
|
||||||
|
|| ( mvControlled->ConverterFlag ) ) {
|
||||||
|
if( ( false == mvControlled->PantFrontUp )
|
||||||
|
&& ( ggPantFrontButton.GetValue() >= 1.0 ) ) {
|
||||||
|
mvControlled->PantFront( true );
|
||||||
|
}
|
||||||
|
if( ( false == mvControlled->PantRearUp )
|
||||||
|
&& ( ggPantRearButton.GetValue() >= 1.0 ) ) {
|
||||||
|
mvControlled->PantRear( true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
// NOTE: disabled while switch state isn't preserved while moving between compartments
|
||||||
|
// check whether we should raise the pantographs, based on volume in pantograph tank
|
||||||
|
if( mvControlled->PantPress > (
|
||||||
|
mvControlled->TrainType == dt_EZT ?
|
||||||
|
2.4 :
|
||||||
|
3.5 ) ) {
|
||||||
|
if( ( false == mvControlled->PantFrontUp )
|
||||||
|
&& ( ggPantFrontButton.GetValue() > 0.95 ) ) {
|
||||||
|
mvControlled->PantFront( true );
|
||||||
|
}
|
||||||
|
if( ( false == mvControlled->PantRearUp )
|
||||||
|
&& ( ggPantRearButton.GetValue() > 0.95 ) ) {
|
||||||
|
mvControlled->PantRear( true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
m_updated = true;
|
m_updated = true;
|
||||||
return true; //(DynamicObject->Update(dt));
|
return true; //(DynamicObject->Update(dt));
|
||||||
} // koniec update
|
} // koniec update
|
||||||
|
|||||||
Reference in New Issue
Block a user