17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-02 06:59:13 +01:00

feat(track): all of the unevenness in one attribute, with values for each path of a switch

Usage, before endtrack, in mm, 0-100, separated by semicolons with no
spaces:

  a plain track:  uneven value;up;side;cross;dip
  a switch:       uneven p1-p2;p3-p4;up p1-p2;side p1-p2;up p3-p4;side p3-p4

  uneven 18           the value alone
  uneven 18;;;25;6    with its own cross level and dip at the joints
  uneven 0;;30        sideways alone
  uneven 14;35        a switch, 14 on the straight path, 35 on the diverging

What's left out takes the first number, the dip goes by the up and down
one, and a path p3-p4 with no numbers of its own takes those of p1-p2.
This replaces unevenup, unevenside, unevencross and jointdip. The fields
in the editor stay, track panel, section Ride and sound.

At the end they share, the paths of a switch keep to the lower value, and
each comes to its own value along the way. Joined switches take the lowest
of the same path, a path joined to another path the lower of the two, and
a plain track comes to the value of the path it meets. See
track_uneven_doc.md.
This commit is contained in:
maj00r
2026-10-31 18:33:35 +01:00
parent 88609a1657
commit 02abc7df0a
11 changed files with 266 additions and 96 deletions

View File

@@ -156,6 +156,9 @@ editor_track::state editor_track::capture(TTrack const &Track)
result.unevenup = Track.m_unevenup;
result.unevenside = Track.m_unevenside;
result.unevencross = Track.m_unevencross;
result.unevenbranch = Track.m_unevenbranch;
result.unevenbranchup = Track.m_unevenbranchup;
result.unevenbranchside = Track.m_unevenbranchside;
result.jointdip = Track.m_jointdip;
result.sleepers = Track.m_sleeper_enabled;
result.sleeper_frequency = Track.m_sleeper_frequency;
@@ -259,6 +262,9 @@ void editor_track::apply(TTrack &Track, state const &State)
Track.m_unevenup = State.unevenup;
Track.m_unevenside = State.unevenside;
Track.m_unevencross = State.unevencross;
Track.m_unevenbranch = State.unevenbranch;
Track.m_unevenbranchup = State.unevenbranchup;
Track.m_unevenbranchside = State.unevenbranchside;
Track.m_jointdip = State.jointdip;
Track.m_sleeper_enabled = State.sleepers;
Track.m_sleeper_frequency = State.sleeper_frequency;
@@ -2360,16 +2366,7 @@ void write_ending(std::ostream &Text, TTrack const &Style)
{
if ((Style.iCategoryFlag & 15) == 1 && false == Style.m_profile1.first.empty())
Text << "railprofile " << Style.m_profile1.first << ' ';
if (Style.m_uneven > 0.f)
Text << "uneven " << Style.m_uneven << ' ';
if (Style.m_unevenup >= 0.f)
Text << "unevenup " << Style.m_unevenup << ' ';
if (Style.m_unevenside >= 0.f)
Text << "unevenside " << Style.m_unevenside << ' ';
if (Style.m_unevencross >= 0.f)
Text << "unevencross " << Style.m_unevencross << ' ';
if (Style.m_jointdip >= 0.f)
Text << "jointdip " << Style.m_jointdip << ' ';
Text << Style.uneven_text();
// a piece of the track made from another one stays in its track circuit and under the same overhead line
for (auto const *isolated : Style.Isolated)
Text << "isolated " << isolated->asName << ' ';