mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Fix for switching off batteries with no active cabin and raising pantographs when deactivating cabin
This commit is contained in:
51
DynObj.cpp
51
DynObj.cpp
@@ -3963,20 +3963,7 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
|
||||
if (MoverParameters->InactiveCabPantsCheck)
|
||||
{
|
||||
auto p = FindPantographCarrier();
|
||||
bool isAnyPantUp = false;
|
||||
if (p)
|
||||
{
|
||||
for (auto &item : p->MoverParameters->Pantographs)
|
||||
{
|
||||
isAnyPantUp |= item.is_active;
|
||||
}
|
||||
if (isAnyPantUp)
|
||||
{
|
||||
MoverParameters->OperatePantographValve(end::front, operation_t::enable);
|
||||
MoverParameters->OperatePantographValve(end::rear, operation_t::enable);
|
||||
}
|
||||
}
|
||||
pants_up();
|
||||
MoverParameters->InactiveCabPantsCheck = false;
|
||||
}
|
||||
|
||||
@@ -4009,6 +3996,42 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
return true; // Ra: chyba tak?
|
||||
}
|
||||
|
||||
void TDynamicObject::pants_up()
|
||||
{
|
||||
TDynamicObject *d = this;
|
||||
bool isAnyPantUp = false;
|
||||
while (d) {
|
||||
for (auto &item : d->MoverParameters->Pantographs)
|
||||
{
|
||||
isAnyPantUp |= item.is_active;
|
||||
}
|
||||
d = d->Next(4); // pozostałe też
|
||||
}
|
||||
d = Prev(4);
|
||||
while (d) {
|
||||
for (auto &item : d->MoverParameters->Pantographs)
|
||||
{
|
||||
isAnyPantUp |= item.is_active;
|
||||
}
|
||||
d = d->Prev(4); // w drugą stronę też
|
||||
}
|
||||
if (isAnyPantUp)
|
||||
{
|
||||
d = this;
|
||||
while (d) {
|
||||
d->MoverParameters->OperatePantographValve(end::front, operation_t::enable, range_t::local);
|
||||
d->MoverParameters->OperatePantographValve(end::rear, operation_t::enable, range_t::local);
|
||||
d = d->Next(4); // pozostałe też
|
||||
}
|
||||
d = Prev(4);
|
||||
while (d) {
|
||||
d->MoverParameters->OperatePantographValve(end::front, operation_t::enable, range_t::local);
|
||||
d->MoverParameters->OperatePantographValve(end::rear, operation_t::enable, range_t::local);
|
||||
d = d->Prev(4); // w drugą stronę też
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glm::dvec3 TDynamicObject::get_future_movement() const
|
||||
{
|
||||
return m_future_movement;
|
||||
|
||||
1
DynObj.h
1
DynObj.h
@@ -728,6 +728,7 @@ private:
|
||||
bool remove_coupler_adapter( int const Side );
|
||||
void RadioStop();
|
||||
void Damage(char flag);
|
||||
void pants_up();
|
||||
void SetLights();
|
||||
void RaLightsSet(int head, int rear);
|
||||
int LightList( end const Side ) const { return iInventory[ Side ]; }
|
||||
|
||||
@@ -3109,14 +3109,22 @@ bool TMoverParameters::BatterySwitch( bool State, range_t const Notify )
|
||||
Battery = State;
|
||||
}
|
||||
|
||||
//switching batteries does not require activation
|
||||
if( Notify != range_t::local ) {
|
||||
SendCtrlToNext(
|
||||
"BatterySwitch",
|
||||
( State ? 1 : 0 ),
|
||||
CabActive,
|
||||
1,
|
||||
( Notify == range_t::unit ?
|
||||
coupling::control | coupling::permanent :
|
||||
coupling::control ) );
|
||||
SendCtrlToNext(
|
||||
"BatterySwitch",
|
||||
(State ? 1 : 0),
|
||||
-1,
|
||||
(Notify == range_t::unit ?
|
||||
coupling::control | coupling::permanent :
|
||||
coupling::control));
|
||||
}
|
||||
|
||||
return ( Battery != initialstate );
|
||||
|
||||
Reference in New Issue
Block a user