mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-12 17:31:03 +01:00
fix(track): the cab keeps the shake a track doesn't replace, and the editor redraws all that an edit changes
The side sway from the lateral acceleration now goes off only on a track with a sideways value, and the random jolts on one with a vertical or a sideways value. Dips at the rail joints and cross level alone replace neither. On a switch it goes by the path set and what its joined tracks allow. An edit in the editor also rebuilds the other switches of a joined group with the tracks they meet, and the tracks of a rail run whose joints moved. Removing a track does the same. While dragging, the tracks further off wait until the drag ends. The clatter of a bogie's axles was right: the followers stand at the pivots and the offsets are the places of the wheel sets. The misleading name goes. Also what Sonar had left: a parameter as a span, a const method, a struct and its member apart, commented out code, and a function of the grading tool split, with the same output.
This commit is contained in:
@@ -426,7 +426,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;
|
||||
@@ -457,6 +457,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)
|
||||
@@ -478,6 +480,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();
|
||||
@@ -2819,14 +2822,25 @@ void editor_track::retire(TTrack &Track)
|
||||
simulation::Region->erase_and_unregister(&Track);
|
||||
Track.m_editorremoved = true;
|
||||
for (auto *neighbour : adjoining)
|
||||
{
|
||||
update_transition(*neighbour);
|
||||
rebuild_geometry(*neighbour);
|
||||
}
|
||||
auto affected{adjoining};
|
||||
add_followers(affected);
|
||||
for (auto *track : affected)
|
||||
rebuild_geometry(*track);
|
||||
if (s_observer != nullptr)
|
||||
s_observer->track_retired(Track);
|
||||
}
|
||||
|
||||
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 §ion{simulation::Region->section(Track.location())};
|
||||
|
||||
@@ -93,7 +93,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);
|
||||
@@ -350,6 +351,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);
|
||||
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