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;
|
||||
|
||||
Reference in New Issue
Block a user