17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-28 23:57:28 +01:00

fix(editor): a signal goes to the other side of the track and turns around

Dragging a standing signal over the track takes it to the other side;
the side used to come from where the signal stood, so it never crossed.
The selected signal gets "To the other side" and "Turn around": the
first mirrors it over the axis facing the same trains, the second turns
it to the trains of the other direction and moves its event to the
other event list of the path. Either one swaps a head leaning to the
track for its counterpart, and an include keeps the template its
directive names, so undo brings the old file back too.
This commit is contained in:
maj00r
2026-10-21 10:44:58 +02:00
parent 87bacede74
commit 7da0432dca
8 changed files with 251 additions and 78 deletions

View File

@@ -1796,8 +1796,6 @@ class editor_mode : public application_mode, private editor_track::observer, pri
std::string read;
TTrack *track{nullptr};
int list{0};
signal_spot spot;
bool on_track{false};
};
struct signal_tool
{
@@ -1821,6 +1819,9 @@ class editor_mode : public application_mode, private editor_track::observer, pri
int hover{-1};
scene::instance_handle selected{0};
bool moving{false};
glm::dvec2 grab{0.0};
signal_spot home;
bool home_valid{false};
signal_spot moved;
bool moved_valid{false};
std::string status;
@@ -1836,7 +1837,12 @@ class editor_mode : public application_mode, private editor_track::observer, pri
void signal_release();
bool signal_place(signal_spot const &Spot, signal_template const &Template);
void signal_move_update();
void signal_move_finish();
bool signal_standing_spot(signal_standing const &Standing, signal_spot &Spot) const;
bool signal_drop_at(signal_standing const &Standing, TTrack &Track, int const Path, glm::dvec3 const &Point, int const Side, signal_spot &Spot) const;
bool signal_move_to(signal_standing const &Standing, signal_spot const &Spot, char const *Read, char const *Unread);
bool signal_flip(scene::instance_handle const Instance);
bool signal_turn(scene::instance_handle const Instance);
signal_standing const *signal_standing_of(scene::instance_handle const Instance) const;
bool signal_delete(scene::instance_handle const Instance);
void signal_detach_events(std::string const &Read, std::vector<std::pair<TTrack *, editor_track::state>> &States);
void signal_renamed(std::string const &Before, std::string const &After, EditorSnapshot &Snapshot);