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

feat(editor): a deleted track leaves its signal reads and its track circuit to the track laid in its place, and the SRK check lists the signals no track reads and the broken lines, with a Repair

A deleted track whose read events or track circuit no other track took says so by the cursor, naming the signals and the circuits, and the editor keeps them for the track laid in its place, within a metre of its axis. The read of each signal goes to the piece by the signal, on the list its facing there gives, so a track laid the other way round keeps the trains reading it; the other events go to the piece at its middle, the circuit to a track lying there for the most part, a new track taking it instead of the one of the track it was made from. It happens in the step which lays the track, so Ctrl+Z takes it back and laying it again gets them again; a track which took a circuit over and is removed by another step leaves it to that step, and the events of a signal taken away stay off the tracks.

The SRK panel of a station lists what it and its lines need: signals no track reads, lines broken off where the tracks go on beyond a gap, tracks of a line of the automatic block in no block section, block sections whose tracks are gone. A row shows the place; Repair has the track by each signal read it again, as moving it does, and sets the line signals again where tracks are in no block section. A warning after an operation shows by the cursor in amber, a refusal in red as before. srkcheck counts these too, srkfix repairs, join takes the height of the ends for sceneries far above zero.
This commit is contained in:
maj00r
2026-10-22 22:40:01 +02:00
parent de61cf05db
commit 2d9be3ae10
11 changed files with 704 additions and 41 deletions

View File

@@ -1905,6 +1905,7 @@ class editor_mode : public application_mode, private editor_track::observer, pri
bool standing_signals(std::vector<standing_signal> &Signals, bool const Wait) override;
std::size_t signal_batch(signal_changes const &Changes, std::vector<std::pair<TTrack *, editor_track::state>> States, std::vector<TTrack *> Created, std::string &Error) override;
bool signal_heads(std::vector<signal_head> &Heads, bool const Wait) override;
std::size_t signal_reattach(std::vector<scene::instance_handle> const &Instances) override;
struct signal_template
{
@@ -1978,6 +1979,8 @@ class editor_mode : public application_mode, private editor_track::observer, pri
signal_template const *signal_template_of(std::string const &File) const;
bool signal_spot_at(TTrack &Track, int const Path, glm::dvec3 const &Point, glm::dvec3 const &Cursor, int const Facing, int const Side, signal_template const &Template, signal_spot &Spot) const;
void signal_refresh(bool const Force = false);
// the signals standing, read by the tracks as they are now, the templates as found so far
std::vector<signal_standing> signal_standing_now() const;
int signal_hit() const;
void signal_press(track_intent const &Intent);
void signal_release();
@@ -2001,6 +2004,22 @@ class editor_mode : public application_mode, private editor_track::observer, pri
void draw_signal_overlay() const;
std::string signal_intent_label(signal_template const &Template, signal_spot const &Spot) const;
std::string signal_variant(signal_template const &Template, signal_spot const &Spot) const;
// what a deleted track carried and no other one took, its read events and track circuits, for a track laid in its place
struct orphan_record
{
TTrack *track{nullptr}; // retired; the record waits while it stays so
std::vector<std::pair<std::string, int>> events; // the name, the list it was on
std::vector<std::string> circuits;
// the tracks given the circuits: while one stays the circuits don't wait, once a step other than an undo removes one they
// are its own
std::vector<TTrack *> given;
bool fresh{false}; // made by the step being taken
};
std::vector<orphan_record> m_orphans;
std::string m_orphan_note; // shown by the cursor after the step which made it
void orphans_register(std::vector<TTrack *> const &Removed, std::vector<TTrack *> const &Kept);
// Created: made by the step, their circuits the ones of the tracks they were made from; Changed: the others it changed
void orphans_take_over(std::vector<TTrack *> const &Created, std::vector<TTrack *> const &Changed);
// a model laid along the track: bent to follow it, or repeated along it
struct sweep_tool