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

fix(ai): the stop point on a W4 kept the margin of a passenger stop from the platform's end (#321)

The W4 stop point was shifted with fMinProximityDist (8 m), while the
train comes to a stand anywhere up to the margin of a passenger stop
(10-15 m by the number of vehicles) short of it. A train stopping by
the middle of a platform could so stand with its tail a few metres past
the platform's end (L053: Swoszowice 204.5 m of 201, Tumlin 244.3 m of
242). The point is now shifted with the same margin the stop is judged
by, so the tail stays inside (197.5 m and 240.4 m on the same run).

Co-authored-by: maj00r <maj00r@host>
This commit is contained in:
maj00r
2026-11-11 04:30:13 +01:00
committed by GitHub
parent 5764e942a7
commit 18c56359ee

View File

@@ -1205,6 +1205,12 @@ TController::TableUpdateStopPoint( TCommandType &Command, TSpeedPos &Point, doub
} // koniec obsługi przelotu na W4
else {
// zatrzymanie na W4
// the margins of a passenger stop, whether the train is already making for it or not: the present ones
// depend on this very flag, and a check against them would turn it on and off every other scan
auto const [ stopminproximity, stopmaxproximity ] {
is_train() ?
train_proximity_margins( true ) :
std::pair{ fMinProximityDist, fMaxProximityDist } };
if ( false == Point.bMoved ) {
// potentially shift the stop point in accordance with its defined parameters
/*
@@ -1223,9 +1229,12 @@ TController::TableUpdateStopPoint( TCommandType &Command, TSpeedPos &Point, doub
}
else {
//środek
L = Par1 - fMinProximityDist - fLength * 0.5;
L = Par1 - stopminproximity - fLength * 0.5;
}
L = std::max(0.0, std::min(L, std::abs(Par2) - fMinProximityDist - fLength));
// the train comes to a stand anywhere up to the margin of a passenger stop short of this point, not
// that of the signals it may be making for when it first sees the W4, so the tail is to keep that far
// inside the platform
L = std::max(0.0, std::min(L, std::abs(Par2) - stopminproximity - fLength));
Point.UpdateDistance(L);
Point.bMoved = true;
Point.fMoved = L;
@@ -1246,12 +1255,6 @@ TController::TableUpdateStopPoint( TCommandType &Command, TSpeedPos &Point, doub
return true;
}
// the margins of a passenger stop, whether the train is already making for it or not: the present ones
// depend on this very flag, and a check against them would turn it on and off every other scan
auto const [ stopminproximity, stopmaxproximity ] {
is_train() ?
train_proximity_margins( true ) :
std::pair{ fMinProximityDist, fMaxProximityDist } };
IsAtPassengerStop = Point.fDist <= passengerstopmaxdistance
// Ra 2F1I: odległość plus długość pociągu musi być mniejsza od długości
// peronu, chyba że pociąg jest dłuższy, to wtedy minimalna.