From 1f8a477ec4f1a0f61039968febf6638b323d5dc0 Mon Sep 17 00:00:00 2001 From: maj00r Date: Thu, 22 Oct 2026 15:24:02 +0200 Subject: [PATCH] =?UTF-8?q?fix(editor):=20the=20exit=20signals=20of=20a=20?= =?UTF-8?q?station=20track=20stand=20at=20the=20ends=20of=20its=20longest?= =?UTF-8?q?=20circuit,=20for=20the=20longest=20useful=20length=20both=20wa?= =?UTF-8?q?ys=20as=20Ie-4=20=C2=A7=2013=20ust.=208=20wants,=20not=20at=20t?= =?UTF-8?q?he=20outer=20ends=20of=20the=20outermost=20long=20circuits,=20w?= =?UTF-8?q?hich=20left=20the=20trains=20of=20one=20way=20a=20short=20stret?= =?UTF-8?q?ch=20beyond=20a=20switch=20within=20the=20track?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- editor/editorStation.cpp | 12 ++++++++++-- editor/editorStation.hpp | 10 +++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/editor/editorStation.cpp b/editor/editorStation.cpp index b44ed5e4..1ae54d43 100644 --- a/editor/editorStation.cpp +++ b/editor/editorStation.cpp @@ -1245,7 +1245,8 @@ std::vector signals(layout const &Layout, std::vector const &T auto const odd{digit == track.number.rend() || (*digit - '0') % 2 == 1}; auto upper{track.number}; std::transform(upper.begin(), upper.end(), upper.begin(), [](char const Letter) { return static_cast(std::toupper(static_cast(Letter))); }); - // the outer ends of the outermost circuits long enough, else of the outermost ones + // the ends of the longest circuit long enough, for the longest useful length of the track both ways (Ie-4 ยง 13 ust. 8), else + // the outer ends of the outermost ones struct reach { track_end low; @@ -1255,15 +1256,22 @@ std::vector signals(layout const &Layout, std::vector const &T }; reach longest; reach any; + double best{0.0}; for (auto const &circuit : track.circuits) { double length{0.0}; for (auto const *part : circuit) length += node(*part) ? 0.0 : plan_length(*part, 0); + auto const chosen{length >= kStopping && length > best}; + if (chosen) + { + best = length; + longest = reach{}; + } for (auto const &end : ends_out(circuit)) { auto const x{project(Layout, end.point).x}; - for (auto *found : {&any, length >= kStopping ? &longest : static_cast(nullptr)}) + for (auto *found : {&any, chosen ? &longest : static_cast(nullptr)}) { if (found == nullptr) continue; diff --git a/editor/editorStation.hpp b/editor/editorStation.hpp index 76bb2047..5be6b707 100644 --- a/editor/editorStation.hpp +++ b/editor/editorStation.hpp @@ -143,11 +143,11 @@ struct signal }; // the signals of the station: the entry ones 300 m out along the lines beyond the circuits of the station, A, B... from the start -// of the chainage, Z, Y... from its end, the leftmost first; the exit ones facing out at the outer ends of the outermost circuits -// at least 200 m long of the station tracks, a letter for the odd tracks and one for the even ones at each end, with the number: -// F1, G2 towards the start, R1, P2 towards the end; the shunting ones at the ends of the shorter tracks, Tm1, Tm2... along the -// chainage. Each on the right of the trains, unless another track runs too close by there. Inside: a track of the circuits of the -// station +// of the chainage, Z, Y... from its end, the leftmost first; the exit ones facing out at the ends of the longest circuit at least +// 200 m long of each station track, for its longest useful length, a letter for the odd tracks and one for the even ones at each +// end, with the number: F1, G2 towards the start, R1, P2 towards the end; the shunting ones at the ends of the shorter tracks, Tm1, +// Tm2... along the chainage. Each on the right of the trains, unless another track runs too close by there. Inside: a track of the +// circuits of the station std::vector signals(layout const &Layout, std::vector const &Tracks, std::function const &Inside); // a track of a line out beyond an entry signal of the station, to the next station or the end of the tracks