mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-21 23:26:24 +02:00
feat(editor): connections of tracks laid whole from the switch tool: a crossover with a straight insert or an aligning curve between switches of different angles or tracks that aren't parallel, a double crossover meeting on either track, a scissors crossover with the crossing of its inserts, and a switch ladder onto the parallel tracks of a fan or onto new ones at given spacings; press on a straight and drag onto the other track, Shift+wheel the kind, Ctrl+wheel the R of the aligning curve, Alt+wheel where a double crossover meets; the ghost shows the whole set with the spacing, the inserts and the distance of the mathematical points; switches get their drives and a //$r connection record; the crossover drawn from a diverging end uses the same solver; self-test connection
This commit is contained in:
@@ -156,7 +156,7 @@ void load()
|
||||
std::string km;
|
||||
std::size_t count{0};
|
||||
line >> entry.kind;
|
||||
if (entry.kind != "switch" && entry.kind != "slip" && entry.kind != "crossing" && entry.kind != "double")
|
||||
if (entry.kind != "switch" && entry.kind != "slip" && entry.kind != "crossing" && entry.kind != "double" && entry.kind != "connection")
|
||||
continue;
|
||||
line >> entry.name >> entry.type >> entry.rail >> entry.radius >> entry.ratio >> hand >> entry.a >> entry.b >> entry.main_radius >> keyword >> count;
|
||||
if (line.fail() || keyword != "parts" || count > 64)
|
||||
@@ -205,11 +205,24 @@ std::optional<record> named(TTrack const &Track)
|
||||
if (name.empty())
|
||||
return std::nullopt;
|
||||
for (auto const &entry : g_records)
|
||||
if (std::find(entry.parts.begin(), entry.parts.end(), name) != entry.parts.end())
|
||||
if (entry.kind != "connection" && std::find(entry.parts.begin(), entry.parts.end(), name) != entry.parts.end())
|
||||
return entry;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::vector<record> connections(TTrack const &Track)
|
||||
{
|
||||
load();
|
||||
std::vector<record> result;
|
||||
auto const &name{Track.name()};
|
||||
if (name.empty())
|
||||
return result;
|
||||
for (auto const &entry : g_records)
|
||||
if (entry.kind == "connection" && std::find(entry.parts.begin(), entry.parts.end(), name) != entry.parts.end())
|
||||
result.push_back(entry);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::optional<record> of(TTrack const &Track)
|
||||
{
|
||||
auto const found{named(Track)};
|
||||
|
||||
Reference in New Issue
Block a user