mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 23:19:19 +02:00
build 200525. vehicle control type, coupling logic enhancement, uncoupling cab control, minor bug fixes
This commit is contained in:
@@ -1855,7 +1855,7 @@ void TController::Activation()
|
||||
ZeroSpeed();
|
||||
ZeroDirection();
|
||||
mvOccupied->SpringBrakeActivate( true );
|
||||
if (TestFlag(d->MoverParameters->Couplers[iDirectionOrder < 0 ? end::rear : end::front].CouplingFlag, ctrain_controll)) {
|
||||
if (TestFlag(d->MoverParameters->Couplers[iDirectionOrder < 0 ? end::rear : end::front].CouplingFlag, coupling::control)) {
|
||||
mvControlling->MainSwitch( false ); // dezaktywacja czuwaka, jeśli przejście do innego członu
|
||||
mvOccupied->DecLocalBrakeLevel(LocalBrakePosNo); // zwolnienie hamulca w opuszczanym pojeździe
|
||||
// mvOccupied->BrakeLevelSet((mvOccupied->BrakeHandle==FVel6)?4:-2); //odcięcie na
|
||||
@@ -1866,7 +1866,7 @@ void TController::Activation()
|
||||
mvOccupied->CabOccupied = mvOccupied->CabActive; // użytkownik moze zmienić CabOccupied wychodząc
|
||||
mvOccupied->CabDeactivisation(); // tak jest w Train.cpp
|
||||
// przejście AI na drugą stronę EN57, ET41 itp.
|
||||
while (TestFlag(d->MoverParameters->Couplers[iDirection < 0 ? end::rear : end::front].CouplingFlag, ctrain_controll))
|
||||
while (TestFlag(d->MoverParameters->Couplers[iDirection < 0 ? end::rear : end::front].CouplingFlag, coupling::control))
|
||||
{ // jeśli pojazd z przodu jest ukrotniony, to przechodzimy do niego
|
||||
d = iDirection * d->DirectionGet() < 0 ? d->Next() :
|
||||
d->Prev(); // przechodzimy do następnego członu
|
||||
|
||||
44
DynObj.cpp
44
DynObj.cpp
@@ -931,13 +931,13 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
// Winger 160204 - podnoszenie pantografow
|
||||
|
||||
// przewody sterowania ukrotnionego
|
||||
if (TestFlag(MoverParameters->Couplers[0].CouplingFlag, ctrain_controll))
|
||||
if (TestFlag(MoverParameters->Couplers[0].CouplingFlag, coupling::control))
|
||||
{
|
||||
btCCtrl1.Turn( true );
|
||||
btnOn = true;
|
||||
}
|
||||
// else btCCtrl1.TurnOff();
|
||||
if (TestFlag(MoverParameters->Couplers[1].CouplingFlag, ctrain_controll))
|
||||
if (TestFlag(MoverParameters->Couplers[1].CouplingFlag, coupling::control))
|
||||
{
|
||||
btCCtrl2.Turn( true );
|
||||
btnOn = true;
|
||||
@@ -1495,9 +1495,8 @@ TDynamicObject::couple( int const Side ) {
|
||||
}
|
||||
if( false == TestFlag( MoverParameters->Couplers[ Side ].CouplingFlag, coupling::control ) ) {
|
||||
// ukrotnionko
|
||||
if( ( coupler.AllowedFlag
|
||||
& othercoupler.AllowedFlag
|
||||
& coupling::control ) == coupling::control ) {
|
||||
if( ( ( coupler.AllowedFlag & othercoupler.AllowedFlag & coupling::control ) == coupling::control )
|
||||
&& ( coupler.control_type == othercoupler.control_type ) ) {
|
||||
if( MoverParameters->Attach(
|
||||
Side, neighbour.vehicle_end,
|
||||
othervehicleparams,
|
||||
@@ -6840,41 +6839,6 @@ void TDynamicObject::move_set(double distance)
|
||||
}
|
||||
}
|
||||
|
||||
// returns type of the nearest functional power source present in the trainset
|
||||
TPowerSource
|
||||
TDynamicObject::ConnectedEnginePowerSource( TDynamicObject const *Caller ) const {
|
||||
|
||||
// if there's engine in the current vehicle, that's good enough...
|
||||
if( MoverParameters->EnginePowerSource.SourceType != TPowerSource::NotDefined ) {
|
||||
return MoverParameters->EnginePowerSource.SourceType;
|
||||
}
|
||||
// ...otherwise check rear first...
|
||||
// NOTE: the order should be reversed in flipped vehicles, but we ignore this out of laziness
|
||||
if( ( nullptr != NextConnected() )
|
||||
&& ( NextConnected() != Caller )
|
||||
&& ( ( MoverParameters->Couplers[1].CouplingFlag & ctrain_controll ) == ctrain_controll ) ) {
|
||||
|
||||
auto source = NextConnected()->ConnectedEnginePowerSource( this );
|
||||
if( source != TPowerSource::NotDefined ) {
|
||||
|
||||
return source;
|
||||
}
|
||||
}
|
||||
// ...then rear...
|
||||
if( ( nullptr != PrevConnected() )
|
||||
&& ( PrevConnected() != Caller )
|
||||
&& ( ( MoverParameters->Couplers[ 0 ].CouplingFlag & ctrain_controll ) == ctrain_controll ) ) {
|
||||
|
||||
auto source = PrevConnected()->ConnectedEnginePowerSource( this );
|
||||
if( source != TPowerSource::NotDefined ) {
|
||||
|
||||
return source;
|
||||
}
|
||||
}
|
||||
// ...if we're still here, report lack of power source
|
||||
return MoverParameters->EnginePowerSource.SourceType;
|
||||
}
|
||||
|
||||
void
|
||||
TDynamicObject::update_shake( double const Timedelta ) {
|
||||
// Ra: mechanik powinien być telepany niezależnie od pozycji pojazdu
|
||||
|
||||
2
DynObj.h
2
DynObj.h
@@ -199,8 +199,6 @@ public:
|
||||
inline int PrevConnectedNo() const { return MoverParameters->Neighbours[ end::front ].vehicle_end; }
|
||||
// double fTrackBlock; // odległość do przeszkody do dalszego ruchu (wykrywanie kolizji z innym pojazdem)
|
||||
|
||||
TPowerSource ConnectedEnginePowerSource( TDynamicObject const *Caller ) const;
|
||||
|
||||
// modele składowe pojazdu
|
||||
TModel3d *mdModel; // model pudła
|
||||
TModel3d *mdLoad; // model zmiennego ładunku
|
||||
|
||||
@@ -715,6 +715,7 @@ struct TCoupling {
|
||||
|
||||
int sounds { 0 }; // sounds emitted by the coupling devices
|
||||
bool Render = false; /*ABu: czy rysowac jak zaczepiony sprzeg*/
|
||||
std::string control_type; // abstraction of control coupling interface and communication standard
|
||||
|
||||
inline bool
|
||||
has_adapter() const {
|
||||
@@ -1641,11 +1642,10 @@ public:
|
||||
double BrakeVP(void) const;
|
||||
|
||||
/*! przesylanie komend sterujacych*/
|
||||
bool SendCtrlBroadcast(std::string CtrlCommand, double ctrlvalue);
|
||||
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, int const Couplertype = ctrain_controll );
|
||||
bool SendCtrlToNext(std::string const CtrlCommand, double const ctrlvalue, double const dir, int const Couplertype = coupling::control );
|
||||
bool SetInternalCommand( std::string NewCommand, double NewValue1, double NewValue2, int const Couplertype = coupling::control );
|
||||
double GetExternalCommand(std::string &Command);
|
||||
bool RunCommand( std::string Command, double CValue1, double CValue2, int const Couplertype = ctrain_controll );
|
||||
bool RunCommand( std::string Command, double CValue1, double CValue2, int const Couplertype = coupling::control );
|
||||
bool RunInternalCommand();
|
||||
void PutCommand(std::string NewCommand, double NewValue1, double NewValue2, const TLocation &NewLocation);
|
||||
bool CabActivisation( bool const Enforce = false );
|
||||
|
||||
@@ -1752,15 +1752,15 @@ double TMoverParameters::ShowEngineRotation(int VehN)
|
||||
return std::abs(enrot);
|
||||
case 2:
|
||||
for (b = 0; b <= 1; ++b)
|
||||
if (TestFlag(Couplers[b].CouplingFlag, ctrain_controll))
|
||||
if (TestFlag(Couplers[b].CouplingFlag, coupling::control))
|
||||
if (Couplers[b].Connected->Power > 0.01)
|
||||
return fabs(Couplers[b].Connected->enrot);
|
||||
break;
|
||||
case 3: // to nie uwzględnia ewentualnego odwrócenia pojazdu w środku
|
||||
for (b = 0; b <= 1; ++b)
|
||||
if (TestFlag(Couplers[b].CouplingFlag, ctrain_controll))
|
||||
if (TestFlag(Couplers[b].CouplingFlag, coupling::control))
|
||||
if (Couplers[b].Connected->Power > 0.01)
|
||||
if (TestFlag(Couplers[b].Connected->Couplers[b].CouplingFlag, ctrain_controll))
|
||||
if (TestFlag(Couplers[b].Connected->Couplers[b].CouplingFlag, coupling::control))
|
||||
if (Couplers[b].Connected->Couplers[b].Connected->Power > 0.01)
|
||||
return fabs(Couplers[b].Connected->Couplers[b].Connected->enrot);
|
||||
break;
|
||||
@@ -2318,8 +2318,7 @@ bool TMoverParameters::DecMainCtrl(int CtrlSpeed)
|
||||
case TEngineType::DieselElectric:
|
||||
case TEngineType::ElectricInductionMotor:
|
||||
{
|
||||
if (((CtrlSpeed == 1) &&
|
||||
/*(ScndCtrlPos==0) and*/ (EngineType != TEngineType::DieselElectric)) ||
|
||||
if (((CtrlSpeed == 1) && (EngineType != TEngineType::DieselElectric)) ||
|
||||
((CtrlSpeed == 1) && (EngineType == TEngineType::DieselElectric)))
|
||||
{
|
||||
MainCtrlPos--;
|
||||
@@ -2723,8 +2722,8 @@ bool TMoverParameters::Sandbox( bool const State, range_t const Notify )
|
||||
// if requested pass the command on
|
||||
auto const couplingtype =
|
||||
( Notify == range_t::unit ?
|
||||
ctrain_controll | ctrain_depot :
|
||||
ctrain_controll );
|
||||
coupling::control | coupling::permanent :
|
||||
coupling::control );
|
||||
|
||||
if( State == true ) {
|
||||
// switch on
|
||||
@@ -3732,7 +3731,7 @@ bool TMoverParameters::DynamicBrakeSwitch(bool Switch)
|
||||
DBS = true;
|
||||
for (int b = 0; b < 2; b++)
|
||||
// with Couplers[b] do
|
||||
if (TestFlag(Couplers[b].CouplingFlag, ctrain_controll))
|
||||
if (TestFlag(Couplers[b].CouplingFlag, coupling::control))
|
||||
Couplers[b].Connected->DynamicBrakeFlag = Switch;
|
||||
// end;
|
||||
// if (DynamicBrakeType=dbrake_passive) and (TrainType=dt_ET42) then
|
||||
@@ -5160,7 +5159,13 @@ double TMoverParameters::CouplerForce( int const End, double dt ) {
|
||||
&& ( coupler.CouplingFlag == coupling::faux )
|
||||
&& ( coupler.AutomaticCouplingAllowed && othercoupler.AutomaticCouplingAllowed ) ) {
|
||||
// sprzeganie wagonow z samoczynnymi sprzegami
|
||||
if( Attach( End, otherend, othervehicle, ( coupler.AutomaticCouplingFlag & othercoupler.AutomaticCouplingFlag ) ) ) {
|
||||
auto couplingtype { coupler.AutomaticCouplingFlag & othercoupler.AutomaticCouplingFlag };
|
||||
// potentially exclude incompatible control coupling
|
||||
if( coupler.control_type != othercoupler.control_type ) {
|
||||
couplingtype &= ~( coupling::control );
|
||||
}
|
||||
|
||||
if( Attach( End, otherend, othervehicle, couplingtype ) ) {
|
||||
SetFlag( AIFlag, sound::attachcoupler );
|
||||
coupler.AutomaticCouplingAllowed = false;
|
||||
othercoupler.AutomaticCouplingAllowed = false;
|
||||
@@ -6242,7 +6247,7 @@ bool TMoverParameters::FuseFlagCheck(void) const
|
||||
FFC = FuseFlag;
|
||||
else // pobor pradu jezeli niema mocy
|
||||
for (int b = 0; b < 2; b++)
|
||||
if (TestFlag(Couplers[b].CouplingFlag, ctrain_controll))
|
||||
if (TestFlag(Couplers[b].CouplingFlag, coupling::control))
|
||||
if (Couplers[b].Connected->Power > 0.01)
|
||||
FFC = Couplers[b].Connected->FuseFlagCheck();
|
||||
|
||||
@@ -6501,7 +6506,7 @@ bool TMoverParameters::ResistorsFlagCheck(void) const
|
||||
else // pobor pradu jezeli niema mocy
|
||||
{
|
||||
for (int b = 0; b < 2; b++)
|
||||
if (TestFlag(Couplers[b].CouplingFlag, ctrain_controll))
|
||||
if (TestFlag(Couplers[b].CouplingFlag, coupling::control))
|
||||
if (Couplers[b].Connected->Power > 0.01)
|
||||
RFC = Couplers[b].Connected->ResistorsFlagCheck();
|
||||
}
|
||||
@@ -9880,6 +9885,7 @@ void TMoverParameters::LoadFIZ_BuffCoupl( std::string const &line, int const Ind
|
||||
coupler->AllowedFlag = ( ( -coupler->AllowedFlag ) | coupling::permanent );
|
||||
}
|
||||
extract_value( coupler->PowerFlag, "PowerFlag", line, "" );
|
||||
extract_value( coupler->control_type, "ControlType", line, "" );
|
||||
|
||||
if( ( coupler->CouplerType != TCouplerType::NoCoupler )
|
||||
&& ( coupler->CouplerType != TCouplerType::Bare )
|
||||
@@ -11287,26 +11293,6 @@ double TMoverParameters::GetExternalCommand(std::string &Command)
|
||||
return ValueOut;
|
||||
}
|
||||
|
||||
// *************************************************************************************************
|
||||
// Q: 20160714
|
||||
// GF: 20161117
|
||||
// rozsyłanie komend do całego składu
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::SendCtrlBroadcast(std::string CtrlCommand, double ctrlvalue)
|
||||
{
|
||||
int b;
|
||||
bool OK;
|
||||
|
||||
OK = ((CtrlCommand != CommandIn.Command) && (ctrlvalue != CommandIn.Value1));
|
||||
if (OK)
|
||||
for (b = 0; b < 2; b++)
|
||||
if (TestFlag(Couplers[b].CouplingFlag, ctrain_controll))
|
||||
if (Couplers[b].Connected->SetInternalCommand(CtrlCommand, ctrlvalue, DirF(b)))
|
||||
OK = (Couplers[b].Connected->RunInternalCommand() || OK);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// *************************************************************************************************
|
||||
// Q: 20160714
|
||||
// Ustawienie komendy wraz z parametrami
|
||||
@@ -11935,7 +11921,7 @@ double TMoverParameters::ShowCurrentP(int AmpN) const
|
||||
int current = 0;
|
||||
for (b = 0; b < 2; b++)
|
||||
// with Couplers[b] do
|
||||
if (TestFlag(Couplers[b].CouplingFlag, ctrain_controll))
|
||||
if (TestFlag(Couplers[b].CouplingFlag, coupling::control))
|
||||
if (Couplers[b].Connected->Power > 0.01)
|
||||
current = static_cast<int>(Couplers[b].Connected->ShowCurrent(AmpN));
|
||||
return current;
|
||||
|
||||
58
Train.cpp
58
Train.cpp
@@ -363,10 +363,11 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
||||
{ user_command::doorcloseall, &TTrain::OnCommand_doorcloseall },
|
||||
{ user_command::doorsteptoggle, &TTrain::OnCommand_doorsteptoggle },
|
||||
{ user_command::doormodetoggle, &TTrain::OnCommand_doormodetoggle },
|
||||
{ user_command::carcouplingincrease, &TTrain::OnCommand_carcouplingincrease },
|
||||
{ user_command::carcouplingdisconnect, &TTrain::OnCommand_carcouplingdisconnect },
|
||||
{ user_command::carcoupleradapterattach, &TTrain::OnCommand_carcoupleradapterattach },
|
||||
{ user_command::carcoupleradapterremove, &TTrain::OnCommand_carcoupleradapterremove },
|
||||
{ user_command::nearestcarcouplingincrease, &TTrain::OnCommand_nearestcarcouplingincrease },
|
||||
{ user_command::nearestcarcouplingdisconnect, &TTrain::OnCommand_nearestcarcouplingdisconnect },
|
||||
{ user_command::nearestcarcoupleradapterattach, &TTrain::OnCommand_nearestcarcoupleradapterattach },
|
||||
{ user_command::nearestcarcoupleradapterremove, &TTrain::OnCommand_nearestcarcoupleradapterremove },
|
||||
{ user_command::occupiedcarcouplingdisconnect, &TTrain::OnCommand_occupiedcarcouplingdisconnect },
|
||||
{ user_command::departureannounce, &TTrain::OnCommand_departureannounce },
|
||||
{ user_command::hornlowactivate, &TTrain::OnCommand_hornlowactivate },
|
||||
{ user_command::hornhighactivate, &TTrain::OnCommand_hornhighactivate },
|
||||
@@ -953,7 +954,7 @@ void TTrain::OnCommand_mastercontrollerincreasefast( TTrain *Train, command_data
|
||||
OnCommand_independentbrakedecreasefast( Train, Command );
|
||||
}
|
||||
else {
|
||||
Train->mvControlled->IncMainCtrl( 2 );
|
||||
Train->mvControlled->IncMainCtrl( Train->mvControlled->MainCtrlPosNo );
|
||||
Train->m_mastercontrollerinuse = true;
|
||||
}
|
||||
}
|
||||
@@ -993,7 +994,7 @@ void TTrain::OnCommand_mastercontrollerdecreasefast( TTrain *Train, command_data
|
||||
OnCommand_independentbrakeincreasefast( Train, Command );
|
||||
}
|
||||
else {
|
||||
Train->mvControlled->DecMainCtrl( 2 );
|
||||
Train->mvControlled->DecMainCtrl( Train->mvControlled->MainCtrlPowerPos() );
|
||||
Train->m_mastercontrollerinuse = true;
|
||||
}
|
||||
}
|
||||
@@ -5397,7 +5398,7 @@ void TTrain::OnCommand_doormodetoggle( TTrain *Train, command_data const &Comman
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_carcouplingincrease( TTrain *Train, command_data const &Command ) {
|
||||
void TTrain::OnCommand_nearestcarcouplingincrease( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( ( true == FreeFlyModeFlag )
|
||||
&& ( Command.action == GLFW_PRESS ) ) {
|
||||
@@ -5419,7 +5420,7 @@ void TTrain::OnCommand_carcouplingincrease( TTrain *Train, command_data const &C
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_carcouplingdisconnect( TTrain *Train, command_data const &Command ) {
|
||||
void TTrain::OnCommand_nearestcarcouplingdisconnect( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( ( true == FreeFlyModeFlag )
|
||||
&& ( Command.action == GLFW_PRESS ) ) {
|
||||
@@ -5441,7 +5442,7 @@ void TTrain::OnCommand_carcouplingdisconnect( TTrain *Train, command_data const
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_carcoupleradapterattach( TTrain *Train, command_data const &Command ) {
|
||||
void TTrain::OnCommand_nearestcarcoupleradapterattach( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( ( true == FreeFlyModeFlag )
|
||||
&& ( Command.action == GLFW_PRESS ) ) {
|
||||
@@ -5458,7 +5459,7 @@ void TTrain::OnCommand_carcoupleradapterattach( TTrain *Train, command_data cons
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_carcoupleradapterremove( TTrain *Train, command_data const &Command ) {
|
||||
void TTrain::OnCommand_nearestcarcoupleradapterremove( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( ( true == FreeFlyModeFlag )
|
||||
&& ( Command.action == GLFW_PRESS ) ) {
|
||||
@@ -5475,6 +5476,30 @@ void TTrain::OnCommand_carcoupleradapterremove( TTrain *Train, command_data cons
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_occupiedcarcouplingdisconnect( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
// if( false == Train->m_controlmapper.contains( "couplingdisconnect_sw:" ) ) { return; }
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// visual feedback
|
||||
Train->m_couplingdisconnect = true;
|
||||
|
||||
if( Train->iCabn == 0 ) { return; }
|
||||
|
||||
if( Train->DynamicObject ) {
|
||||
Train->DynamicObject->uncouple( Train->cab_to_end() );
|
||||
}
|
||||
if( Train->DynamicObject->Mechanik ) {
|
||||
// aktualizacja flag kierunku w składzie
|
||||
Train->DynamicObject->Mechanik->CheckVehicles( Disconnect );
|
||||
}
|
||||
}
|
||||
else if( Command.action == GLFW_RELEASE ) {
|
||||
// visual feedback
|
||||
Train->m_couplingdisconnect = false;
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_departureannounce( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( Train->ggDepartureSignalButton.SubModel == nullptr ) {
|
||||
@@ -6216,11 +6241,11 @@ bool TTrain::Update( double const Deltatime )
|
||||
{
|
||||
TDynamicObject *tmp { nullptr };
|
||||
if (DynamicObject->NextConnected())
|
||||
if ((TestFlag(mvControlled->Couplers[end::rear].CouplingFlag, ctrain_controll)) &&
|
||||
if ((TestFlag(mvControlled->Couplers[end::rear].CouplingFlag, coupling::control)) &&
|
||||
(mvOccupied->CabOccupied == 1))
|
||||
tmp = DynamicObject->NextConnected();
|
||||
if (DynamicObject->PrevConnected())
|
||||
if ((TestFlag(mvControlled->Couplers[end::front].CouplingFlag, ctrain_controll)) &&
|
||||
if ((TestFlag(mvControlled->Couplers[end::front].CouplingFlag, coupling::control)) &&
|
||||
(mvOccupied->CabOccupied == -1))
|
||||
tmp = DynamicObject->PrevConnected();
|
||||
if( tmp ) {
|
||||
@@ -6647,10 +6672,10 @@ bool TTrain::Update( double const Deltatime )
|
||||
{ // yB - wskazniki drugiego czlonu
|
||||
TDynamicObject *tmp { nullptr }; //=mvControlled->mvSecond; //Ra 2014-07: trzeba to jeszcze wyjąć z kabiny...
|
||||
// Ra 2014-07: no nie ma potrzeby szukać tego w każdej klatce
|
||||
if ((TestFlag(mvControlled->Couplers[1].CouplingFlag, ctrain_controll)) &&
|
||||
if ((TestFlag(mvControlled->Couplers[1].CouplingFlag, coupling::control)) &&
|
||||
(mvOccupied->CabOccupied > 0))
|
||||
tmp = DynamicObject->NextConnected();
|
||||
if ((TestFlag(mvControlled->Couplers[0].CouplingFlag, ctrain_controll)) &&
|
||||
if ((TestFlag(mvControlled->Couplers[0].CouplingFlag, coupling::control)) &&
|
||||
(mvOccupied->CabOccupied < 0))
|
||||
tmp = DynamicObject->PrevConnected();
|
||||
|
||||
@@ -8019,7 +8044,7 @@ void TTrain::DynamicSet(TDynamicObject *d)
|
||||
mvSecond = NULL; // gdyby się nic nie znalazło
|
||||
if (mvOccupied->Power > 1.0) // dwuczłonowe lub ukrotnienia, żeby nie szukać każdorazowo
|
||||
if (mvOccupied->Couplers[1].Connected ?
|
||||
mvOccupied->Couplers[1].AllowedFlag & ctrain_controll :
|
||||
mvOccupied->Couplers[1].AllowedFlag & coupling::control :
|
||||
false)
|
||||
{ // gdy jest człon od sprzęgu 1, a sprzęg łączony
|
||||
// warsztatowo (powiedzmy)
|
||||
@@ -8028,7 +8053,7 @@ void TTrain::DynamicSet(TDynamicObject *d)
|
||||
(TMoverParameters *)mvOccupied->Couplers[1].Connected; // wskaźnik na drugiego
|
||||
}
|
||||
else if (mvOccupied->Couplers[0].Connected ?
|
||||
mvOccupied->Couplers[0].AllowedFlag & ctrain_controll :
|
||||
mvOccupied->Couplers[0].AllowedFlag & coupling::control :
|
||||
false)
|
||||
{ // gdy jest człon od sprzęgu 0, a sprzęg łączony
|
||||
// warsztatowo (powiedzmy)
|
||||
@@ -9099,6 +9124,7 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
||||
{ "radio_sw:", &mvOccupied->Radio },
|
||||
{ "cablight_sw:", &Cabine[ iCabn ].bLight },
|
||||
{ "springbraketoggle_bt:", &mvOccupied->SpringBrake.Activate },
|
||||
{ "couplingdisconnect_sw:", &m_couplingdisconnect },
|
||||
};
|
||||
{
|
||||
auto lookup = autoboolgauges.find( Label );
|
||||
|
||||
11
Train.h
11
Train.h
@@ -387,10 +387,11 @@ class TTrain {
|
||||
static void OnCommand_doorcloseall( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_doorsteptoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_doormodetoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_carcouplingincrease( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_carcouplingdisconnect( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_carcoupleradapterattach( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_carcoupleradapterremove( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_nearestcarcouplingincrease( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_nearestcarcouplingdisconnect( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_nearestcarcoupleradapterattach( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_nearestcarcoupleradapterremove( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_occupiedcarcouplingdisconnect( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_departureannounce( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_hornlowactivate( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_hornhighactivate( TTrain *Train, command_data const &Command );
|
||||
@@ -786,6 +787,8 @@ private:
|
||||
double m_brakehandlecp{ 0.0 };
|
||||
int m_pantselection{ 0 };
|
||||
bool m_doors{ false }; // helper, true if any door is open
|
||||
// ld substitute
|
||||
bool m_couplingdisconnect;
|
||||
|
||||
public:
|
||||
float fPress[20][3]; // cisnienia dla wszystkich czlonow
|
||||
|
||||
@@ -156,10 +156,11 @@ commanddescription_sequence Commands_descriptions = {
|
||||
{ "moveup", command_target::entity },
|
||||
{ "movedown", command_target::entity },
|
||||
// TBD, TODO: make coupling controls entity-centric
|
||||
{ "carcouplingincrease", command_target::vehicle },
|
||||
{ "carcouplingdisconnect", command_target::vehicle },
|
||||
{ "carcoupleradapterattach", command_target::vehicle },
|
||||
{ "carcoupleradapterremove", command_target::vehicle },
|
||||
{ "nearestcarcouplingincrease", command_target::vehicle },
|
||||
{ "nearestcarcouplingdisconnect", command_target::vehicle },
|
||||
{ "nearestcarcoupleradapterattach", command_target::vehicle },
|
||||
{ "nearestcarcoupleradapterremove", command_target::vehicle },
|
||||
{ "occupiedcarcouplingdisconnect", command_target::vehicle },
|
||||
{ "doortoggleleft", command_target::vehicle },
|
||||
{ "doortoggleright", command_target::vehicle },
|
||||
{ "doorpermitleft", command_target::vehicle },
|
||||
|
||||
@@ -147,10 +147,11 @@ enum class user_command {
|
||||
moveup,
|
||||
movedown,
|
||||
|
||||
carcouplingincrease,
|
||||
carcouplingdisconnect,
|
||||
carcoupleradapterattach,
|
||||
carcoupleradapterremove,
|
||||
nearestcarcouplingincrease,
|
||||
nearestcarcouplingdisconnect,
|
||||
nearestcarcoupleradapterattach,
|
||||
nearestcarcoupleradapterremove,
|
||||
occupiedcarcouplingdisconnect,
|
||||
doortoggleleft,
|
||||
doortoggleright,
|
||||
doorpermitleft,
|
||||
|
||||
@@ -156,10 +156,11 @@ driverkeyboard_input::default_bindings() {
|
||||
{ user_command::moveback, GLFW_KEY_DOWN },
|
||||
{ user_command::moveup, GLFW_KEY_PAGE_UP },
|
||||
{ user_command::movedown, GLFW_KEY_PAGE_DOWN },
|
||||
{ user_command::carcouplingincrease, GLFW_KEY_INSERT },
|
||||
{ user_command::carcouplingdisconnect, GLFW_KEY_DELETE },
|
||||
{ user_command::carcoupleradapterattach, GLFW_KEY_INSERT | keymodifier::control },
|
||||
{ user_command::carcoupleradapterremove, GLFW_KEY_DELETE | keymodifier::control },
|
||||
{ user_command::nearestcarcouplingincrease, GLFW_KEY_INSERT },
|
||||
{ user_command::nearestcarcouplingdisconnect, GLFW_KEY_DELETE },
|
||||
{ user_command::nearestcarcoupleradapterattach, GLFW_KEY_INSERT | keymodifier::control },
|
||||
{ user_command::nearestcarcoupleradapterremove, GLFW_KEY_DELETE | keymodifier::control },
|
||||
{ user_command::occupiedcarcouplingdisconnect, GLFW_KEY_DELETE | keymodifier::shift },
|
||||
{ user_command::doortoggleleft, GLFW_KEY_COMMA },
|
||||
{ user_command::doortoggleright, GLFW_KEY_PERIOD },
|
||||
{ user_command::doorpermitleft, GLFW_KEY_COMMA | keymodifier::shift },
|
||||
|
||||
@@ -864,6 +864,9 @@ drivermouse_input::default_bindings() {
|
||||
{ "batteryoff_sw:", {
|
||||
user_command::batterydisable,
|
||||
user_command::none } },
|
||||
{ "couplingdisconnect_sw:",{
|
||||
user_command::occupiedcarcouplingdisconnect,
|
||||
user_command::none } },
|
||||
{ "universal0:", {
|
||||
user_command::generictoggle0,
|
||||
user_command::none } },
|
||||
@@ -935,7 +938,7 @@ drivermouse_input::default_bindings() {
|
||||
user_command::none } },
|
||||
{ "speedbutton9:",{
|
||||
user_command::speedcontrolbutton9,
|
||||
user_command::none } }
|
||||
user_command::none } },
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -809,6 +809,7 @@ debug_panel::update_vehicle_coupler( int const Side ) {
|
||||
// NOTE: mover and vehicle are guaranteed to be valid by the caller
|
||||
auto const &mover { *( m_input.mover ) };
|
||||
|
||||
std::string const controltype{ ( mover.Couplers[ Side ].control_type.empty() ? "[*]" : "[" + mover.Couplers[ Side ].control_type + "]" ) };
|
||||
std::string couplerstatus { locale::strings[ locale::string::debug_vehicle_none ] };
|
||||
std::string const adapterstatus { ( mover.Couplers[ Side ].adapter_type == TCouplerType::NoCoupler ? "" : "[A]" ) };
|
||||
|
||||
@@ -816,12 +817,13 @@ debug_panel::update_vehicle_coupler( int const Side ) {
|
||||
|
||||
if( connected == nullptr ) {
|
||||
|
||||
return couplerstatus + " " + adapterstatus;
|
||||
return controltype + " " + couplerstatus + " " + adapterstatus;
|
||||
}
|
||||
|
||||
std::snprintf(
|
||||
m_buffer.data(), m_buffer.size(),
|
||||
"%s %s[%d] (%.1f m)",
|
||||
"%s %s %s[%d] (%.1f m)",
|
||||
controltype.c_str(),
|
||||
connected->name().c_str(),
|
||||
adapterstatus.c_str(),
|
||||
mover.Couplers[ Side ].CouplingFlag,
|
||||
|
||||
@@ -211,6 +211,7 @@ init() {
|
||||
"battery",
|
||||
"battery",
|
||||
"battery",
|
||||
"coupling",
|
||||
"interactive part",
|
||||
"interactive part",
|
||||
"interactive part",
|
||||
@@ -412,6 +413,7 @@ init() {
|
||||
"bateria",
|
||||
"bateria",
|
||||
"bateria",
|
||||
"sprzeg",
|
||||
"element ruchomy",
|
||||
"element ruchomy",
|
||||
"element ruchomy",
|
||||
@@ -566,6 +568,7 @@ init() {
|
||||
"battery_sw:",
|
||||
"batteryon_sw:",
|
||||
"batteryoff_sw:",
|
||||
"couplingdisconnect_sw:",
|
||||
"universal0:",
|
||||
"universal1:",
|
||||
"universal2:",
|
||||
|
||||
@@ -200,6 +200,7 @@ enum string {
|
||||
cab_battery_sw,
|
||||
cab_batteryon_sw,
|
||||
cab_batteryoff_sw,
|
||||
cab_couplingdisconnect_sw,
|
||||
cab_universal0,
|
||||
cab_universal1,
|
||||
cab_universal2,
|
||||
|
||||
Reference in New Issue
Block a user