18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-19 00:35:59 +01:00

Merge pull request #291 from MaSzyna-EU07/fix/sod-lamp-whole-consist

SOD lamp: doors of the whole consist, three states (eu07/maszyna#288)
This commit is contained in:
maj00r
2026-11-08 20:56:20 +01:00
committed by GitHub
6 changed files with 238 additions and 1 deletions

View File

@@ -6019,6 +6019,7 @@ TController::determine_consist_state() {
IsAnyDoorOnlyOpen[ side::right ] = IsAnyDoorOnlyOpen[ side::left ] = false;
IsAnyDoorOpen[ side::right ] = IsAnyDoorOpen[ side::left ] = false;
IsAnyDoorPermitActive[ side::right ] = IsAnyDoorPermitActive[ side::left ] = false;
auto doorclosure { door_closure_t::none };
ConsistShade = 0.0;
auto *p { pVehicles[ end::front ] }; // pojazd na czole składu
double dy; // składowa styczna grawitacji, w przedziale <0,1>
@@ -6080,12 +6081,14 @@ TController::determine_consist_state() {
IsAnyDoorPermitActive[ side::right ] |= rightdoor.open_permit;
IsAnyDoorPermitActive[ side::left ] |= leftdoor.open_permit;
}
doorclosure = std::max( doorclosure, vehicle->door_closure() );
}
// measure lighting level
// TBD: apply weight (multiplier) to partially lit vehicles?
ConsistShade += p->fShade > 0.0 ? p->fShade : 1.0;
p = p->Next(); // pojazd podłączony z tyłu (patrząc od czoła)
}
DoorClosure = doorclosure;
// calculate average amount of received sunlight
ConsistShade /= iVehicles;