18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 12:57:06 +01:00

Merge branch 'feat/editor-model-turnouts-ui' into feat/editor-project-setup

# Conflicts:
#	tests/editor/README.md
This commit is contained in:
maj00r
2026-11-29 23:01:30 +01:00
28 changed files with 389 additions and 54 deletions
+12 -5
View File
@@ -14,6 +14,7 @@ http://mozilla.org/MPL/2.0/.
#include <algorithm>
#include <array>
#include <charconv>
#include <cmath>
#include <cstdio>
#include <filesystem>
#include <format>
@@ -209,13 +210,16 @@ class record
fail(std::format("'{}' isn't a profile of the norms", text));
return norms::profile_id::plk;
}
// the rest of the line as it is written, the blanks between the words kept as one
// the rest of the line as it is written, from its next word to its last, the blanks between the words as they are: joined with one
// blank, a reason of two blanks came back changed after a save and a load
std::string rest()
{
std::string result;
for (; false == done(); ++m_at)
result += (result.empty() ? "" : " ") + std::string{m_words[m_at]};
return result;
if (done())
return {};
auto const first{m_words[m_at]};
auto const last{m_words.back()};
m_at = m_words.size();
return std::string(first.data(), static_cast<std::size_t>(last.data() + last.size() - first.data()));
}
void finish()
{
@@ -705,6 +709,9 @@ read_result read(std::string_view const Text)
words.expect("attributes");
split.track.attributes = unword(words.next("the attributes"));
words.finish();
// the joints along the line in their order: the generator looks them up so
if (false == words.failed() && (false == std::isfinite(split.chainage) || split.chainage < 0.0 || (false == line->hard_splits.empty() && split.chainage < line->hard_splits.back().chainage)))
words.fail(std::format("the old track {} at {} m is off the line, or out of the order of the ones before it", split.track.name, split.chainage));
line->hard_splits.push_back(std::move(split));
}
else if (keyword == "end")