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

fix: SOD lamp shows the doors of the whole consist in three states (eu07/maszyna#288)

The door closure signalling lamp (i-door_blocked) showed only Doors.is_locked
of the occupied vehicle, so a door open in another car or a coupled unit
didn't show on it.

TMoverParameters::door_closure() gives the state of one vehicle (none, locked,
released, open), the driver gathers the most severe one of the train in
determine_consist_state(), next to IsAnyDoorOpen, and the lamp is lit for
locked doors, blinks for closed but released ones (a permit given, or no lock
engaged on doors that need no permit) and is dark with a door open.

doorclosuresignal in eu07.ini (default yes) switches it; with no the lamp
shows is_locked of the occupied vehicle as before. No data change needed.
This commit is contained in:
jerrrrycho
2026-11-08 02:05:45 +01:00
parent 68fdf1efdf
commit 4b769d95c1
8 changed files with 187 additions and 1 deletions

View File

@@ -261,6 +261,22 @@ enum class range_t
/// <summary>Affects the entire consist.</summary>
consist
};
/// <summary>State of the door closure signalling (SOD) of a vehicle or a consist, ordered from the least to the most
/// severe: the state of a consist is the most severe state of its vehicles.</summary>
enum class door_closure_t
{
/// <summary>No doors worked by the crew: the vehicle doesn't take part in the signalling.</summary>
none,
/// <summary>All doors closed and locked: they can't be opened.</summary>
locked,
/// <summary>All doors closed, but released: a permit is given, or no lock holds them shut.</summary>
released,
/// <summary>A door is open, or not fully closed yet.</summary>
open
};
/// <summary>Whether the door closure signalling lamp is lit: steadily for locked doors, in the lit phase of the
/// blinking for released ones, never with a door open or with no doors signalled.</summary>
bool door_closure_lamp(door_closure_t const State, bool const BlinkLit);
/// <summary>Possible settings for an enable/disable input pair (mutually exclusive).</summary>
enum class operation_t
{
@@ -2593,6 +2609,7 @@ class TMoverParameters
bool LockDoors(bool const State, range_t const Notify = range_t::consist);
bool signal_departure(bool const State, range_t const Notify = range_t::consist); // toggles departure warning
void update_doors(double const Deltatime); // door controller update
door_closure_t door_closure() const; // state of the door closure signalling of this vehicle
/* funkcje dla samochodow*/
bool ChangeOffsetH(double DeltaOffset);

View File

@@ -8699,6 +8699,43 @@ bool TMoverParameters::signal_departure(bool const State, range_t const Notify)
return true;
}
// state of the door closure signalling (SOD) of this vehicle: open while a door isn't fully closed, released while
// the closed doors can be opened (a permit given, or, for doors that need none, no lock engaged), locked otherwise.
// doors the crew doesn't close (autonomous) aren't signalled, the same as for the door lights of the consist
door_closure_t TMoverParameters::door_closure() const
{
if (Doors.range == 0.f || Doors.close_control == control_t::autonomous)
{
return door_closure_t::none;
}
if (std::ranges::any_of(Doors.instances, [](basic_door const &Door) { return false == Door.is_closed; }))
{
return door_closure_t::open;
}
if (Doors.is_locked)
{
return door_closure_t::locked;
}
if (Doors.permit_needed && std::ranges::none_of(Doors.instances, [](basic_door const &Door) { return Door.open_permit; }))
{
return door_closure_t::locked;
}
return door_closure_t::released;
}
bool door_closure_lamp(door_closure_t const State, bool const BlinkLit)
{
switch (State)
{
case door_closure_t::locked:
return true;
case door_closure_t::released:
return BlinkLit;
default:
return false;
}
}
// automatic door controller update
void TMoverParameters::update_doors(double const Deltatime)
{