17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-02 04:39:16 +01:00

feat(editor): the SRK tool checks the lights of the signals against the routes of their trains: the speed of each route through the switches by the radius of their curves and the speed set on them, 40, 60 or 100 km/h, a lower orange light for these with an orange strip for 60 and a green one for 100 as Ie-1 gives them, an upper orange one where the next signal can show stop, the white one of the substitute signal; a signal telling of the next one nearer than the braking distance slows the trains with it at stop, Ie-4 § 8 ust. 5, a W21 for 140. The templates read for the speeds their events show; the signals set get the template of the kind with these lights and the least beyond them, the standing ones fitted so in one step of undo, the template swapped with the name, the plate and the read event kept, a variant leaning the other way only with the same speeds. The braking distance shown with the speed of the main tracks it follows, set by hand in the record of the station and used for the block sections too; the warning discs and the block sections nearer than it marked, the signals that don't fit marked in the schematic and the scenery

This commit is contained in:
maj00r
2026-10-22 16:07:04 +02:00
parent ad0a7e7d62
commit 92552b49cd
10 changed files with 1300 additions and 13 deletions

View File

@@ -85,6 +85,7 @@ struct signal_order
std::string name;
std::string plate; // the name on the plate under the head, when the template has one
std::string linked{"none"}; // the signal before it, when the template takes one: a block signal shows its aspects by it
std::string file; // the template, of its kind; empty for the one chosen for the kind
};
struct signal_rename
{
@@ -101,6 +102,21 @@ struct standing_signal
glm::dvec3 position{0.0};
double yaw{0.0};
std::string linked; // of a template that takes one, else empty
std::string file; // of its template
TTrack *track{nullptr}; // the trains read it on, nullptr while none does
int facing{0}; // the trains it faces run 1: towards the end of the path of the track, -1: towards its start, 0 unknown
};
// a signal template as the signalling picks one: the lights it has and the speeds its events show
struct signal_head
{
std::string file;
std::string name;
std::string kind;
std::string mount;
std::string lamps; // its chambers from the top: z green, c red, p orange, b white, n blue, x blind
std::vector<int> speeds; // of the signal itself, km/h: -1 the highest allowed, 20 the substitute signal
bool informs{false}; // it tells the next signal shows stop
bool chosen{false}; // the Signals tool places it for its kind
};
// one step of the history of the signalling: signals placed, standing ones renamed, other templates placed with them, the values
// of standing ones replaced
@@ -110,6 +126,7 @@ struct signal_changes
std::vector<signal_rename> renamed;
std::vector<template_item> others;
std::vector<std::pair<scene::instance_handle, std::vector<std::string>>> values;
std::vector<std::pair<scene::instance_handle, std::string>> files; // standing signals given another template, of the same kind, their values kept
};
struct nmt_place
@@ -195,6 +212,8 @@ class editor_signals
// the signals placed by the templates chosen for their kinds and the rest of the changes, with the tracks changed before: one
// step of the history. returns: how many signals were placed
virtual 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) = 0;
// the signal templates with lights, false while they are still being looked for
virtual bool signal_heads(std::vector<signal_head> &Heads, bool const Wait) = 0;
protected:
~editor_signals() = default;