mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-08 10:31:01 +01:00
Merge branch 'master' into feat/renderers-cleanup
This commit is contained in:
@@ -530,7 +530,7 @@ bool editor_track::can_edit_geometry(TTrack const &Track, std::string &Reason)
|
||||
return true;
|
||||
}
|
||||
|
||||
void editor_track::commit(std::vector<TTrack *> const &Tracks)
|
||||
void editor_track::commit(std::vector<TTrack *> const &Tracks, bool const Dragging)
|
||||
{
|
||||
if (Tracks.empty())
|
||||
return;
|
||||
@@ -566,6 +566,8 @@ void editor_track::commit(std::vector<TTrack *> const &Tracks)
|
||||
add_unique(affected, neighbour);
|
||||
for (auto *track : affected)
|
||||
update_transition(*track);
|
||||
if (false == Dragging)
|
||||
add_followers(affected);
|
||||
for (auto *track : affected)
|
||||
rebuild_geometry(*track);
|
||||
for (auto *track : Tracks)
|
||||
@@ -590,6 +592,7 @@ void editor_track::commit_parameters(TTrack &Track)
|
||||
add_unique(affected, neighbour);
|
||||
for (auto *track : affected)
|
||||
update_transition(*track);
|
||||
add_followers(affected);
|
||||
for (auto *track : affected)
|
||||
rebuild_geometry(*track);
|
||||
Track.mark_dirty();
|
||||
@@ -3764,10 +3767,11 @@ void editor_track::retire(TTrack &Track)
|
||||
// the name is free for the path laid in its place, as the switches of a crossover laid again keep theirs
|
||||
simulation::Paths.rename(&Track, std::string{});
|
||||
for (auto *neighbour : adjoining)
|
||||
{
|
||||
update_transition(*neighbour);
|
||||
rebuild_geometry(*neighbour);
|
||||
}
|
||||
auto affected{adjoining};
|
||||
add_followers(affected);
|
||||
for (auto *track : affected)
|
||||
rebuild_geometry(*track);
|
||||
auto crossings{Track.m_crossings};
|
||||
for (auto *crossing : Track.m_crossings)
|
||||
for (auto *neighbour : neighbours(*crossing))
|
||||
@@ -3785,6 +3789,16 @@ void editor_track::revive(TTrack &Track)
|
||||
WriteLog("Editor: the path " + Track.name() + " came back, but another one has its name now", logtype::generic);
|
||||
}
|
||||
|
||||
void editor_track::add_followers(std::vector<TTrack *> &Tracks)
|
||||
{
|
||||
++TTrack::s_layoutstamp;
|
||||
for (auto *track : TTrack::switch_followers(Tracks))
|
||||
add_unique(Tracks, track);
|
||||
for (auto *track : simulation::Paths.sequence())
|
||||
if (false == track->m_editorremoved && track->rail_joints_moved())
|
||||
add_unique(Tracks, track);
|
||||
}
|
||||
|
||||
void editor_track::rebuild_geometry(TTrack &Track)
|
||||
{
|
||||
auto const rebuild = [](TTrack &Path) {
|
||||
|
||||
@@ -107,7 +107,8 @@ class editor_track
|
||||
static bool can_edit_geometry(TTrack const &Track, std::string &Reason);
|
||||
static bool is_supported(TTrack const &Track);
|
||||
|
||||
static void commit(std::vector<TTrack *> const &Tracks);
|
||||
// Dragging: on the way, what follows them from further off waits for the commit at the end of it
|
||||
static void commit(std::vector<TTrack *> const &Tracks, bool const Dragging = false);
|
||||
static void commit_parameters(TTrack &Track);
|
||||
|
||||
static glm::dvec3 point_position(TTrack const &Track, point_ref const &Point);
|
||||
@@ -568,6 +569,8 @@ class editor_track
|
||||
static void bind_switch_path(TTrack &Switch, int const Path);
|
||||
static void store_switch_path(TTrack &Switch, int const Path);
|
||||
static void rebuild_geometry(TTrack &Track);
|
||||
// adds the tracks whose shape goes by a change of the given from further off: by the switches they meet, and by rail joints running on through them
|
||||
static void add_followers(std::vector<TTrack *> &Tracks);
|
||||
static TTrack *clone(TTrack const &Template, std::string const &Name = {});
|
||||
static TTrack *load_text(std::string const &Text, TTrack const *Template, std::string const &Name);
|
||||
static void move_straight(straight const &Line, glm::dvec3 const &Start, glm::dvec3 const &End, std::function<bool(TTrack const *)> const &Member);
|
||||
|
||||
Reference in New Issue
Block a user