mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-01 08:17:09 +01:00
dce6f9d11cdcb23c834901ac347a02dd54401060
3812 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
dce6f9d11c |
feat(editor): the messages of the model of the track geometry and of its norms told in the language of the editor
The first part of E4b (editor-tracks-domain.md §8; E4a left the messages of the model in English): what the model refuses a command for, and what the norms warn of, reach the user through the catalogue of the editor, the model staying as it is, English and pure. - The editor layer formats them: a message of the model is matched against the forms it's made by (a BLOCK limit along a line, a finding of the norms with its value, limit and paragraph, a rule of a turnout, a line or a vertex which can't be laid, the solver of the connections and its proposal...), the form of the catalogue (STR) filled with its numbers and names, the parts which are messages of their own (the name of a parameter of the norms, what a line or a turnout is refused for) shown so in turn; a whole message the catalogue has, as it is. One with no form stays English. - The editing on the model keeps both: what the model told, English, for the log and the self-tests, and what the user reads, in the route design, the lay tool and the panels of E4b. The window of the application is split off editormodemodel.cpp into editormodemodel.h, shared by the files of E4b. Self-test: expect modelmessage holds or lacks the text in either of them, so the cases run in any language. lang/editor_pl.po: the Polish of the forms and of the names of the parameters of the norms the editor hadn't yet. |
||
|
|
c0e6a70f5f |
test(editor): the recognition of old tracks measured on sceneries of the game, read only, skipped unless asked for
editor-tracks-tests.md §4 "E6", the measure: tests/unit/test_takeover_measure.cpp, a case skipped by default (it needs the data of the game, so it isn't a test of the build), run as EU07_TAKEOVER_MEASURE="<scenery folder>;<file>;..." eu07_unit_tests --no-skip --test-case="takeover measure*" It reads the tracks of each file with its includes, takes all the plain ones over in a plan (nothing laid, nothing written) and prints the lines made, how far they keep off their old tracks in the plan, the height and the cant, how many would be taken over with no question and why the others ask it, what the domain lays otherwise (kinks, compound curves, cants with no transition), the worst lines; EU07_TAKEOVER_TRACK=<name> prints the curves found and the vertices of the line of a track. Measured on the game data, read only (baltyk/baltyk_torowisko.scm, l02/l02_tory.scm, linia61/l61_tory.scm, lk197/lk197_tory_uniwersalne.scm, drawinowo/tory.scm, calkowo_v2/v2_tory.scm): 31 411 tracks (2 111 switches), 3 594 lines of 30 297 tracks, 1 477 km, 2 chains not laid, 8 minutes. With no question 3 112 lines (87 %) but 591 km (40 %): the short tracks of the stations fit within 5 mm, the long lines drawn by hand ask. The farthest in the plan: up to 5 mm 2 890 lines, 10 mm 195, 20 mm 113, 50 mm 134, 100 mm 97, 500 mm 99, more 66 (bulging Bezier curves, compound curves of stations, a few tracks of no sense). The question for 482: the plan 297, the height 74 (buffer stops of tracks climbing a metre), the cant 12, more than one 99. |
||
|
|
10d3da2164 |
feat(editor): an old scenery read with no scene, its lineside objects anchored to the lines with a confidence, the anchors in the project file
The rest of E6a (editor-tracks-domain.md §2 "Kotwica", §3 "Otoczenie", §9, §10 "Powiązania otoczenia ... z oceną pewności; wątpliwe pokazane do przejrzenia; przewody wiązane ze słupami"). - editor/project/legacyScenery: the tracks of the railway (normal and switch) and the lineside objects (models, wires, memory cells, event launchers) of a scenery read from the text of its files with their includes, as the simulator places them: the tracks and the wires moved by the origin only, the rest by the origin, the rotation and the scale (sceneryText now tells the placement in effect at each statement). The tracks naming an object: a memory cell's own, and those whose events (event0 to eventall2 of their entries, the events <track>:eventN) act on it, multiple events followed four deep. The kind of an object by its file and name, as the binding of the editor tells it (infra::classify). - editor/layout/layoutAnchors: an anchor puts an object along a line: its chainage, the offset to the left of the line (below 0 to the right), the height above it, its turn against the heading there; a wire by its four points, bound to the poles its ends hang on (a pole, or a model the names take for a part of the catenary, within 8 m of each end, along the same line). infer_anchors() anchors every object within 30 m of a line to the nearest one, with a confidence from 0 to 1 and the reasons for it: named by a track of a line, 0.95 at least (0.85 where another line is nearer, half of the fit where the line named isn't near); else how its distance fits its kind (a signal 0 to 6 m, a sign or a pole 1.5 to 8 m, a wire 0 to 1.5 m, equipment 0 to 3 m, logic and the rest 0 to 15 m, the environment at half), a third past the end of a line or 15 m above or below it, half where another line is as near within a metre, 0.8 for a sign, a signal or a pole turned more than 10 degree off square to the track; a wire on poles at both ends 0.9 at least, on none 0.7 of what it had. Below 0.6 doubtful, to be looked over. place() puts the object where it stands along its line now; follow() after a change of the network: an anchor whose line is there keeps its chainage, one whose line is gone (cut, joined, taken by a turnout) is anchored again where it stood, to the line there now; the anchors whose objects move, with where to. Moving the nodes of the scene, and taking the anchors back with an undo, is the editor's. - take_over_tracks() given the objects of the scenery anchors them to the lines it laid, the old tracks naming them by the lines they became, and lists the doubtful ones, with the deviations, for the question. - The project file: the anchors section, reserved and empty in version 1 so far, holds the anchors: "anchor <id> <kind> <name> <key> group <n> at <x y z> yaw <deg> line <id> chainage <m> offset <m> height <m> turn <deg> confidence <c> points <n> ... poles <n> ... [why <reasons>]". The schema stays 1: it's unreleased and the section was empty. - The //$b bindings of the old editor (the same mechanism along the paths of the tracks) aren't made anchors yet. Tests: G: data/takeover/old.scn, written by make_old.py (a line of 26 tracks with a curve of R 500 m, clothoids of 60 m and 80 mm, a break of the grade with no vertical curve, tracks of no name and written backwards, events and an isolated circuit; a switch at its end and a line on from each of its legs; a signal named by the events of a track and its memory cell, a pole every 50 m and the wires between them, hectometre posts, a tree 25 m off, a cabinet between two lines): read with no scene; its plain tracks taken over as three lines with no question, R 500 m, the clothoids and the cant read back within 1 and 5 %, the lines held at the legs of the switch in its headings, one step undone and done again the same; the tracks made again ending at the old joints, each old name once, the events and the circuit on their pieces, also after the curve was made 20 m wider; written into the project file and read back. The signal and its memory cell anchored with 0.9 or more, the poles with 1, every wire bound to its two poles, the tree and the cabinet doubtful; the curve made wider: the objects along it follow at their chainages and offsets, the signal on the straight before it stays; the anchors written into the project file and read back. The case of the project file which kept the section of the anchors as text reads and writes two anchors now. Unit tests 1104 -> 1108. |
||
|
|
5b83a5c1bc |
feat(editor): the old tracks of a scenery chained and taken over as lines by one command of the model, the norms told, not refusing
E6 (editor-tracks-domain.md §10): a set of old tracks made lines of the domain in one step to undo (editor/layout/layoutLegacy and the command take_over). Model only: the question with a preview before and after is the editor's, after E4a. - legacy_track: an old track as its entry has it, in the world, with no scene: its name, its paths, the words before and after them. walk_chains(): the plain tracks of the set chained the way a train runs them (the chain walking of the old digitization, kept): a track joined at an end to exactly one other plain track of the set, within the 2 cm the simulator joins them within, goes on into it; a switch, a track not taken over, a fork or a free end ends the chain, held in the heading of the main path of the switch or of the track holding it, which the line runs on from. Each chain runs from its end the smaller in x, then in z, whichever track it was found from. - plan_takeover(): each chain recognized (layoutRecognition), its held ends kept, the old tracks along it as its hard splits (a track named none of no name), the class of its line of the highest speed of its tracks; the deviation of each line and the worst of all; silent where each line keeps within the tolerance. Nothing is laid. - take_over, a command of the model: the lines between new nodes at the ends of their old tracks, their vertices, grade lines and old tracks as recognized. The invariants refuse it as they refuse any command; the norms don't: the BLOCK limits the old tracks pass are told in outcome::broken (an old track may break the norms where nobody touched it, improving it is a separate decision; edits of the lines after it are judged by edit_policy::no_new_block). take_over_tracks() executes it and returns the deviation of each line and whether the takeover is silent, for the question. - A switch stays an old track, a fixed constraint: the lines end at its legs in its headings. Its type recognized in the catalogue and the switch laid into the line as a turnout, so the line runs on through it, is left for later. Tests: U: the line of three curves cut into old tracks, each written the way it was: the tracks in three random orders, seeds 4401, 5502 and 6603, the walk starting from another one of them each time: the same line, its vertices to 1e-6 m and its radii and transitions to 1e-9, the same old tracks at the same chainages. Unit tests 1103 -> 1104. |
||
|
|
d87da1c476 |
feat(editor): the joints of old tracks as hard points of the pieces, the names, events and circuits of the old tracks kept by the lines
E6 (editor-tracks-domain.md §5 "Podział na kawałki zachowuje miejsca...", §10 "Stare złącza jako twarde punkty podziału"), the hook of the generator E2a left (generator_options::hard_splits, a line given any refused). - A line keeps the old tracks it was taken over from (line::hard_splits): where along it the stretch of each begins, its name, the words of its entry before the path (the width, the friction, ... the visibility and the materials) and after it (the speed, the events, the isolated circuits and the rest), whether it ran against the line. In the line rather than in the options of the generator, so a command which cuts or joins lines carries them and an undo puts them back: a line cut (split_line, a turnout laid into it) gives those past the cut to the part after it, and the old track cut in two keeps its name and its events on the part it ran into first, the other part a stretch of it the generator names (continued); two lines joined, the second one's after the first one's. - The generator ends the pieces at each joint inside the line (a joint stays, a break of the elements next to it gives way) and writes the pieces of a stretch as the old track was: its name on the piece it ran into first with all its attributes, <name>_2, <name>_3... on the others with them but its events (an event of a track is called once), its surface, the path written the way it ran (event1 and event2, the sign of the rolls); an old track of no name named by the generator, its events kept. A line with none is made as before. - The project file: "old <chainage> <name> reversed <0|1> continued <0|1> surface <words> attributes <words>" in the block of a line; version 1, unreleased, read as before without them. Tests: G: a line of three curves given three old tracks (one named with its events and its circuit, one of no name, one which ran against the line): the pieces end at the joints, each name once, the attributes of the first on its first piece and without its event on the others, the event of the unnamed one once, the one which ran against the line written from the end of the line; written into the project file and read back the same. It takes the place of the E2a case of the hook refusing. Unit tests 1103 -> 1103. |
||
|
|
3f5f2af1ce |
feat(editor): the old tracks recognized as lines of the domain: the curves read off the curvature, fitted by least squares, the deviation measured
The first part of E6 (editor-tracks-domain.md §10 "Automatyczne przejęcie odcinka", editor-tracks-tests.md §4 "E6"): a chain of the paths of an old scenery, Bezier curves drawn by hand or by older tools, made a line of the domain (editor/layout/layoutRecognition). Model only, nothing of the editor asks it yet. - The chain sampled along its arc length in the plan, every metre for the fit and every half metre for the deviation, each joint with the turn of the heading there: the point, the heading and the curvature of the Bezier curve as the simulator draws it, the cant of the roll turned evenly with the parameter as the simulator turns it (1500 mm sin roll, of the other sign where a path runs against the chain). - The curves found where the curvature changes: the heading differenced over 30 m (the noise of the ends of the old paths, written to the millimetre, and the ripple of the Bezier curves evened out), runs of one sign past 1/5000 m; a run whose curvature falls to a third of what it is on both sides cut in two; the arc of each where the curvature is half of it or more (the area over that width is the turn), its transitions where it rises from a tenth to nine tenths, the window taken off; a turn of more than a quarter of a circle laid as curves of a quarter at most. A turn of more than 5 mrad at one joint making up a curve is a kink (told, laid as the shortest curve which fits); an arc whose halves differ by a quarter is a compound curve (told, laid as one). - Each curve a vertex of the domain, clothoid - arc - clothoid, its point where the straights fitted around it cross; then the points, the radii and the transitions of all of them fitted by least squares to the offsets of the points of the chain from the line the domain lays (Levenberg-Marquardt, the Jacobian by differences over the points each parameter moves; the transitions by their squares, since what a transition moves the curve by grows with its square; the points and the radii first, then all of it). An end held by what stays beyond it (a switch, an old track not taken over) keeps the first or the last vertex on its heading. The curves the curvature doesn't show (a radius over 5 km, a turn spread over the joints) are added where the line keeps off the points by the tolerance, six at most; the small turns of old tracks laid jagged, joint by joint, are left out where the line keeps nearer without them; where it keeps more than a metre off, the plan of the added curves alone is tried; a vertex whose tangents cross behind the curve tells nothing of it, and a vertex no radius lays is taken out. - The cant of each vertex fitted to the rolls along its arc and its transitions; a cant the rolls ramp up with no transition under it is fitted again with transitions as long as the ramps, kept where the line keeps nearer so. The grade line: the heights as straight grades within 1 cm (Douglas and Peucker), the heights of the breaks by least squares, each vertical curve the largest of the usual radii which keeps within it. - The deviation measured densely: each point of the chain every half metre set square onto the line, the farthest and the root mean square of the distance in the plan, of the height and of the cant, where the farthest is. The tolerance of a takeover with no question (takeover_tolerance): 20 mm in the plan and in the height, as the simulator itself joins the ends of the tracks within 2 cm, so the tracks made again lie where the simulator takes the old ones to be; 10 mm of the cant, 0.4 degree of the roll, under the half degree many old files round the rolls to. The norms aren't asked here. Tests: U: three curves (R 800 m with clothoids of 80 m and 60 mm, R 600 m with 60 and 70 m and 90 mm, R 1500 m with none) and a grade line with two breaks, cut at random places 8 to 25 m apart, each piece a Bezier curve, the joints shaken by up to 4 mm across and in height, the rolls rounded to the tenth of a degree, seeds 1101, 2202 and 3303: the radii within 1 %, the transitions within 3 m or moving the arc within 5 mm of where the laid ones move it, the cants within 3 mm, the deviation within the tolerance; the same walked the other way round, the transitions swapped. A kink of 0.6 degree at a joint told and laid within the tolerance; an arc of 11 km found where the curvature shows none; an end held in a heading 2 mrad off the chain kept to 1e-9 rad. Unit tests 1101 -> 1103. |
||
|
|
00f5dbb98a |
feat(editor): the scenarios naming a track looked through before it goes, the index of the map built in the background and kept
The last part of E4a (editor-tracks-domain.md §0 pkt 7; §8, deleting a line): with the editing on the model on, a track a scenario of
the map names goes, or is renamed, only when the user says so.
- editor/project/scenarioIndexCache: the scenario index of E3 built on a thread of its own as the map is opened, and kept: in memory,
and in a file of the cache of the user between the sessions (scenario_index/<map>.txt; not for the self-tests), for as long as the
*.scn files of the folder are the ones it was built of (their names, sizes and times); on a big map it takes minutes, once. The
editor doesn't wait for it to close. users_of() tells the scenarios naming the tracks, with what names them and where.
- Del on an old track with a name, on a set of them, or on a track of a line of the model (its line goes), the route design applied
to old tracks, and a track renamed in the inspector (editor_mode::track_rename) wait for the index ("Checking the scenarios":
cancel, or go on without checking), then go at once where no scenario names the tracks, or ask: "Track used by 2 scenarios", each
scenario with the trainsets, events and the rest naming the track, the file and the line; delete (rename) anyway, or cancel and
nothing changes.
- The self-tests: the scenarios of the map of the fixture, tests/editor/scenery/autotest_editor.<part>.scn, copied by run.py next to
the copy of the fixture as autotest_editor_<case>_<part>.scn, naming that copy (autotest_editor.uses.scn: a trainset on s1, an event
on d2). The index of the fixture's map over the scenarios of the game's folder takes about 80 s.
Tests: U: the index written and read back with its fingerprint, other versions refused; the users of a track by its name as the
simulator compares it; built once in the background, given again for the scenarios as they are, built again when one changed, read
from the file of the cache in the next session, built for another map. Self-test: modelwait, modelrename, expect question
<waiting|scenarios> [n]; the case m_5_index_delete (Del on s1 asks: cancelled it stays, confirmed it goes; d2 renamed the same; a3 and
a line of the model go at once); m_6 and m_7 wait for the index.
lang/editor_pl.po: the Polish of the new texts.
|
||
|
|
1a0535ae25 |
feat(editor): the curves of a line of the model changed in the route design as its commands, refused with the reasons; split, join, delete
Continues E4a (editor-tracks-domain.md §4 "Edycja = polecenie", §8): a line of the model is edited through its commands, each kept
whole or refused with the reasons, one step of the history.
- The route design opened on a track of a line of the model shows the line as the model has it, its curves with their radii,
transitions and cants. The preview is the route design's as before; applied, each change is a command of the model: a vertex moved
(move_vertex), its radius, transitions or cant typed (set_vertex). A command refused changes nothing and the panel tells why, with
the value, the limit and the paragraph ("cant 200, the limit 150 (ST-T1-A6 tab. 9.6)"); one kept is laid, one step, and what the
norms warn of, or would prefer, is the quality line of the panel. Curves added or taken out aren't applied to a line of the model yet.
- Under the line in the panel: split it at a distance from its start, join its free end to the free end of the nearest other line of
the model (a new line solved between them), delete it; Del on one of its tracks deletes the line too.
- A command which lays anew, or takes away, a line whose tracks were changed by hand (found so in the files when the map was opened,
or changed in the editor by the other tools since the model made them) asks first, in a window naming the line: keep the change by
hand, and nothing is done; or overwrite it, the line laid anew and no longer taken for changed by hand.
Self-test: modelplan <track>, routeradius|routecant <vertex> <value>, routemove, modelsplit, modeljoin, modeldelete, modelselect,
modeldel, modelanswer <yes|no>, modelmark; expect modelrefused, modelmessage, modelvertex, modelsame, question. The cases
m_2_plan_refusal (a cant of 200 mm refused with its reason, nothing changed; a wider curve laid in one step), m_3_model_undo (a command
taken back and brought again with its tracks, a split taken back, the project saved after an undo read back as it was),
m_4_hand_change (a track's speed changed in the inspector: kept, nothing changes; overwritten, laid anew; a change by hand saved found
after a reopen), m_6_split_join (two lines joined, the new one split and deleted, each a step).
lang/editor_pl.po: the Polish of the new texts.
|
||
|
|
693779461b |
feat(editor): a line laid in the straights, or the route design applied to old tracks, a line of the model, its tracks the generator's
Continues E4a (editor-tracks-domain.md §3, the generator as the layer between the domain and the simulator; §4, §10): with the editing on the model on, the lines laid in the editor are lines of the model and their tracks its tracks; the old tracks stay as they are, the old tools edit them. - The lay tool in the straights: Enter lays the line its preview shows as a create_line command of the model, its vertices where the preview has them with their radii, transitions and cants, an even grade from end to end (the grade line through the model is E4b), the speed designed for as the class of the line. Refused, the panel tells why with the value, the limit and the paragraph, nothing is laid and the points are kept to be put right; kept, the generator makes its tracks, named after the line and its elements (l1_s11, l1_v1a1...), of the style of the track it goes on from or the lay tool's, one step of the history; what the norms warn of is told under it. A curve traced, a curve going on from the curve of a free end, a compound curve or one with cant ramps of its own are laid the old way, told why. - The route design applied to old tracks makes them a line of the model in their place, one step: not through switches, nor tracks with events or in isolated circuits (their events would be lost until E6), nor a line with a grade line of its own; those are laid the old way, told why. - A track the model made is marked as its line's: the inspector shows "Line L1 (managed)". Ctrl+Z takes the command back with its tracks, Ctrl+Y brings it again: the editor's step keeps the token of the model's step (EditorSnapshot::model_token). - editor_track::load_entry: a track of the entry the generator wrote, its numbers as written. Self-test: a track named @<line>.<index>, modeltracks, expect managed, expect modelends (the tracks of each line from end to end at the numbers of its nodes and at each other, to the bit), expect hand. The cases m_0_setting_off (the setting off: no project, old tracks), m_1_lay_managed (a line laid is a line of the model, the project file written next to the copy of the scenery, the ends to the bit before and after a reopen, nothing changed by hand), m_7_plan_converts (the route design applied to a1..a3 makes them a line, Ctrl+Z brings them back). lang/editor_pl.po: the Polish of the new texts. |
||
|
|
a7a641944f |
feat(editor): the project of the map opened with the scenery and written with it, behind a setting of the editing on the model
The first part of E4a (editor-tracks-domain.md §3, §9, §14): the domain model of E2 and the project file of E3 brought into the running editor, behind a setting, "Editing on the model (trial)" in the settings of the editor, off by default. Off, nothing of it runs and the editor is as it was. - editor/project/projectSession: the project of the map open in the editor, no scene. open() reads the project file of the map, or makes it of the //$ lines the first time (open_project of E3), and compares the tracks the generator wrote with the files as they are now: a track changed or gone outside the editor marks its line changed by hand. trial() tries a command on a copy of the network and tells the lines it lays anew or takes away (differences()), nothing changed; execute() carries it out, the lines of Overwrite no longer taken for changed by hand with it. A command kept is a step of the model's history with a token, which the editor's step of it takes back and brings again (undo(Token), redo(Token)): only the latest step kept, or taken back, can be, so the two histories can't go out of step; the marks of a change by hand go with the step. record_written() records the tracks of a line as the scenery save wrote them, save() writes the project with the network as it is, the records of the lines gone taken out. - The setting on, the project of the map (the file of the scenery opened, <map>.eu07proj next to it) is opened with the scenery and written with it. The scenery save asks for the text of each track it writes (scene::node_layers::path_writer): a track the generator made, as long as nothing else changed it, is written as the generator made it (the numbers in the shortest form which reads back to the same double, not the 15 digits of the export), and its checksum recorded; one changed by the other tools is written by its own export and its line marked changed by hand. The tracks of the lines of the project are found in the scene by their names, with the text the file has for each (scene::node_layers::source() tells the file and the placement of a node). Tests: U: a map opened gets its project file; a command refused, tried or carried out, changes nothing and isn't a step; a command tried changes nothing, carried out tells its lines (new, split, a curve changed, deleted); the steps taken back and brought again by their tokens in the order of the history, another token refused, a command after an undo dropping the step taken back, the identifiers not given again; the tracks of two lines written and recorded, a reopen finding nothing changed and the line the same to the bit as the model laid it, a speed edited in the file marking its line alone, deleting it writing over it too, the mark taken off by a command writing over it and back with its undo, the records of a line deleted gone with it at the save. Self-test: modelediting <0|1> (the setting for the run, not kept), expect modellines, expect projectfile <present|absent|lines n>. lang/editor_pl.po: the Polish of the new texts. |
||
|
|
84dca7cccb |
feat(editor): the //$r switches of an old scenery on the lines of its alignments made turnouts of its project
E5, what E3 left (editor-tracks-domain.md §9 "Migracja"): the //$r records were kept in the project file as a block a file; the switches among them which the domain can lay now become its turnouts when the map is first opened. - A switch or a double switch of the editor becomes a turnout where its record names a type of the catalogue (its type, rail, radius, ratio and a, b of an ordinary or a symmetric one; the first of the catalogue's order where a movable nose is the only difference, which the record doesn't keep), its start lies on a line made of an alignment within a centimetre and its direction along the line or against it, and its main track is bent as the record says the line is there (straight, or the radius within 5 %). It's laid into the line by the command insert_turnout, the hand of the record, with edit_policy::no_new_block: the old line may break the norms where nobody touched it, the turnout may add no BLOCK finding to it. - Its record goes on its own into the project with the main track of the turnout (as an //$h record keeps the line it became); the rest of the block stays as written, the comments with it, why each switch didn't become a turnout with it: a slip or a crossing (their records don't tell the side of the crossing track), a connection (the solver of the connections lays it anew), a lifted outer track, no type of the catalogue, no line under it, a bending other than the line's, or the reasons the command refused it for. A block none of whose switches became one is kept as before, with the reasons. Tests: U: an alignment of data/records with five //$r lines: two switches on its straight, along it and against it, to the left and to the right, made turnouts of their types at their starts (the structure whole, no reason); one beside the line, one of no type of the catalogue and a connection kept in the block with the comment, each with why; the two records each with the main track of its turnout; the project written and read back the same. The records of data/records and of the map of data/project/migration (no switch on a line) kept whole as before. Unit tests 1096 -> 1097. |
||
|
|
efcc28b0ed |
feat(editor): the solver of the connections of the tracks: a crossover between two lines, the norms of the straight and the spacing
E5 (editor-tracks-domain.md §7 "Połącz tory", §8 "Połącz dwa końce ... odmowa ... z najlepszą propozycją"): editor/layout/layoutConnection plans a crossover between two lines running alongside, straight or curved, and the command connect_tracks lays it, one step to undo. - The first turnout where it's asked for, toward the other line; the second one on the other line running back, its diverging track facing the first one's, where the line between their ends turns by as much at both of them: on one straight between straights alongside (the headings of the ends within 1e-13 rad), one curve between curved lines. Found by the secant along the other line, each try the turnout laid in a copy of the network, so it's put as the command will put it. - The spacing of the lines measured along the whole crossover, a point every metre, not where it starts; the least of it against the least spacing of the type: of ST-T1-A6 tab. 11.2 where the catalogue gives it, or what its geometry needs with the least straight between its turnouts (crossover_spacing()), the larger. - The least straight between the turnouts from the norms: a new parameter of the E1 module, switch_straight, at the speed through them: max(0.15 V; 6) m in the running and the main tracks (11.3 pkt 7d, WARN), 30 m on a line of 160 km/h or more (pkt 7e, BLOCK; the new feature fast_line), 6 m recommended in the side tracks (pkt 7c). The solver asks for the normal limit. - Where they can't be met: refused with the reasons and the best which fits the spacing measured, a type of the catalogue of the rail of the one asked for before the others, the fastest; or that none fits, and the spacing the type asked for needs. - The line between the turnouts runs at the speed of their diverging tracks and is a part of the connection of the tracks for the norms (the feature switch_track of its class, which describe_chain() puts on its elements): an arc with no transitions nor cant where it isn't a straight, and the steps of the cant deficiency and the elements between them judged as in the tracks of turnouts (tab. 9.15, 9.16). Tests: U: crossovers of Rz 60E1-500-1:12 between straights 4.75 m apart, both ways to both sides: the spacing 4.75 m all along, the straight between the ends (4.75 m less twice the offset of an end) / sin(1:12), the norms' 9 m at 60 km/h, the ends facing each other on one straight, one step to undo; a line closing in on the other refused for its spacing along the crossover though wide enough at its start; 0.15 m short of the spacing for the 9 m straight refused with "11.3 pkt 7" and a type proposed, which then is laid; 30 m on a line of 160 km/h; Rz 60E1-760-1:14 refused at 4.74 m by tab. 11.2 though its geometry fits; between two curves of R 1200 and 1195.5 m 4.5 m apart (4.50086 to 4.50087 m along it), both turnouts bent, one curve turning by 0.6 degree between their ends; a slip, a line to itself, a line across and a type of none refused; the rows of switch_straight. Unit tests 1089 -> 1096. |
||
|
|
bed4898ca6 |
feat(editor): the bending of the turnouts exact: table 11.8 for the whole diverging track, the main track on a transition as it is
E5 (editor-tracks-domain.md §4 "Rozjazd", §7 "Na łuku — łukowanie z dokładnym wzorem (tab. 11.8)"), what E2b left: table 11.8 for the curve of the basic switch only, the rest of the diverging track bent with the main track by the sum of the curvatures, a main track on a transition taken at its mean curvature, the sign of the curvature of the diverging track judged from headings sampled every half metre. - Table 11.8 written for the curvatures, r" = (R r -+ t^2) / (R +- r) as k" = (k + K) / (1 - k K t^2) with the tangent t of the basic switch, bends every curve of the diverging track and the ends of its transitions, each as long as keeps its turn off the main track (the angle of the frog); the curve of the basic switch keeps switch_curve::bent_radius(), the same numbers as before; a straight goes with the main track as before (the formula gives K for k = 0). On a straight nothing changes. - The frame of a turnout knows its main track: where its curvature changes under the turnout (a transition curve, or the end of one) the diverging track is laid in steps of 2 m at most, each one's curvature at its ends by the table with the curvature of the main track at the station it runs by (along the main track, its heading off the main one taken in), the turn of each part kept; the straights and the lead with the main track step by step too. - The curvature of a diverging track of one sign all along it, from its elements (9.7 pkt 12, 11.4 pkt 6): a BLOCK rule of the turnout in place of the sampled check of switch_curve (KZW II), which a short straight through the frog going the other way could slip through. Tests: U: a diverging track of a curve of 800 m, the curve of the basic switch of 500 m and a transition off it, bent with main tracks of 1200 m both ways and of 3000 m: each by the table with the tangent of the basic switch, the basic one the same as bent_radius(), each turning off as far as in the basic switch, on a straight to the bit as it was; Rz 60E1-500-1:12 60 m into a transition of 200 m to R 1200 m: laid in steps, its curvature at the start by the table with the main track's there, growing along it, the frog against the main track where it ends beside it at 1:12.0004 (1:11.9966 by the mean curvature, the end 27 mm apart), moved and back the same; Rz 60E1-190-1:9 bent two-sided refused, its curve turning off to its side and the straight through its frog the other way (KZW II), one-sided not. Unit tests 1086 -> 1089. |
||
|
|
ca1f2239df |
feat(editor): the double, symmetric and secant switches, the slips and the crossings of the catalogue in the domain model
E5 (editor-tracks-domain.md §4 "Rozjazd", §7): every type of the catalogue is a turnout the model lays, its tracks lines it owns and its legs nodes, kept whole or refused like the ordinary switches E2b laid. E2b refused the rest with "stage E5". - Secant blades (S42): the diverging track runs along the main one for the pre-blade stretch and turns off it by the angle of the blades at their tips, the rest of 1:n on its arc; a turn inside the track, the node at the start keeping the heading of the main track. The generator ends a piece there with the heading of the element before it (unchanged where a line runs on in its heading). - Double switches (Rpd, Rpj, Rps): the main track cut at the start of the second switch, its node holding the main track, the main track of the second switch (main2) and its diverging track, to the other side or the same one, as switch_design::build() lays it. Written as the switch tool writes them: the first switch, a plain track of a metre before the second one (the simulation joins a switch to plain tracks only), the second switch. - Symmetric switches (Rls): both tracks turning off by half of the angle, to both sides, laid at a free end of a line, which they end (the line beyond it would have to turn at the node); not moved along the line. - Slips (Rkp, Rkpd) and diamond crossings (Skrz): the main track a part of the line, the crossing track across its middle at the angle of the slip between two nodes of its own, the slip curves from the start to the end of the crossing track and, of a double slip, from its start to the end of the main track; slip_of() lays the curves with the blades of the ordinary switch of the rail, radius and angle (no data of the slips' own blades was found), passing the crossing as near as the rails of the simulator's profile let them. The three with the blades outside of the diamond whose curves then reach past the half length of Id-4 (49E1 190-1:6,6, 300-1:9, 500-1:9, by up to 0.3 m) are laid as long as their curves. Written as the switch tool writes them: a switch at each leg a slip curve leaves, the tracks crossing and the middles of the slip curves plain tracks, the joints inside it the same numbers on both sides. - The rules: a double switch, a slip, a crossing (11.4 pkt 4 a, b) and a symmetric switch (no rule of table 11.8 for it) lie on straights only; an invariant, refused with the reason before anything is laid. The norms judge the tracks crossing at a slip or a crossing as crossings (no cant, tab. 9.6), its slip curves as diverging tracks. - The ends of the tracks of a turnout which carry no line through their node (the starts of the diverging tracks, the ends of the slip curves) are branch_end(); a node holds such an end beside a track of the same turnout on its side. settle() lays all the tracks a turnout lays itself (lay_tracks()), the nodes of its own where they end; lifting, moving, changing (to another kind too) and removing a turnout take all of them along. - The project file: the turnout record gets "second <node> <main2> <diverging2> <node>" and "crossing <line> <node> <node> slip <line>" where the turnout has them (diverging 0 0 for a crossing); version 1, unreleased, read as before without them. The generated section keeps each track a turnout is made of. - TSI INF 4.2.3.4(1), 150 m at least, judges the plain line, not the curves of switches (4.2.5): its hard row leaves out the tracks of the turnouts, so the industrial S42 switches of R 70 and 140 m are laid. Tests: U: every type of the catalogue laid (41 ordinary, 3 symmetric, 15 double, 18 slips, 20 crossings) on a straight to both sides along the line and against it, its legs where the catalogue puts them (the main track a + b, 1:n at the ends, the second switch at the stagger, the crossing track at the angle of the slip, half its length from the crossing), moved and taken out, the line one again, each a step to undo; the turn of the secant blades of S42-190-1:7 at the end of the pre-blade stretch; a double switch, two slips and a crossing refused in a curve, a secant S42 bent in a side track, a symmetric switch refused at the end of a curve. The three fitted to the tangents of S42-140-1:6,6 16/12 measured are refused by the norms (tab. 9.14) where the transition one is. P: 200 random edits with every type along arcs and transitions, seeds 5150, 2718 and 1618: the invariants after each, a refusal changing nothing, undone back to the start exactly. G: every type made into the tracks of the simulator and read back by TTrack::Load, the ends of the paths at the legs or at each other to the bit, the velocity and the frog; a double switch, a double slip and a crossing written to the project file and read back, their tracks laid again the same to the bit. The E2b case of the types refused now checks that they're laid. Unit tests 1077 -> 1086. |
||
|
|
e9f8b6a059 |
feat(editor): the catalogue of the turnouts a data file, the switch tool and the domain model reading it
The first part of E5 (editor-tracks-domain.md §7, "Katalog jako dane"): the types the editor lays its switches from were a table in switch_design::catalogue() and two in editor_track::standard_switch_templates(); now they are editor/data/turnouts.txt, one type a line, built into the executable as its text (CMakeLists.txt writes it out as editor_turnouts_txt.inc, as it does the icons), so the game data doesn't need it, and read once when first needed. - The format, which the templates of the user (eu07_switch_templates.txt) share: switch <name> <key> <value>... source <the rest>. A type of the catalogue gives its geometry as the instruction does (type, rail, radius, ratio, a, b, diverging, the blades tangent or secant, the cut tip of the blade; stagger and the keys of the second switch of a double one; middle and the half length of a slip; fit for the three fitted to measured tangents), the parts made of it as before; a template of the user gives its parts. What §7 asks besides the geometry, - where the source has nothing: the frog (fixed or movable), the locks (Id-4 tab. 14-3), the drive, the speed of the diverging track (ST-T1-A6 tab. 11.2), the bending (tab. 11.9), the least spacing for a crossover (tab. 11.2) and the source of the values, unconfirmed ones said so: the cut tips of SKMd-4 (190, 300, 500, 1200 m; 760 m the editor's own), the secant blades of S42 at 25' and the one fitted for S42-140-1:7, the a and b of 2500-1:26,5, the slips' blades (not found), the tip of a blade with no data by the rule sqrt(2R 0.005) - 0.125. - read_designs() reads the format, a line which isn't one left out with why; catalogue() the switches as before, in the same order, slips() the slips and the crossings, catalogue_entries() all of them, read once (secant_blade() no longer builds the catalogue at each call). - The slip curve and slip_of() moved from editor_track to switch_design, which the domain model lays its slips with (E5); editor_track keeps the names. - A template of the user with a movable nose writes frog movable, which it lost before; without one the line is what the builds before wrote (they leave out a template with a key they don't know). The lines they wrote read as they did. Tests: U: every switch of the data file the same to the bit as the catalogue of the code (kept in the test as it was), the slips and the crossings as the switch tool had them; every line read, with its source; each switch against Id-4 and ST-T1-A6: R, 1:n, a, the main track a + b, the pre-blade stretch, the blades (the tip lead + cut where the sheets give it, about sqrt(2R 0.005) - 0.125 where they don't; secant at 25'), the speed of tab. 11.2, the bending of tab. 11.9, the spacing of tab. 11.2; the rule of the tip against the sheets (190 m +3 mm, 300 m +105 mm, 500 m -56 mm, 1200 m +3 mm; the 4.5 mm rule +60, +143, -44, -49 mm); a template keeping its movable nose, an old line read as before; lines left out with why. Unit tests 1070 -> 1077. |
||
|
|
81e53bbdef |
feat(editor): the switch tool a step at a time, the template chosen as a line
The panel of the switch tool goes by states as the lay tool's does, each with its step at the top (editor-lay-flow.md, second part): - Ready: "Press on a straight and drag along it and to the side" (a slip, a crossing and a connection with steps of their own). What to place as one bar, [Switch | Slip | Crossing], in place of the tiles in two rows. The rail of the track, or the rails [60E1 49E1 S42] where it doesn't tell its rail, and the speed on the diverging track as chips beside "Diverging speed (km/h)"; the template they pick as one line, "Rz 60E1-300-1:9, 50 km/h", its tooltip the lengths and the rest of its label, a pencil at its end opening the list of the templates and All templates under it. The gestures of placing are in the card and in the bar under the view, no longer rows in the panel; the template editor among More settings. - Dragging: "Let go to insert" and one line, "27.1 m, left, 40 km/h"; what keeps the switch from being laid (the rules a switch bent into a curve or laid on from a free end breaks) in one line in red, the switch moved back onto its straight or into its curve and the branch that doesn't fit into a track in orange. - Placed: "Switch z1 inserted, Ctrl+Z undoes" while the switch is the one the last step of the history laid, else "Switch z1: drag it along its track to move it". The sketch, its length and side in its tooltip; the speed chips and the template as the line with the pencil, as when placing; Flip the side. A switch with no drive says so with what puts one there; the name, the record, the angle, the drive, the frog and the check rails, the slide along its track and the note of the inspector are under Details, folded. What the tool told of it besides the step under it all. - Refused: the reason in red right under the step, the rest of a long one in its tooltip. The drive of the switch is drawn by a function of its own (render_switch_drive), no longer a lambda of the panel. The status of the switch tool is told in red while it's the refusal last told (m_switch.refusal), the expectations of the self-tests read it as before. The bar under the view keeps the gestures of the view first, "List in the panel" after them. Self-test: expect switchpanel <ready|dragging|placed|selected>, and the case lf_2_switch_panel_states: ready after a switch refused, placed after one laid, selected after another one laid since. lang/editor_pl.po: the Polish of the new texts. |
||
|
|
f065098717 |
feat(editor): the lay tool a step at a time, its settings folded while the points are clicked
While the points of a line were clicked, the same things were told in four places at once: the card of the
tool with seven gestures, the panel (the points not laid, the buttons, the modes with their explanation,
the speed with its chips, the height, the curves with their legend), six lines by the cursor with the full
texts of the norms, and the gestures again in the bar under the view. The panel of the lay tool now goes by
states, each with one line of what to do now at its top (editor-lay-flow.md):
- Ready, nothing clicked: "Click on the ground or at a free end of a track" (with a curve traced: "Click
points along the curve on the photo"), and the three settings: the shape [Straights | Curve], with what it
makes of the points under the "?" beside it (a click opens its lesson), the radii of a curve traced in the
same place, the speed (the field and its chips), the height [Fitted | Point to point | Flat]. The rest
under More settings, the pieces added at the free end of the selected track there too.
- Clicking, a point or more: "Click the next bends" and the keys "Enter lays, Backspace takes back a point,
Esc drops". The line in one line, "Length 300 m, 2 curves, slowest 35 km/h", and a badge, green "meets the
norms" or orange "2 curves below the norms for 100 km/h"; "details" (or the badge) opens the curves one by
one, the breaches of the norms in their words, how the curves go on from those of the tracks joined, the
speed designed for, the grades and what the norms say where the line goes on from a switch. The legend of
the labels is by the cursor over a curve. [Lay (Enter)] as the main button and [Drop]. The settings
folded to one line, "Straights, 100 km/h, through the points" (a curve traced with its radii), a pencil at
its end opening them. The details open under it all, so the buttons stay where they are.
- Laid: back to ready, with one line over the settings, "Laid 214 m (14 tracks), Ctrl+Z undoes" in green,
the rest of what the laying told under "notes" beside it. It goes as the history moves on or back.
- Dragged out of a free end: "Drag to lay from the end; let go to lay it", the line of its length and
radius with the badge, the settings as the line of their summary. The drag tells the line laid as Enter
does.
- By the cursor, the leg drawn to it in a line or two: "straight 40 m", "curve R 76 m, up to 35 km/h" with
the sign of a warning (drawn, the font has no glyph of it) and the line in orange where it's below the
norms; joining a free end, the shape of the join, a line that can't be laid, Alt, the first Esc and what
Tab switched to. The texts of the norms are in the details only.
- The labels in the view short: "R 198, up to 60 km/h", orange below the norms; the straights as before.
- The bar under the view shows the three gestures of the state: ready "LMB the first point, LMB on a free
end from the end, Tab a curve from the photo"; clicking "LMB the next bend, Enter lay, Backspace take
back". The rest of them in the card unfolded and in F1, Ctrl+Shift+wheel (the speed) added there; the
length typed after the three.
Nothing is taken away: what the panel showed is behind a fold, the pencil, the "?" or F1. The messages the
lay tool logs for the self-tests keep their words, the line laid told as "Laid 214 m (14 tracks)" now.
The flow: application/editorflow.h, the step line, the summary line with its pencil, the badge with its
details, the message of one line with the rest in its tooltip, for the panels of other tools as well.
Self-test: expect laypanel <ready|clicking|laid|extending> <shown|folded>, and the case lf_1_lay_panel_states
through the states, in straights and in a curve traced.
lang/editor_pl.po: the Polish of the new texts as the spec words them; the laying texts of "the photo"
named the orthophoto as the rest of the editor ("na ortofotomapie", "z ortofotomapy").
|
||
|
|
fef7eaac11 |
feat(editor): one card for the tools, one layout of the fields, windows of their own, one name for each thing
The consistency pass of the editor's interface after its first steps (P2 of the plan of the editor's interface):
- One card for the tool in use in every field of work. The card of the track tools (its icon, name, family and key, what
the tool is for, the mouse and the keys drawing its gestures, the link to all the shortcuts) is a component of its own,
render_tool_card, fed by the tracks as before and now by the surroundings, the roads and the terrain: their tools, kept in
one table each with their icons, keys, tooltips and gestures for the toolbar and the card, had a plain heading and a line
of keys or a few rows of gestures there. The tool options of the surroundings are headed by the field of work as the
others are. The card is folded to its title row unless the user opened it, for all the tools: what the tool is for shows
over the title, a click opens the gestures, which are in the strip under the view of the tracks as well. Kept with the
settings of the editor under the key tool_card_folded, so the open card the tracks had by default before stays behind.
- One layout of the fields: the name on the left, the field on the right (begin_fields and field_row, as in the inspector of
the tracks) in the inspector of the surroundings (the name, the position, the rotation, the scale), Weather and time,
Change history, the settings of the orthophoto and the settings of the editor. The square buttons of the download area go
on to the next line at the edge, the last one was cut off.
- Windows of their own, which don't hide the inspector: Editor settings, Weather and time and the orthophoto settings float
over the view, opened in its top left corner below the rows of the tools and kept between them and the status line, as
the window of a lesson is. They were tabs over the inspector, and the orthophoto settings unfolded inside the layers; Map >
Orthophoto settings..., the button of the terrain tools and the button in the layers open the window now.
- One list of the objects of the scenery: Windows > Scene Hierarchy, a plain list of the same nodes, is gone; Windows >
Scene opens the Scene tab (by layer and group, with the filter) and brings it forward when it lies behind the layers.
- One name for each thing, in the menus, the toolbar, the panels, the tutorial and F1: the orthophoto ("Ortofotomapa
(zdjęcia lotnicze z geoportal.gov.pl)" where it's introduced, "ortofotomapa" in the rest, for "zdjęcia lotnicze",
"ortofoto" and "zdjęcie"), the terrain model ("Teren z map (NMT)" for "Prawdziwy teren z map", "model terenu", "prawdziwy
teren", "Teren z NMT"), the plan tool ("Plan", the lesson "Correcting a curve" and the section of F1 "Plan of a curve"
before), the area fill (the terrain's "Fill" is "Area fill" as in the surroundings, with the icon of it, Water without).
The texts of the laying, whose panel is to be redone, are left as they are.
- The node bank: a model clicked with the select tool of the surroundings arms the insert tool with it (the click did
nothing before), the random model of a set is left off then. A model inserted where there's no ground under the cursor
stands at the height 0 where the cursor points, or in front of the camera when it points above the horizon, and the
status says where; it stood at the point the renderer last had under the cursor, out of sight. The search field of the
bank has no name beside it, which was cut to its first letter.
- The settings in one place: Editor settings holds the movement and the speed of the camera (as View > Camera speed), the
gizmo and the colours, the terrain made of the terrain model by itself (as in the layers and the download area) and the
maximum placement distance (as in Change history).
- F1 and the menus: Esc closes the window of the shortcuts, before anything else; the window stays in the work area as the
window of a lesson; the menus are opaque, the windows under them showed through.
- What the first steps left: with an empty scenery the panel in the middle of the view gives way to the inspector, which
says the same with the button of the lay tool and the first steps; it's drawn only while the inspector isn't seen. A
switch whose speed limits its diverging track alone shows that speed under its empty speed field ("The diverging track
40 km/h, the main one no limit"), read only; the field alone said no limit.
- Self-tests: the command bankpick, the expectations tool, window and selected, the cases c_1_bank_card_arms_insert and
c_2_esc_closes_shortcuts.
lang/editor_pl.po: the Polish of the new texts (the cards of the tools, the windows, the fields, the notices), the entries of
the texts renamed given their new English, those no longer used taken out, and the names unified in the Polish of the
orthophoto and of the terrain model.
|
||
|
|
ac5e735f91 |
feat(editor): the scenarios using a map and the tracks, events and memory cells they name in it
The last part of E3 (editor-tracks-domain.md §0 pkt 7, §3 "Indeks scenariuszy"): a change of the map mustn't take away what a scenario relies on. Read only, from the text of the files as the simulator reads it; nothing of the editor asks it yet (E4, E7). - The scenarios are the *.scn files of the scenery folder. A quick look at the include words of the files, each file once for all of them, tells which may reach the file of the map; those are read whole (sceneryText), their includes followed with the parameters of the templates, the terrain passed over where the scenario has its binary terrain. A scenario uses the map where the file of the map is among its files. - What the map defines: the tracks, the events and the memory cells of the statements of its files. What a scenario names in it: of the statements outside the files of the map, the tracks the trainsets start on (anywhere, a scenario being its own map too) and the vehicles standing on their own; the events called by multiple events, by event launchers and by the tracks of the scenario; the cells and tracks acted on by the events (updatevalues, getvalues, copyvalues and its source, whois, logvalues; switch, trackvel, trackbuckle), checked by their conditions (memcompare, trackoccupied, trackfree) and by the launchers; the tracks of the scenario's cells and isolated circuits; the events named after a track of the map, <track>:event1..., which the track calls. Each with what names it, the file and the line. The names as the parser makes them, A to Z small. - Not seen: the names the simulator makes (the tracks of the roads, the turntables), the scripts, the timetables, the commands the cells give the drivers, the random includes. Tests: U: data/project/index, a map of tracks, events and memory cells, some from a template included with parameters at an origin, and three scenarios: two using it (one through a file of its own) with their trainsets, vehicles, events, launchers, cells and isolated circuits, listed in full; the trainset on a track of the scenario, the names in comments, an event of none_ and a name of nothing left out; the scenario of another map with tracks of the same names not among them. The include tree read with the parameters and the placements; the words split as the parser splits them. |
||
|
|
f24714c6d6 |
feat(editor): the //$ lines of an old scenery taken into the project file when its map is first opened
Continues E3 (editor-tracks-domain.md §9 "Migracja", §10): what the //$ lines describe of the track geometry becomes the lines and the nodes of the domain where the domain lays it as the editor laid it; the rest is kept in the project file as it was written. The lines stay in the scenery files, untouched; the scenery files aren't written. - //$h, an alignment: a line between two nodes at its ends, its vertices where the design puts them (from the tangents of the ends for one, by the offsets for the first and the last of more), their radii, transitions and cants, the shape of the transitions, the origin as the chainage of the start, the speed as the highest of the class; a curve going on from the adjoining track as an end going on from the curvature and the cant of its node. Not a compound curve, two transitions with no arc between them, cant ramps of its own, a curve turning the longer way, a curve going on from a switch, a design kept for a part of its line, nor one the domain lays to a length 5 mm off the old one: kept as it was, with why. The free ends of two lines within 0.5 mm, running on from one another, join at a node (a turn of the headings over 1e-9 rad told). The record is kept whole in the project with the line it became: the points clicked, the old norms, the pieces and the fit have no place in the domain yet. - //$p, a grade line along such a line (its ends and length within 5 cm, either way): its breaks with their vertical curves as the breaks of the line, the heights of its ends as those of the nodes; not one with a break of no vertical curve, or along no line, or one the line can't be laid with. Kept whole too. - //$r switches (E5), //$k the kilometrage of the railway lines (the line's own chainage is the //$h origin), //$t the tracks fitted, //$w the tracks sharing a grade line, //$b the objects bound to the tracks (E6, the anchors), //$s the stations (E7): no place in the domain yet, kept as they were, a block a kind a file. //$c, //$o, //$z, what the editor keeps of itself, aren't taken. - The lines read as the editor reads them: the old letters of the marks under the new ones, the lines other tools put after the same marks (Rainsted's includes after //$r) left out. marked_files() finds the files of the map with their includes followed and the placement in effect at each; open_project() reads the project of the map, or makes it of the //$ lines and writes it where there's none. Tests: G: the sceneries of data/records/ made into a project: the alignment of clothoids a line within a millimetre of the old design along all of it, the one kept for a part of its line and the grade line along nothing kept with why, each other kind kept as the file has it and read back by editor_records as from the scenery, the camera, the orthophoto and the area left; written and read back the same. A map of data/project/migration (its tracks included at an origin) opened the first time: two alignments joined at a node in the world, the grade line of the second one its break and the heights of its ends, the one along the first refused for a break of no vertical curve, the compound curve kept; the scenery files byte for byte as they were; opened again, the file read and not made again. |
||
|
|
c912ed2ab1 |
feat(editor): the tracks the generator wrote kept by their checksums, a track changed by hand marking its line
Continues E3 (editor-tracks-domain.md §9, "Ręczna zmiana wygenerowanego węzła ... wykrywana po sumie kontrolnej"): the generated
section of the project file and what the scenery files hold of it now. Nothing of the editor writes the tracks yet (E4).
- generated: a record a track the generator wrote, its name, its line, the file it's written into and the FNV-1a checksum (64 bits)
of its text as the simulator reads it: the words joined by one blank, the comments left out, so the line ends and the blanks
another tool writes aren't a change; the switch track of a turnout kept by the main track of the turnout.
track l1_s11 line 1 file trasa/tory.scm sum 0123456789abcdef
switch t1 line 2 file trasa/tory.scm sum 00000000000000ff
hand 3
record_generated() puts the pieces of a line, or the switch track of a turnout, in the place of the ones the project had of it;
find_hand_changes() looks the names up in the text of the files now: a text of another checksum, or a track gone, or a file which
can't be read; mark_hand_changes() marks their lines changed by hand (hand <line>, kept by the file), may_overwrite() tells the
editor to leave them, until the line is written again by the editor (the author decided).
- editor/project/sceneryText: the text of the scenery files read as cParser and state_serializer read it, with no scene: the words
(blanks and semicolons between them, // and /* */ comments, the quotes), the node of a name and its words up to the end word of its
type, and the statements of a scenery with its includes followed relative to the scenery folder (the words of each file taken as
they're needed, the includes no deeper than 32), the parameters of a template in place of (p1)..., the placement of origin, rotate
and scale at each include, the terrain files passed over for a binary terrain. The scenario index and the migration read the files
with it.
Tests: U: two lines generated into one file among other nodes: as written nothing is changed, through the project file too; the speed
of a track of the second line edited: that line and that track told, marked changed by hand once, kept by the file, the first line
not; written again, not marked. The switch track of a turnout: its speed edited marks its main track. Blanks doubled, the line ends of
windows and comments inside a track aren't a change; a track taken away, a file which can't be read are. The node of a name found by
the words.
|
||
|
|
9c76001e9a |
feat(editor): the project file of the track geometry, one per map, of a schema of its own
The first part of E3 (editor-tracks-domain.md §9): the domain of the editor written next to the scenery, the .scn and .scm files
staying what the simulator reads. editor/project/projectFile reads and writes it, nothing else does; nothing of the editor uses it yet.
- <map>.eu07proj next to the file of the map, shared by the scenarios of the map; plain text, a line a record, the version of the
schema on the first line. Version 1:
eu07proj 1
next node 9 line 8 vertex 1 turnout 3
norms plk
area granica ch 4 -500 0 -100 0 -100 400 -500 400
lineprofile 91 en13803
class 1 vmax 80 vmin 0 traffic mixed track main load 5 features 0
node 3 at 300 101.2 0 heading 1 0 curvature 0 cant 0 grade 0.004 ends 3 1 end 1 2 start 1 4 start 1
line 1 from 1 to 3 class 1 chainage 0 transition clothoid ramp linear continues 0 0 turnout 0 profile tsi
vertex 2 at 0 800 radius 300 in 60 out 60 cant 40
grade 200 101.5 5000
end
turnouts
turnout 1 type Rz%2060E1-500-1:12 hand 1 direction 1 start 3 main 2 4 diverging 4 5 chainage 300 radii 0 500 cant 0
speeds 80 60 velocity -60 movable 0
end
anchors ... end kept for E6 as read, empty in version 1
generated ... end the tracks the generator wrote (the next commit)
legacy h trasa/tory.scm line 1 [why ...] / | <the //$ line> / end the //$ lines read when the map was first opened
The profile of the scenery, the areas and the lines by name; the classes of the lines, each one once, the lines naming theirs; the
nodes with all they hold, the ends in their order; the lines with their vertices, grade breaks, shapes, chainage, turnout and
profile of their own; the turnouts of E2b with their legs, their tracks and what they derive. Numbers in the shortest form which
reads back to the same double, names and files with %20 for a blank.
- Read: the lines laid between their nodes as read, then the diverging tracks laid by their turnouts off the main tracks, the nodes
and the turnouts as written; what refers to what checked (a line's ends held once by its nodes, the classes there, the turnouts and
their tracks each of the other); a file of a newer schema refused before anything of it is read, with the reason, as is one which
isn't a project file, has a record not of its version or a section not ended. Saved through a file next to it put in its place.
- The identifiers handed out are kept (next), so none is handed out again after a load, whatever was deleted before the save:
layout::network gets handed() and hand_out(), the turnouts' counter with them; nothing else of editor/layout changes.
Tests: G: a network edited by the model (a line deleted between two) written, read and written again: the same text, the lines laid
again the same to the bit as the model laid them; two turnouts, one against the line, and a line of a profile of its own: the same to
the bit, the diverging tracks too (the network as settle() leaves it: the model lays the diverging track of a turnout against the line
before the node at its start takes the grade of the line beyond it, 1e-16 off); the golden file of data/project/ read and written back
the same, with the line ends of windows too; the anchors kept as read. A newer schema, an empty file, not a project file, broken
records (a turnout whose track isn't its among them) refused cleanly. U: the identifiers after the last line is deleted, a save and
a load: the next line, its nodes and its vertices numbered past them.
|
||
|
|
b0f7744434 |
feat(editor): the switch tracks of the simulator made of the turnouts of the track geometry, the legs at their nodes to the bit
The generator (editor-tracks-domain.md §5, "Rozjazdy") makes a turnout one switch track entry TTrack::Load reads: the paths of its main and its diverging track, each from the start of the turnout. - Each path the pieces of its line as the generator cuts any line (within 0.5 mm of the elements, the rolls and the heights from the line), turned round where the main track runs against the turnout, written as pieces1/pieces2; the path itself the curve between their ends and headings for the versions which know only the path, or the one piece where one makes it. The ends of both paths are the numbers of the nodes of the legs, so the tracks on the other side of them meet them to the bit. - velocity as the speed rule gives it (the main limit for both where it's the lower, else the diverging one below 0), frogs, the movable nose and the blades of the type where it has them; the name <turnout_prefix><turnout>, t by default. - A track of a turnout isn't made as a line of its own; generate_all() makes the lines, then the turnouts. Tests (G): turnouts on a straight with a grade (a 1:12 to the left along the line, a 1:9 to the right against it, a 1:26.5 with a movable nose) and one bent outward into R 1200 m with 60 mm, written and read back: both paths from the start node, the main one to the end of the main track, the diverging one to its end, to the bit; the pieces as written, joined to the bit, each within 0.5 mm of its line both ways (the farthest 6e-6 mm: short arcs of one Bezier curve each); the radius of the bent diverging curve; the velocity, the movable nose and the frogs read back; the tracks of the lines on the other side of the legs ending there with the same numbers and rolls (of the other sign where they meet head on). The diverging track of Rz 60E1-2500-1:26,5 as the simulator draws it within the chord offsets of Id-4 (30 m chords, 41 to 49 mm in the middle): 45.0 mm all along, 130 km/h on it. Left for E5: the catalogue as a data file (now switch_design::catalogue() in code), the double, symmetric and secant switches, the bending exact everywhere (now table 11.8 for the curve of the basic switch, the rest of the diverging track bent with the main one, a main track on a transition taken at its mean curvature), the connection solver (crossovers, the spacing measured along). |
||
|
|
6f0b8be091 |
feat(editor): the edits E2a left: vertices, the grade line, the class and the profile of a line, a join from a curve, no new BLOCK
The rest of the list E2a left for E2b (editor-tracks-domain.md §8), commands of the domain model of the track geometry like the others: kept whole or refused with the reasons, one step to undo. - insert_vertex (after a vertex, or after the start, with its radius, transitions and cant, its id given) and remove_vertex. - set_grades: the breaks of the grade line with their heights and vertical radii; checked by the solver (overlapping vertical curves) and the norms. - set_line_class and set_line_profile: the class of a line (its speed, traffic, main or side track) and a profile of the norms of its own (the line's own wins over the areas, as norms::area_map has it); a chain of the norms doesn't run on into a line of another profile of its own. The tracks of a turnout take a class too, their speeds derived again. - join_ends from a free end in a curve (a line cut inside one): one curve where the tangents meet, going on from the curve at the end, its arc of the radius there with no transition (or, where that doesn't fit, a radius the norms prefer and a transition from the curvature of the end), the transition at the straight end as long as makes the curve begin right at the curved end (bisected to the bit), refused where both ends lie in curves or the curve would turn the other way. The original join and this one lay the new line the same way (add_joined). - edit_policy::no_new_block for old tracks (stage E6): an edit is refused by a BLOCK finding only where it adds one; one there before, of the same parameter on the same stretch (the elements within 1.5 m, the findings carry their element as points of the plan) and no worse, doesn't refuse; the same rule of the same turnout neither. The invariants refuse in any case. model(network) takes a network over as it is, the norms not asked. Tests: U: a vertex put in and another after it, both taken out, the line as it was; a grade break and its vertical curve, two overlapping and one of no radius refused; a class of 200 km/h refused on curves fine at 80, one of 60 kept; R 280 m at 80 km/h warned by PLK, not by the TSI as the line's own profile; a line joined to a free end in an arc going on from it with the transition the part taken away had, the track the same within a micrometre; both ends in curves refused; R 170 m laid by the TSI and judged by PLK: an edit refused when any BLOCK refuses, kept with no_new_block, a sharper curve and a cant past (R - 50) / 1.5 refused, a wider curve kept. P: 250 random edits of an old track breaking the norms (curves laid for 80 km/h judged at 120), seed 4242, with no_new_block: no BLOCK finding over all the network which wasn't there before, a refusal changing nothing, an undo exact; the random edits with turnouts put vertices into straight lines and take them out. |
||
|
|
4a3b36c204 |
feat(editor): the turnouts of the track geometry, laid into a line, moved, changed and taken out, their legs nodes
E2b (editor-tracks-domain.md §2, §4 "Rozjazd", §7, §8): a turnout is an aggregate of the domain model, laid from the catalogue the editor lays its switches from, its rules invariants which refuse. - layoutTurnout: the type of the catalogue (switch_design::catalogue(), Id-4) as the model lays it: R, 1:n, a, b, the main length, the lead and the parts of the diverging track, the movable nose, the blades; the ordinary switches whose diverging track leaves tangentially, the double, symmetric and secant ones refused with the reason (E5). The diverging track laid off the start along the turnout: on a straight the curve of the type; bent with the main track the curve of the basic switch of the radius of table 11.8 (switch_curve::bent_radius), over the length which keeps its turn off the main track, so the angle of the frog stays 1:n, the lead and the straight through the frog bent along with the main track; the cant of the main track all along it, the grade of its start. The speeds: the diverging one by switch_curve::branch_speed (the rule the editor writes), the main one the line's, bent no faster than the deficiency of the frog lets it; the velocity written by the same rule as the editor's. - The turnout: its type, hand, direction along the line, its start, the ends of its two tracks (nodes), its main and diverging track (lines it owns), derived: the kilometrage of its start, the bending, the cant, the speeds. The network keeps the turnouts with the lines and the nodes, in the snapshots of undo and in the transactions; settle() has a turnout whose main track or start changed lay its diverging track again, move the node at its end and lay again the lines going on from there. - The nodes: three ends at the start of a turnout, its two tracks on one side of it; the start of a diverging track tells its node nothing (the node keeps the curvature of the main track) and runs on into no line, the end of one sets its node. - check(): the turnouts whose tracks or legs are touched, their invariants (the legs, the tracks, the main track as long as the type) and the rules of Q2 and 11.4 through switch_curve::check (the curvature of each track of one sign, KZW II refused; the cant the same over it; the ends of the ramps at its ends or 6 m off it), a switch of 1:9.403 or steeper than 1:9 bent in a main track refused (the model knows a main track from a side one, where the editor only warns), table 11.9 and a transition under it as warnings. The norms of the E1 module with the switch context: the elements of a turnout track are a connection of tracks of their frog (fixed or movable nose: the deficiency of tab. 9.7), bent or not (the cant of tab. 9.6), at its speeds; the chain of the line runs through the main track, the element cut by a turnout open. BLOCK findings are kept apart from the broken invariants (verdict::blocks). - The commands: insert a turnout at a chainage of a line (cut at its legs, the part between them its main track), move it along its line (the lines on both sides and its main track one line again, cut anew, the ids kept, a line going on from the end of its diverging track carried with it), change its type or hand, remove it (the line one again where it can be: the merge laid and kept only where it's the same track within a micrometre). The tracks of a turnout aren't split, deleted or edited as lines; a line is joined to the free side of a turnout's start, or to the end of its diverging track from a straight (the curvature stepping there). Tests: U: the types laid and refused; the legs on a straight against the catalogue for four types both hands both ways (the main track a + b, the tangent of the diverging end meeting the main track at R tan(a/2), Id-4's a within half a millimetre, the angle 1:n, the speeds of table 11.2); Rz 60E1-500-1:12 bent outward and inward into R 1200 m with 60 mm (r" 857.8 m and 352.7 m, 60 km/h, the angle of the frog kept, the cant over it); refusals: KZW II, a ramp under it and 3 m off it, a 1:7.5 bent in a main track (laid in a side track), no type, no hand, no room; moved, changed, turned, taken out with the line laid again within a micrometre, each a step to undo; a line from the diverging end carried along. P: 250 random edits with turnouts each, seeds 20261124, 31 and 977 (laid, moved, changed, taken out, with vertices moved and set, splits, joins, deletions, undo, redo): the invariants after each (the legs and the nodes whole, three ends only at a start, the velocity by the rule), no BLOCK, a refusal changing nothing, an undo exact. |
||
|
|
31dc959cec |
feat(editor): the speed of the diverging track of a switch, one rule for the editor and the domain model
The formula Q2 gave the editor (editor_mode::branch_speed_of) taken out into a pure function of the switch curve module, which the domain model of the track geometry (editor/layout, E2b) calls for its turnouts too, so the two write the same speed. - switch_curve::branch_speed(): of the basic switch of R and 1:n, its main track bent by table 11.8, the cant with its sign toward the side the diverging track leaves to: formula 9.9 with the normal deficiency of the frog (table 9.7), rounded down to the steps of the speed limits, no more than table 11.2 gives the basic switch. It reports the radius, the cant into the turn, the deficiency, the formula, the rounded speed and the table, which the editor's message tells. - switch_curve::basic_speed(): table 11.2, moved from editor_track::diverging_speed(), which now returns it. - switch_curve::written_velocity(): the one velocity a switch keeps, the main limit for both where it's the lower, else the diverging one below 0; write_switch_speed() calls it. - speed_check::suggested() inline in editorSpeed.hpp, so the switch curve module takes it in the unit tests, which don't build the checks of the speed. The editor computes the same numbers the same way: the basic radius and the bent main radius as before (bent only where the type is known), the cant toward the diverging side the same product, its sign flipped by the bent radius as before (a multiplication by -1, exact), then the same calls in the same order. tests/unit/test_switch_curve.cpp unchanged and passing. Tests (U): the examples of Q2 through branch_speed (Rz 60E1-500-1:12 outward in R 1200 m with 60 mm 60 km/h, inward 60 by the table; Rz 60E1-190-1:9 in R 600 m with 60 mm 30 and 40 km/h), the table of the basic switches, a movable nose kept to 130 km/h, a diverging track bent straight, the editor's table the same, the velocity written. |
||
|
|
cd20d8ec94 |
feat(editor): the first steps in the inspector, one way to start, the line laid summed up
The first steps of the editor, after the first-run pass at 1920x1080 and 1366x768 (P1 of the plan of the
editor's interface):
- The tutorial no longer opens by itself as a window over the middle of the view (at 1366x768 over all
of it, its close button under the tool row). With nothing selected, the inspector shows a compact
"First steps" card: the lesson of the tool in use, its steps to try ticked as they're reached, the
links "Show the lesson", "The camera" (the first lesson) and "Hide" (the setting first_steps, which
the checkbox of the window now names "Show the first steps in the inspector"). Opened, the window of
the lesson goes into the corner of the view by the inspector, below the rows of the menu and the
tools; moved, it stays between them and the status line, as high as that room at most, the lesson
scrolled inside. Its close button is always within reach.
- The lesson follows the tool: the select tool of Tracks opens "Laying track" until its steps are done,
so a new scenery opened in Tracks starts there, not with the camera, which stays the first page and a
link of the card.
- An empty scenery in Tracks with nothing selected: "The scenery has no tracks yet" and one highlighted
button, "Lay the first track (L)"; the tutorial is the card under it, a "Tutorial" link when the card
is hidden. With tracks, the select tool keeps its hints and a plain "Lay a track (L)".
- "Without terrain", the answer to the question of the terrain at the first L, turns off the terrain
made of the terrain model by itself: under the tracks as they're laid (the checkbox of the layers) and
around the camera within the download area (the checkbox of the terrain panel), stops putting the
squares of the area into the cache, a square on its way giving way at once, and drops the squares
waiting. Kept on, the model went on being asked for, and offline the log filled with "NMT square ...
not fetched: WinHTTP error"; now nothing is asked for after the answer.
"Load the terrain" turns both on again. The squares of the area go to the cache, and the aerial photos
ask for the model to lie on, only while some terrain is made of the model by itself. The question
stands in the middle of the view, the window of the lesson waiting meanwhile. The warning of no ground
under the mouse shows only while the pointer is over the view and the terrain is to be there.
- The tooltip of the line being laid names the panel the rest of its warnings are in ("listed in the
tool options"): the translation of the text before said "in the panel on the right", the panel is on
the left.
- While the pointer is over a panel, the line being laid stays as it was: the point of the cursor, the
free end it snaps to and its height aren't taken from where the pointer is under the panel, which
added a leg there with curves and warnings of its own. A drag begun in the view goes on over a panel.
- After Enter the inspector sums up the line laid: its tracks, length and curves, those below the norms
in orange, and what comes next, "A switch (T)" and "Save (Ctrl+S)". It stays while the last track is
the selection the laying left; a click on a track shows the sheet of that track. The switch tool with
nothing clicked shows the same, not the sheet of the last track laid.
- A switch the switch tool refuses is told in its panel and by the cursor, no longer in the status line
and the layers window as well, where it stayed after the next switch was laid. Why a branch couldn't
lead into a free end goes into the panel with the rest; a switch laid takes the note by the cursor
away.
- The panel of the lay tool fits one screen at 1366x768: what the tool is for is the tooltip of the
title of its card, the paragraph of the radius at the bends the tooltip of its "?" (which still opens
the lesson), "This speed also on from a track with a speed of its own" is under More settings; the
mode, the speed and the height stay up front.
- The layout made on the first start: the side columns 22% of the width, at least 300 px, at most the
400 and 460 px they had and 30%; at 1366 px the view has about 766 px instead of 557. The tool options
take 60% of the left column, and in a window under 800 px high the layers are a tab beside them, the
tool options shown, so the panel of a tool has the whole column. The line of the keys of the
surroundings goes on under itself at the edge of the panel. Layouts kept in imgui.ini are left as they
are.
- The names of the period of the day, the season and the weather in Weather and time, and the type of a
node in the inspector of the surroundings, go through the translations ("(day)", "(autumn)",
"(scattered)", "Typ: track" before). The degree sign of the air temperature is written as its UTF-8
bytes: CMakeLists.txt sets COMPILE_OPTIONS of eu07 and eu07_core after add_compile_options("/utf-8"),
which drops /utf-8, so MSVC writes the "°" of a literal as the single byte 0xB0 of the ANSI code page,
not UTF-8, and ImGui drew '?'.
- Self-tests: the expectations statuslacks, refusal, statusline, laycursor and terrain, the command
nmtquestion, and the cases fs_1_preview_over_panel, fs_2_switch_refusal_cleared and
fs_3_without_terrain.
lang/editor_pl.po: the Polish of the new texts (the card of the first steps, the summary of the line laid,
"Lay the first track", the names of the periods, seasons and weathers and of the node types), the entries
of the texts replaced given their new English ("Show the first steps in the inspector", "and %zu more,
listed in the tool options", "Lay the first track (L)" in place of "Or start with:"), and "(do
transmisji)" in place of the English "(stream)" of the drawn cursor.
|
||
|
|
a1f1ba4262 |
lang(editor): Polish for the strings of the switch rules and the norms of the track geometry
62 entries the stages of the track editing added without a translation: the crossover taken out whole (#450), the refusals and the speed of the switches (#454), the Norms tab and its report (#456), in the terms of ST-T1-A6 (niedomiar, nadmiar przechyłki). Also "Other switches of a connection##connectionsecond": field_row looks the label up with its id, which the file had only without it. |
||
|
|
e53fbcfe55 |
feat(editor): the tracks of the simulator made of the lines of the track geometry, within half a millimetre
The last part of E2a (editor-tracks-domain.md §3 and §5): the generator, the layer between the domain and the simulator. A line is cut into cubic Bezier pieces, each one a track entry of the text TTrack::Load reads. Nothing of the editor writes them yet. - The pieces end at the elements, at the ends of the vertical curves and of the cant ramps; each one halved until the curve as the simulator draws it lies within 0.5 mm of the line, in the plan and in the height, and its cant within 2 mm of the line where the simulator turns the roll evenly; none longer than a track may be (400 m), none shorter than 10 cm. The handles of an arc are its own, 4/3 tan(turn / 4) R; a transition takes the handles which give the curve the curvatures of the line at its ends (G2 Hermite, by Newton's method, those of an arc where it finds none near them); a cubic parabola is the cubic Bezier curve it is, cut by its blossom; a straight of an even grade has no control vectors, as the simulator draws it. A piece TTrack would take for a straight (its 2 cm check of the control vector) is one, close enough or halved. - The rolls and the heights come from the functions of the line, the radius from the element: an arc's own, the sharpest over a transition, 0 on a straight. A piece ends at a node with the numbers of the node, its place, its heading and its cant, so the tracks on both sides of it have the same numbers to the bit; the numbers are written in the shortest form which reads back to the same double. - The names come from the identifiers: <prefix><line>_<element><piece>, the element the straight leading to a vertex (s7, se to the end) or the transition in, the arc or the transition out of a vertex (v7i, v7a, v7o); a change of a curve leaves the names of the pieces of the others. - The joints of old tracks as hard points of the pieces, keeping their names and events, are E6 (§10): generator_options has their place, a line given any is refused rather than made without them. Tests: the pieces of lines of clothoids, Bloss curves and cubic parabolas, of R 190 m and of 5 km with vertical curves, each measured both ways (the points of the curve set square onto the line, and the points of the line against the nearest of the curve, searched on its own): within 1 mm, the farthest 0.35 mm (0.45 mm with Bloss curves). G: a line split on a straight and in an arc, its tracks written and read back by TTrack::Load (the E0 seam): the ends at the nodes and between the pieces the same to the bit on both sides, the rolls and the headings of the control vectors too, the curve within 1 mm of the line, the radius of the element; a line laid the other way through its nodes; the names unique and kept by a change of another curve; the E6 hook refusing. |
||
|
|
555b77b11d |
feat(editor): the nodes of the track geometry and the commands editing the lines, kept whole or refused, one step to undo
Continues E2 (editor-tracks-domain.md §4 "Edycja = polecenie", §8): the lines meet at nodes, and every edit is a command which proposes a new state, has what depends on it laid again, is checked and kept, or refused with its reasons and nothing changed. - layoutNetwork: the node, its place (the only coordinates of the ends of the lines), the heading, the curvature, the cant and the grade, and the ends of the lines meeting there, each with its sense along the heading; the network of the nodes and the lines with the profiles of the norms by place and the identifiers handed out once, never again (an undone line made again is a new one). A transaction keeps each line and node the first time it touches it, so a change is rolled back whole or recorded. - settle(): the lines touched laid again; the nodes take the values of their ends (a free end follows its line, a node keeps the curvature and the cant a line going on from it reads), a line going on from a node whose curve changed is laid again. - check(): the invariants of the touched lines and nodes: laid, at their nodes, two ends at most on the two sides of a node (more is a turnout, E5), the heading the same within 1e-9 rad, the cant within 0.5 mm, the grade within the 2 per mille that needs no rounding; and the norms along the chains through the touched lines (the lines running on through the nodes as one line, the elements running on alike across a node as one, a jump of the curvature at a node a step of the deficiency the profile judges): BLOCK refuses, WARN and PREFER are told as notices. - layoutCommands: create a line between two new nodes; move a vertex; set its radius, transitions or cant; split a line at a chainage (the track kept as it was: on a straight, in an arc, in a clothoid with a straight ramp, the parts going on from the new node at its curvature and cant; refused inside a vertical curve and inside a Bloss or cubic parabola transition); join two free ends with a line solved between them (a straight, a curve where the tangents meet, or two curves, the largest radius which fits with the cant and the transitions the norms prefer, a grade line meeting the grades of the ends); delete a line (a node left with no end goes). The model keeps the network and the steps: undo and redo restore the snapshots of the lines and nodes a command touched, one step a command. Tests: the cases of each command, a refusal (a radius under the least, a cant over the greatest, curves overlapping, transitions too long) leaving the state as it was, a WARN radius kept with its notice, undo and redo, the track the same along a line split on a straight, in an arc and in a clothoid, a middle part deleted and joined again both ways round, a straight joining two ends on one straight. P: 300 random edits each with the seeds 20261123, 7 and 450 (moved vertices, new radii, transitions and cants, splits, joins, deletions, undo, redo): after each the invariants checked on their own (each element running on from the last, the cant running on, the ends of the lines at their nodes to the bit, the heading, the cant and the grade running on through the nodes) and no BLOCK along any chain; a refused command leaves the state as it was, an undo gives the state before the command. |
||
|
|
f83afa8a96 |
feat(editor): the elements and the line of the track geometry, a module of their own
The first part of E2 (editor-tracks-domain.md §2 - §4): the geometry of a line computed in one place, editor/layout, standing on its own with no scene, no tracks and no user interface. Nothing of the editor uses it yet; the route design keeps its own solver. - layoutElements: the elements of a line, the straight, the arc, the clothoid (the curvature changing evenly, from any curvature to any other), the Bloss curve (3t^2 - 2t^3) and the cubic parabola (y = x^3 / 6RL by the abscissa, the length along it its own): the length, the curvature along, the point and the heading at a distance, a point offset from the axis, the shift of the arc. The local forms of the clothoid and the cubic parabola and the blossom of a Bezier curve are the ones of editorAlignment.cpp, moved here word for word; the alignment calls them, so the two agree to the bit and its tests run as before. - layoutLine: the line as a tangent polygon between the points of its two end nodes (it has no coordinates of its own there), its vertices with the radius, the transitions in and out and the cant, a grade line of breaks with their vertical curves, the shape of the transitions and of the cant ramps (linear or Bloss). solve() lays it: each curve fitted in the frame of its tangent point from its deflection (the arc what the transitions leave of it), the straights what the tangents leave of the sides, every element placed from the polygon so nothing drifts; the cant held along the arcs, ramped along the transitions, a step refused; the heights and the grades by the breaks. An end can go on from the curvature and the cant its node holds (a line split inside a curve): its curve begins right at the node. What can't be laid is an error with the vertex and the metres: curves overlapping, a curve starting before the start, transitions turning more than the tangents, a cant step, a vertical curve past the end. - described(): the line as the norms module reads it (elements, cant points, grade elements), a Bloss ramp seen by eight points so its steeper middle counts. preferred_curve(): the cant and the transition length the profile prefers for a radius at the line class, the deficiency, the excess and the greatest cant of PREFER, else of WARN, the transitions long enough for dD/ds, dD/dt and dI/dt. - norms::line_class compares by its values (operator==), the line keeping it compares whole. Tests (U): the clothoid, the cubic parabola, the Bloss curve and the arc against the series of the textbooks (the end point, the length of the parabola, the shift: L^2/24R and L^2/40R), the point as the integral of the heading, the circles alongside an arc, the curve of a vertex by its tangent length (R + p) tan(a/2) + x_m. |
||
|
|
38f90387c4 |
feat(editor): the norms checked on the tracks laid, read only: a Norms tab of the track analysis and its report
The second half of E1: what the tracks of a scenery are against a profile of the norms, listed. Nothing of the tracks is changed. - editor/editorNormsReport: a line of paths sampled a metre apart, two samples at each joint, into what the norms read a line from: the plan, the curvature signed by the turn, the cant on the base of 1500 mm (as the simulator takes the rolls) signed by the side it leans to as the line runs, the grade, the speed of each path (a switch's for its diverging track alone too), and what the path is a part of (a switch, its diverging track, a curved switch, a movable frog, a crossing). The line described, checked, and each finding set back on its path with a point of it; its message, "cant ramp 3.00 mm/m, PLK allows at most 2.50 mm/m (tab. 9.12)", "break of the grade with no vertical curve, PLK asks for a radius of at least 2500 m (tab. 10.2)", through STR_C; the text of the report: the class, the elements, the cant, the grade line and the findings of each line. - The Norms tab of the track window, under More beside Speed and Joints, no key; its window is ###trackanalysis, as theirs. The line through the selected path (run_route, as the speed check walks it) or the whole scenery: the lines through the plain tracks, then each path of a switch none of them ran along, checked with the line it lies in and its own findings kept, a place two lines run through listed once. The profile (PLK by default) and the class of the line folded under a line saying it: the line speed for the tracks with none of their own (on by default: the speed of each track), the slow trains (tab. 8.1 by default), the traffic, main track or siding, the load, at a platform. The results in the table of the speed check and the joints, the worst first, coloured by the tier, the values above the recommended ones on a tick; a click on a row shows the place, the hard limits and the warnings are marked in the view. The icon is drawn into its own cell of editor_icons.png only (the generator has it): the sheet drawn again with this Pillow differs in other cells. - Self-test: normsreport <file> [scope] [plk|tsi|en|ch] [km/h] writes the report to the file; expect findings <tier> <least> <most>; the case e1_norms_report checks the curves k0..k3 of the fixture at 60 km/h against PLK and the whole scenery against the TSI. - Golden: data/norms/line.scn, a line of 14 tracks written by make_line.py there (curves with and without transitions, cant on and off a curve and along a straight, reverse curves 10 m apart, short straights, a grade with breaks), and its report against the four profiles in data/norms/line_report.txt; EU07_UNIT_TESTS_UPDATE_GOLDEN=1 writes it anew. A test lays a canted corner with the alignment of the editor and finds the samples leaning into it, both turns and run both ways, I = Deq - D. alignment::limits stays as the laying tools use it. Where its values differ from PLK P0: - unbalanced 0.6 m/s2 is I 92 mm on the 1500 mm base; P0 110 mm (P1 130) on the running lines, 80 on the sidings; - ramp_factor 10, a ramp of 1:(10 V), 1 mm/m at 100 km/h and 2.5 mm/m at 40 km/h, has no counterpart: P0 1.6 mm/m at any speed; - jerk 0.3 m/s3 is dI/dt 46 mm/s; P0 55 mm/s; - vertical_factor 0.4 V^2 and vertical_min 2000 m; P0 max(0.77 V^2, 5000 m) (P1 max(0.35 V^2, 5000), P2 max(0.25 V^2, 2000)); - arc_min 20 m and arc_min_factor 0.4 V; P0 max(0.35 V, 30 m) up to 120 km/h, 0.40 V up to 200 km/h, also for the straights, where tangent_min_time is 0; - the same: cant_max 150 mm (P0 = P1 = P2 on ballast), cant_rate 35 mm/s (P0 of tab. 9.13), the base of 1500 mm. |
||
|
|
db5a171ccd |
feat(editor): the norms of the track geometry, a module of their own: the profiles as tables, one engine
Stage E1 of editor-tracks-domain.md (§3, §6): the norms stand on their own in editor/norms, with no scene, no tracks and no user interface, so they are tested whole in tests/unit. Nothing of the editor uses them yet but the report of the next commit; alignment::limits stays as the laying tools use it. - The profiles are tables of rows (normsTables.cpp). A row holds the limits of PREFER / WARN / BLOCK of one parameter where its conditions hold (a band of the speed, of the radius or of the load, main or side track, the traffic, a switch and its frog, a crossing, an expansion device, a platform, a station track, ballastless track, crest or sag), with the table or the paragraph of its document. Where several rows hold the strictest limit of each tier counts. A cell can be unconfirmed: it warns, never blocks. - PLK, ST-T1-A6 v1.0: P0 PREFER, P1 WARN, P2 BLOCK; tab. 8.1, 9.1, 9.2, 9.6 - 9.8, 9.10, 9.12 - 9.16, 10.1, 10.2, formula 9.8. - TSI only, Reg. 1299/2014 consolidated 28.9.2023: BLOCK; 4.2.3.3 - 4.2.3.5, 4.2.4.2 - 4.2.4.4. - EN 13803-1:2010 5.2.1 - 5.2.5: normal WARN, exceptional BLOCK. - CH, AB-EBV AB 17 (Normalspur, 1.7.2024): Grenzwert im Normalfall WARN, maximaler Grenzwert BLOCK. - In every profile the global hard limits of §6.3: the TSI rows and the cant gradient of 2.5 mm/m (EN 13803-1 5.2.5, the twist). - The line class: Vmax, Vmin of the slow trains (by tab. 8.1 when not given), passenger / mixed / freight, main or side track, the load, and what holds along the line (platform, station, ballastless, suburban, tilting). - One engine (normsEngine.cpp) over a line of elements (straights, transitions, arcs, the curvature changing evenly along each), its cant (points, a step being two at one chainage) and its grade line: I at Vmax and E at Vmin; dI/dt along the transitions and the ramps; ΔI at every jump of the curvature or of the cant, the jumps closer than the intermediate length of the profile (tab. 9.16) taken together while the deficiency keeps changing one way (9.11 pkt 8 - 13); dD/ds and dD/dt along the ramps, a step of the cant as its twist on the 5 m base; the lengths of the straights, arcs and transitions and the shift of the arc; R; D with (R - 50) / 1.5 and the least cant; Rv and the breaks of the grade over 2 per mille; the held grades. A finding names the parameter, the value, the limit, the tier, the profile, the source, confirmed or not, hard or not, and the chainage. The module makes no text, its users write the messages. - Areas (§6.4): the default profile of the scenery, areas outlined in the plan, lines by name (a line's own wins). An element with its ends under two profiles is checked against both, the worse kept (the stricter one); an arc across a boundary is a warning. - describe() reads a line from samples along it (the curvature, the cant and the grade simplified by Douglas and Peucker), with a precision of 0.2 % for the values measured on it. - The formulas of ST-T1-A6 9.1 - 9.10: Deq, Dreg, I, E, Dmin, Dmax, Rmin, V. The sources, and what they gave: - The cells of ST-T1-A6 spanning two or three columns (tab. 9.1, 9.6, 9.7, 9.13 - 9.15, 10.1, 10.2; §6.5 pkt 4) were read on the pages of the PDF. Tab. 9.15 has for the connections of tracks P0 = P1 = 80 mm at 100 < V <= 160 and 60 mm at 160 < V <= 200, P2 160 - 0.35 V; the table of §6.2 has P1 = 160 - 0.35 V there. Tab. 9.1 has P1 = P0 (one cell), not "-". - TSI tab. 8 (§6.5 pkt 3): the 153 mm spans both columns up to 300 km/h, 100 mm only above 300 km/h. - Unconfirmed, warning only: tab. 9.8, 5 < q <= 10, P0 95 mm, and tab. 9.7, movable frog 230 < V <= 250, P2 110 mm (as printed, out of line with the rows around them); EN 13803-2:2006+A1:2009 7.1.3, ΔI of the plain line 50 / 40 / 30 mm, read from a garbled preview. - Not there: ST-T1-A6 tab. 9.4 (a picture); EN 13803-1 dD/dt, dI/dt, ΔI in S&C, element lengths, Rv and grades (beyond the part of the standard published as its preview); AB-EBV a limit of the grade of a line, the least cant, the table of the buffer locking of 5.4.2; the TSI has no dD/ds, dD/dt nor dI/dt. DB (Ril 800.0110) is left out: it isn't published, its values are known from secondary sources only. - Simplified: the (R - 50) / 1.5 of the TSI holds for every R < 305 m of mixed and freight traffic, leaving out its condition of a ramp steeper than 1 mm/m; the intermediate element of tab. 9.16 between transitions is the one of tab. 9.1 at P2 (tab. 9.10 at P2 would do there); a switch has a fixed frog unless the track says it moves; the track is ballasted unless the class says not. Tests: test_norms_tables.cpp, every value of the PLK tables and of the TSI with its table in the name of the test, the edges of the bands (a speed on the boundary, R 300, 250 and 200 m), some of EN and AB-EBV; test_norms_engine.cpp, the examples of ST-T1-A6 (Z1-1, Z1-2, załącznik 2, the ramps of Z3-2 and Z3-3), I at Vmax and E at Vmin, ΔI of arcs turning alike and the other way, taken together over a short straight or not, dD/ds, dD/dt, a step of the cant, dI/dt, the lengths, the vertical curves, the areas and the boundary, describe(). |
||
|
|
e27d3b7e73 |
test(editor): golden round trips of the tracks and of the //$ lines, the cant at the joints
The safety net of the track editor before its domain model changes (E0 of
editor-tracks-tests.md): what the editor reads from the scenery files and
writes back is read, written and read again in tests/unit, with no game data.
Tracks (test_track_text.cpp, data/tracks/). Entries written the way the game
writes them, read by TTrack::Load() and written by export_as_text(), come out
byte for byte the same, and read again give the same track field by field:
plain tracks with all their attributes (events, speed, isolated, overhead,
vradius, rail profile, friction cell), a curve with cant, radius, uneven,
buckle, cwr and sleeper models, a bridge, switches with trackbed, frogs,
movable nose, blades, uneven of both paths and timbers, a turntable, paths of
pieces, the speeds +40, -40, 0.5, 0 and none of tracks, switches and
turntables, a river, a tributary, a road and a crossing. What the game writes
otherwise than given is checked as it is (table as turn, mountain as
mountains, the length of the path, a switch heard from 10 m, the events in
order, names in lower case, model paths with forward slashes, the texture
length, rolls as floats, no overhead and no vradius left out).
The seam: TTrack built from text with no scene. The engine stubs of the tests
had none of it, so the tests link the few sources reading and writing a track
takes (world/Track.cpp, Segment.cpp, TrackUneven.cpp, MemCell.cpp,
scene/scenenode.cpp, utilities/Timer.cpp, rendering/geometrybank.cpp) and
track_stubs.cpp stands in for the rest: a renderer keeping the materials by
their names, and the scene, events, vehicles and the geometry of the rails,
which reading and writing never reach and which stop the test with their name
if one does. It tests the game's own Load() and export, where a parser of its
own would have meant rewriting Load(), and changes no code of the game. The
stub of basic_node::radius_() goes, scenenode.cpp brings the real one. The
rails don't buckle in the tests (TrackBuckle.cpp needs the environment), the
buckle declared is read and written either way; material names go through a
stand-in, the game's material manager isn't tested here.
The //$ lines (test_editor_records.cpp, data/records/). Their readers and
writers were members of editor_mode, srk_tool and the stores, with the scene
around them; they move as they were into editor/editorRecords.cpp, the one
place each kind is read and written, which the stores call (and which the
migration to the project file of E3 will need apart anyway). The methods of
scene::layer_context move into scene/scenelayercontext.cpp so it links alone.
Each kind, h r k p t w b s c o z, read from golden lines and written back comes
out the same, in the coordinates of the file and of a file placed at an
origin; //$e, the descriptions of the templates, read and saved by
editor_includes in a template in a scratch folder, leaves the file as it was.
Cant (test_cant.cpp). The paths an alignment lays roll by asin(cant/gauge),
signed with the turn, back to the cant of the line at every end; a curve the
other way rolls the other way. At a joint editor_track::match_rolls() gives
the joined track the roll for the travel across it, turned where the paths
face or stand back to back, and the track written keeps it. The inspector's
own conversion on 1500 mm stays in its lambdas here; named, as
editor_mode::cant_of_roll()/roll_of_cant(), it comes with the quick fixes.
Known bugs found, tests of the change each (doctest::should_fail, passing
until fixed, then reported to drop the decorator), data/tracks/known_lost.scn:
- angle1/angle2 are read and dropped: not written back.
- fouling1/fouling2 are read and dropped: not written back.
- name@circuit: the circuit is taken out of the name with the letter before
the @ ("tor1@iso1" becomes track "tor"; substr(0, i - 1)).
- the attributes of the entry (gauge, friction, texture sizes, speed...) are
written to 6 significant digits, a float has 9: more digits are lost on the
first save.
None in the //$ lines.
Unit tests: 957 cases before, 974 after, all passing.
|
||
|
|
c7afa3ca10 |
fix(editor): a switch laid gets the speed of its diverging track, one breaking a hard rule of ST-T1-A6 isn't laid
- Every switch laid writes the speed of its diverging track (`velocity`): the switch tool on a straight, into a curve, from a free end and linked, a double switch, the switches of a slip, a switch given another template of the catalogue, and a switch moved along the curve it's bent into. A switch of the catalogue had no limit before, one copied from a switch of the scenery kept that one's, one laid without a track had the laying speed on both its tracks. The limit is for the diverging track alone (`velocity -V`); the own limit of the track it goes into stays for both where it's the lower. The switch tool says the speed and what gives it. - The speed is formula 9.9 of PKP PLK ST-T1-A6 the other way round, V = sqrt((I + D) r / 11.8), with the normal cant deficiency of the frog of table 9.7 (110 mm a fixed frog, 130 mm a movable nose), rounded down to the steps of the speed limits and no more than table 11.2 gives the basic switch. For the fixed frogs the formula gives table 11.2 itself (190 40, 300 50, 500 60, 760 80, 1200 100 km/h); the 2500-1:26.5 with a movable nose stays 130. A switch bent into a curve takes the radius of its diverging track from table 11.8 (one-sided r" = (Rr - t^2)/(R + r), two-sided (Rr + t^2)/(R - r)) and the cant of the line with its sign: leaning against the diverging track it takes speed away, where the speed check counted it as helping. Rz 60E1-190-1:9 bent out of the curve R 600 m with 60 mm: 30 km/h, not 40; the 60E1-500-1:12 of the review, out of R 1200 m with 60 mm: 60 km/h at its fixed frog (54 at I = 100 mm, the 0.65 m/s2 the editor took), not 107. - A switch breaking a hard rule isn't laid, the tracks left as they were, and the switch tool says why, with the value, the limit and the paragraph: the cant changing within it (11.4 pkt 7), a cant ramp ending within it or nearer than 6 m (9.6 pkt 16-17; one ending right at an end of the switch is let be, as the snapping of the start offers it), a double switch, a slip or a crossing bent (11.4 pkt 4), the curvature of its diverging or its main track turning from one side to the other (9.7 pkt 12, KZW II). They were warnings shown after the switch was laid, and on a straight the cant wasn't looked at at all. The line is looked at 10 m past the ends of the curve or the straight too, so the ramp on the straight before a curve counts. The previews show the refusals. - A switch moved along its straight or the curve it's bent into, a double switch moved along its straight, and a switch given another template go through the same checks; one breaking a rule stays as it is. - Warnings still: 1:9.403 and steeper than 1:9 bent (11.4 pkt 4c-d), a rule of the running and the main tracks, which the editor doesn't tell from the side ones, as the warning now says; the limits of table 11.9 and a cant over 100 mm in a bent switch (table 9.6), as before. Tests: unit tests of tables 11.8 and 11.9 (the least main radius bends the diverging track to the least radius the table gives), table 9.7, the speeds of table 11.2 by formula 9.9, the speed of a bent switch with the cant with its sign (the example of the review), the cant over a switch on a straight and a double switch bent. Editor cases `q2_1_switch_speed`, `q2_2_switch_refusals` and `q2_3_switch_move`, with `expect status` (the status of the switch tool) and `expect steps` (the undo steps), the fixture with a straight taking a cant on and a compound curve without cant. All pass; with the changes of the editor reverted all three fail. |
||
|
|
02c36b33cf |
feat(editor): the track tool panels keep their fields, results and buttons within the panel
- The card of the tool: after a long gesture the action goes under it, at its indent, when what is left of the row is narrower than 8 font sizes or the longest word of the action. It was squeezed into a sliver and broken in the middle of its words. - A click on the title row of the card folds it to that row (icon, name, family, key, and a small triangle marker) and opens it again. One flag for all the tools, kept with the editor settings (`track_card_folded` in eu07_editor.ini), open by default: the card took 250-300 px at the top of every tool and repeats the hint bar of the view. - The grade labels of the vertical profile, on the graph and in the view, write the per mille as the panel does (the translated "per mille", the per mille sign in Polish), not "o/oo". - The track analysis window: the thresholds of the speed check and of the joints keep to their widest name and a field of 10 font sizes where the window is wider than that, as docked across the bottom (`begin_fields_fitted`). The results are tables with each column as wide as what is in it: the speed check with its column names kept at the top as the list scrolls, the joints with the kind, the value and the two tracks next to each other. A click on a row shows it as before. - `same_line_if_fits` puts the next button beside the one before only when it fits in what is left of the line, at the start of the next line otherwise. Used where the route design puts buttons side by side, for "Forget the design" in the profile panel, which was cut off at the edge, and for the buttons of a switch in the inspector. - The laying options: the speed, the curve radius and the longest path are fields with the name on the left in two columns (`begin_fields`/`field_row`), as in the inspector, the route and the profile, the chips of the quick values under them. The segmented choices give the short names less of the room when a long one doesn't fit in its even share, and go on in a second bar when they don't fit side by side: "Through the clicked points" overflowed its third of the bar. |
||
|
|
690c913ef0 |
test(editor): self-test scripts that fail, a runner, and a case for each fix of the track editing
The editor's self-test scripts only logged: nothing made a run fail. Now: - `expect` commands check the state and log `SELFTEST PASS` or `SELFTEST FAIL ... got X, expected Y`: the cant at a track end, the joint at an end (gap, angle, cant step), the records of a switch and the connections naming it, speed, gauge, a track present or removed, the laying norms' gauge, heights and lifts against a mark, whether a track is in the line under the route tool, and the includes of a turntable. A command no group takes counts as a failure, so a mistyped one can't make the checks after it pass. - At `quit` the result is logged, and a script whose expectations failed ends the editor with exit code 2 (a failed start stays 1; the simulator's test mode is unchanged). - The commit of the inspector's cant field is `track_cant_commit`, which the inspector and the `trackcant` command both call; `routegauge` sets the laying norms as the route tool does, and `tracksetdelete` deletes a set of tracks by name. - `tests/editor/run.py` runs each script of `tests/editor/cases` on a copy of the fixture scenery in the game folder, with a wall-time limit and a memory cap, reads the exit code and the `SELFTEST` lines, and deletes the copy. A `#> reopen` line restarts the editor on the saved scenery. See `tests/editor/README.md`. - One case per fix of the track editing quick fixes (inspector cant, norms after deleting, the gauge paste group, turntable speed saved, deleting a set, a set with a double switch, a slip and a crossover, deleting a switch of a crossover, a bent switch). All pass; with the fixes reverted all fail. |
||
|
|
c813c03865 |
fix(editor): track edits keep the joints, the norms, the records and the saved speed together
- The cant typed in the inspector goes on into the track joined at that end, as the gizmo and the joints tool do it; the neighbours go into the same undo step. The joint stepped before. - A track laid on from a canted joint takes the cant off along the ramp the norms ask for at the speed (`alignment::cant_ramp_length`), not at a fixed 1.5 mm a metre whatever the speed and the norms: 120 mm at 100 km/h over 120 m, not 80 m. - Deleting a track of the line under the route tool keeps the laying norms. They went back to the defaults, and every later lay, extend and join used those. - The gauge is a paste group of its own, off by default: pasting how a track rides or sounds no longer changes its gauge. - The speed of a turntable set in the editor is the one saved. The editor changed the speed the turntable runs at, while the file keeps the limit it was loaded with. - Deleting a set of tracks does what Del does with each: a double switch, a slip and a crossover go whole, the records of the switches go with them, and the model and events of a turntable too. The records stayed behind and on saving were given to another switch, which then showed a wrong type. - Deleting a switch of a crossover takes the crossover out whole, as the connection tools do: the outer track of a crossover on a curve comes down by its lift and the record of the connection goes. Alone, the switch left the outer track up for good, and the connection to the next switch given its name. A switch bent out of the shape of its record is found by its name. Tests: a unit test of the norm ramp. The other changes are in the editor's UI, which the unit tests don't reach.build-fix-editor-track-quickfixes |
||
|
|
f15ea40575 |
test(scripting): the image memory test makes fewer images, to finish in time under coverage (#427)
The dropped images were 20 of 64 MB, each filled pixel by pixel. Under the GCC -O0 --coverage build that sometimes took longer than the 20 s a screen has to draw, so the check got -1. 4 dropped images, twice the memory of a screen, still prove that dropped images don't count. |
||
|
|
e76ab8b5b3 |
Revert #408 and merge master into staging (unblocks #442) (#443)
* Enhance Windows build matrix with AVX2 variants * fix(lang): the two Polish lines of the download area written with \n, so they match the tooltip and the hint * fix(files): data named in another case is found on Linux, folders included The parser and the loaders lowercase every name they read, while the data made on Windows has files and folders named in any case (scenery/Braniewo, textures/siec_trakcyjna_ph/.../STS_*.tga, sounds/sip/Gorki.wav). FileCased matched the file name only, so a folder in another case wasn't found. - FileCased walks every part of the path on Linux, the folder listings kept by their lowercase and read again once the folder changed; Windows as it was - FileExists finds the file in any case on Linux, and the variant with names and extensions gives back the name as it's on the disk, so textures, materials, sounds, station announcements and scripts open that name - models, sound captions, timetables and nodebank previews open the file as it's named on the disk; the texture format is told by the extension in any case * fix(files): the banks keep the names asked for, only the opening takes the case of the disk The textures, materials and sounds are kept by the names they're asked for. Given back as named on the disk, a file in another case missed the bank and was loaded again on every request. - FileExists with names and extensions finds the file in any case but gives back the name asked for; FileOnDisk gives the file to open, used where textures, sounds and scripts are opened - FileExists of a single name is a plain check again, the places checking it and opening the same name stay as they were - the texture format is told by the extension asked for again - a folder changed shortly before it was read is read again for a name missing from it, the time of a change being as coarse as the clock of the file system; a listing cut short isn't kept * fix(files): a folder changed in the future isn't read again on every name missing from it * perf(files): a file missing costs a single check, as before Measured in a case sensitive folder (3000 textures, every 20th in mixed case, looked up the way Texture.cpp does), the walk over every part of the path made a texture lookup 4-5 times slower than master: each name tried and missing checked every folder of its path. - the folders found are kept by the name they're given with, the missing ones for a second, so a missing file checks its folder alone - a folder named as it is on the disk is taken without its listing - the time a folder was changed is looked at once a second at most The lookup is now as fast as master's (about 180 us per texture on NTFS in both) while finding the files named in another case too. * fix(files): terrain files named in another case are found on Linux The terrain directive names .txtf/.btf files in lowercase, as the parser gives every token. The name is now taken as it is on disk, from the text file first, so the binary file is made next to the text and the editor's references and layers keep one name. * fix(files): models named in another case are found on Linux The manager of the models looked for the file with FileExists of a single name, a plain check again since the banks keep the names asked for, so a model named in another case (models/przejazdy/plyty3_L, dynamic/pkp/st44_v2/main/2M62-0685-A) was reported missing before TModel3d::LoadFromFile() could open it as it's named on the disk. find_on_disk() finds the file in any case and gives back the name asked for, the key of the bank. * refactor(files): named functions instead of the lambdas of the folder cache (Sonar S2259, S3608, S6004) Sonar took the folder captured by the lambda reading it for a reference to null, failing the quality gate on reliability. The folder is read and the path kept by functions in the anonymous namespace, the age of the listing declared in its if. * fix: the simulator opens more than 512 files at once, and a shader it can't open says why With "physicslog yes" every driver keeps its .dat open, and a large scenery (Tomaszewo: some 500 vehicles, cars of the roads included) took all 512 streams the MSVC runtime gives: the next fopen failed and the simulator stopped at "cannot read shader: shaders/map.vert" on opening the map. The limit is raised to 8192 at the start (the soft limit of open files up to the hard one on Linux), and a shader file that doesn't open is told as such, with the system's reason, rather than as one that can't be read. * feat(blackbox): the black box on its own, writing the tapes of the user's vehicles at the end "blackbox yes" in eu07.ini records the black box with the physics logs on or off, "blackbox no" never; with no entry it goes with "physicslog yes" as before. With the physics logs off, the recorder keeps the line of the physics log of the driver the user is with, every 0.05 s, and writes it to physicslog/<vehicle>.dat when the recording closes: the speed recorder's tape of the vehicles the user was in, without every vehicle keeping a log open and written twenty times a second. The line and the header of the log are made by one function of the driver, which its own log writes too, and the file is opened the same way, so the two are the same to the byte: the readers of these logs (the old Hasler tape viewer, the starter) read them as before. * feat(physicslog): the logs written every two seconds by a thread of their own, no file kept open; the black box's tapes as it goes "physicslog yes" kept the .dat of every vehicle with a driver open for the whole run and flushed it twenty times a second from the simulation's thread: some 580 open files on Tomaszewo. The lines are kept now and a thread of their own writes them every two seconds, each file opened only for the moment it is written to. The files, their lines and their text mode stay as they were. - The black box, with the physics logs off, writes the tapes of the user's vehicles through the same writer as it goes, not at the end. A log begins when the user is first in the vehicle and goes on while the user looks around outside, until another vehicle is taken; back in it, the log goes on after the gap. The vehicle's own driver keeps the log only if it is the primary one, as a passive one's clock stands still; otherwise the driver of its train does. - What is kept is written when the simulator closes, after the black box, at the end of a test run, and when the test watchdog ends a run. A crash loses the last two seconds. - On Tomaszewo with the black box alone, the one tape grows every two seconds. With "physicslog yes", the 581 logs grow and the simulator holds as many handles as without them; writing them takes the thread about 1.9 s, which the closing waits for once. * feat(blackbox): the cab record holds the speed of the wheels, apart from the vehicle's when they slip The speed of the cab record is the vehicle's. The speedometer, and a speed recorder's tape with it, shows the speed of the wheels as they turn, which runs away from it while they slip and drops to 0 while they are locked in a skid. It is added at the end of the record (194 bytes), where the readers skip what they don't know; the .dat tapes have it already, in their second column. * fix(ci): build OpenAL Soft with the PipeWire, PulseAudio and ALSA backends, so the Linux game has sound The Linux job builds OpenAL Soft 1.24.2 from source, but the runner had none of the headers of its audio backends, and OpenAL Soft's CMake leaves out every backend it can't find. The bundled libopenal.so.1 had only OSS, Null, Wave and Loopback. Modern distributions and the Steam Linux Runtime have no /dev/dsp, so the game logged "Failed to obtain audio device" and played nothing, with any Steam Linux Runtime and without one. - install libasound2-dev, libpulse-dev and libpipewire-0.3-dev before building OpenAL Soft - configure it with ALSOFT_REQUIRE_PIPEWIRE/PULSEAUDIO/ALSA, so a missing header fails the build instead of shipping a library without sound The backends are loaded with dlopen at run time (ALSOFT_DLOPEN is on by default), so the bundled library gains no new dependency. Tested by putting an OpenAL Soft 1.24.2 with these backends next to the game from the Steam depot: under Steam Linux Runtime 4.0 the sound works. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(editor): the certificates of https looked for where the distribution keeps them The Linux game bundles the libcurl of Ubuntu, which knows only Ubuntu's /etc/ssl/certs/ca-certificates.crt. Fedora, RHEL and openSUSE keep the certificates elsewhere, so every download of the editor (orthophoto, terrain model, topo map) failed there with a certificate error. The file is taken from SSL_CERT_FILE or CURL_CA_BUNDLE when set, else the first of the files the distributions keep, and passed as CURLOPT_CAINFO. With none found libcurl keeps its own. * fix(editor): an https proxy checked with the same certificates CURLOPT_PROXY_CAINFO gets the file found for CURLOPT_CAINFO, so a download through an https:// proxy on Fedora or RHEL doesn't fail on the proxy's certificate. * fix(ci): the no-AVX2 Windows build has its own concurrency group and its own public download After master was merged the two Windows variants shared one concurrency group with cancel-in-progress, so one cancelled the other, and the publish job looked for an artifact name the matrix no longer produces. Each variant now has its own group, the publish job downloads both, and the release carries maszyna-windows-x64.zip (AVX2, the old name, so the links already handed out still work) and maszyna-windows-x64-noavx2.zip. The AVX2 variant passes -DENABLE_AVX2=ON explicitly instead of an empty flag. * build: a build without AVX2 has _noavx2 at the end of its executable name With ENABLE_AVX2=OFF the executable is eu07-x64_<date>_<hash>_noavx2.exe (eu07-x64_noavx2.exe without ADD_VERSION_SUFFIX), so a starter can tell the two builds apart by the name alone and pick this one on a CPU without AVX2. The AVX2 build keeps its name. * ci: Linux is built without AVX2 too, published as maszyna-linux-x64-noavx2.tar.gz The Linux job becomes the same two-variant matrix as Windows (ENABLE_AVX2=ON/OFF), each variant with a concurrency group of its own. The publish job downloads both Linux artifacts, restores the executable bits in both and releases maszyna-linux-x64.tar.gz (AVX2, the old name) next to maszyna-linux-x64-noavx2.tar.gz. The no-AVX2 executable is eu07_<date>_<hash>_noavx2. * fix(renderer): the legacy renderer clears the arrays the scene left before it draws the ui The legacy renderer drew the ui with the client arrays of the last scene draw still enabled: the texture coordinates of the normal map unit and the normals, pointing into the vertex buffer of whatever was drawn last, 48 bytes a vertex. The ImGui backend sets up the vertex, colour and texture coordinates of the active unit only, so the driver read the stale arrays with the indices of the ui. Once the ui had more vertices than that buffer, the NVIDIA driver read past its end and the game crashed; a crash dump of the editor (an area selected, a track being laid) shows the read of vertex 15113 at a 48-byte stride in ImGui_ImplOpenGL2_RenderDrawData. The arrays are now disabled on every texture unit the geometry uses, with the normal and colour arrays, inside the glPushClientAttrib already there, so the scene gets its state back after the ui. The default and the experimental renderers don't go through this code. * fix(app): a renderer this build doesn't have starts the full one, not the legacy one The starter writes "gfxrenderer vulkan" for the Vulkan renderer of the builds that have it. This exe doesn't know the word, and every word other than default/experimental fell to the legacy renderer: a player who picked Vulkan got the slowest renderer, the one whose ui crashes on NVIDIA (the arrays left by the scene). "experimental" in a build without the NVRHI renderer ended with "no renderer found!" and no game at all. After the settings are read, a gfxrenderer word this build has no renderer for becomes "default", with a line in the log saying so. The words it knows stay as they were: full/default, legacy, simple, null, the older starters' simpleshader and off (legacy as before), and experimental where it is built. * fix(settings): the gfxrenderer word read in any case, as the starter reads it A hand-written "gfxrenderer Legacy" started the legacy renderer only because every unknown word did; with unknown words going to the full renderer it would have changed. The word is lowercased when read, as StarterNG's RenderEngineOf does, so Legacy, Simple or Full mean what they say. * fix(physicslog): a log whose file can't be written keeps its lines and header, and the writer is stopped once on every way out A failed write put its lines back, ahead of those since, so a file held by another program for a while gets its header and every line once it can be written; up to 4 MB kept per log. Stopping is joined once, and not from the writer's own thread. main stops the logs after an error it caught too, and the test watchdog flushes with a time limit, so a disk that doesn't answer doesn't keep the run from ending. * fix(blackbox): the wheels of the powered vehicle, as the speedometer has them, and the logs described as the drivers' they are In a unit driven from an unpowered car, the speed of the wheels was of the car the user is in, whose wheels never slip; now of the motor car, signed as the occupied vehicle's speed. The doc tells of a log per driver, and of the two seconds of real time a crash loses. * fix(physicslog): failed logs kept within 64 MB in all, cut outside the lock, never written twice; the writer knows itself when stopped The lines kept while files can't be written are cut to their share of 64 MB before the lock the simulation waits on. A log written in part is cut back to its length, so the next try doesn't write its start twice. A stop from the writer itself is told by its id even after another thread took it to join, and the watchdog's flush waits at most its time, the writing on a thread of its own. * feat(physicslog): the logs of the trains only, physicslog.trains "physicslog.trains yes" in eu07.ini writes the .dat log of each driver who drives rail vehicles, not of the passengers nor of the road vehicles that make "physicslog yes" hundreds of files on a big scenery: the tape of every train. A driver made primary later begins its log then, and isn't counted while it doesn't log. The black box goes with it when the ini says nothing of its own, and doesn't write a second log of a driver writing its own. The doc tells the doors' sides are the vehicle's, the driver's swapped in the rear cab. * fix(physicslog): a train's log begun at its first line, so passive crews get no file Every crew is primary in the constructor and the drivers but one of a train with crews in more vehicles are made passive only before it starts, so a log begun there left files with only the header. With physicslog on all logs begin at once as before; one of a train waits for update_logs. * fix(editor): the texture pickers let go of the images scrolled past, the memory no longer runs out The picker of the textures of a track offers every texture of the textures folder, and each tile that came into sight read its texture full size, into the graphics card and the memory, and kept it there for good. Scrolling through the list for a trackbed texture took about 2.5 MB a tile: some 900 tiles made 3.5 GB, the whole folder 28 GB, and the game went down once the memory ran out. An image out of sight for 3 seconds is now taken out of both again (texture_manager::unload, Unload_Texture of the renderers) and read anew when it's shown once more, a few a frame as before. Only a texture the scene has never drawn is let go; those of the scene stay to the resource sweep. The texture browser lets go of its images on Refresh too. The picker no longer lists textures/previews: the 4100 previews of the node bank are images of models, not textures of anything. Checked on td.scn by a scripted run: 8000 images of the picker read one batch a few frames after another held the game at 2-3 GB, where it went to 28 GB and fell before; images shown again after they were let go come back; a trackbed texture picked from the folder is drawn on the track after its image was let go. * fix(physicslog): the writer's destructor throws nothing, its wait a plain condition variable woken to stop; a driver of no vehicle controls nothing * fix(editor): the images of the materials let go of with all their textures, the browser's Refresh a frame later An image of a material read the material with all its textures, the normal and specular maps and the variants, and only the first one was let go of: those stayed in the memory for every material scrolled past. They are let go of together now (Unload_Material). texture_manager::unload also takes the textures read and not made yet, waiting for a worker still reading one, and deletes the gl texture itself: release() would read it back from the card with gfx.resource.move only for it to be dropped. The Refresh of the texture browser let go of the images in the middle of the frame, while panels drawn before it could still refer to them; it now marks them, and they go at the start of the next frame. Checked on td.scn by a scripted run: 8040 images of the picker read a batch every few frames end at 2.0 GB, against 2.3-2.6 GB before this and 1.1 GB at the start; a trackbed material picked from the folder is drawn on the track after its image was let go. * fix(physicslog): every stop asked wakes the writer, the one from itself too; no psyche for a driver of no vehicle * fix(editor): the image of a material with no texture in its first slot is let go of too Its normal and specular maps were read with it and stayed in the memory: the trim passed over every image with no texture of its own, the material along with it. * fix(physicslog): nothing that goes wrong in the writing ends the simulator; a name in 1250 makes a path on a Windows set to UTF-8 The writer's thread called flush() with nothing around it, so an exception leaving write() ended the process with std::terminate, with no message. One that happens: the file of a log was made a std::filesystem::path of the vehicle's name, which MSVC converts in the code page of the system and throws for bytes not of it; on a Windows with "Use Unicode UTF-8 for worldwide language support" a vehicle named in 1250, as the sceneries have them (0xB3 for ł), isn't UTF-8. - the file of a log is made of the name with MultiByteToWideChar without MB_ERR_INVALID_CHARS: the same file as before for every name of the code page, U+FFFD for the bytes not of it instead of a throw. Elsewhere the bytes are the name of the file as they were - a log whose writing throws for any other reason (memory) is kept for the next try as one whose file can't be written, and the other logs are written still - the thread, flush_for() and stop() write through flush_safely(), which lets nothing out: what was taken for a writing failing as a whole is lost and told in the log, the next writing goes on - the messages name the file by the bytes of the name, not by path::string(), which converts back Tests: a log which can't be written doesn't keep the others from theirs; a vehicle named in 1250 has its log, read back by physicslog_writer::file(). Reported in the review of #385. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(blackbox): the tapes go on after the editor, with the physics logs off The tapes of the user's vehicles were written by update() after the check for the writer of the recording, which close() drops on entering the editor (F11). With "physicslog no", the speed recorder's tape ended at F11 while the drivers' own logs of "physicslog yes" went on. The tapes are files of their own: they are kept from the moment the recording was to be made, the file made or not, closed or not, until the simulator closes, after the gap of the time in the editor. Only the recording itself stops at F11, as before. Reported in the review of #385. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(physicslog): what no file name may have on Windows is replaced in the name of a log, on every system A spawned vehicle is named <spawn>:<number>, and its log went to physicslog/<spawn>:<number>.dat. On NTFS that isn't even an error: it is the stream <number>.dat of the file <spawn>, which nothing lists, so the log was written and no one could find it. On Linux the file was there, under a name Windows can't open. The name of the file of a log has < > : " / \ | ? * and the control characters replaced by _, on every system, so the logs are named alike everywhere (spawn_ezt:12 is spawn_ezt_12.dat), and a _ before a name Windows keeps for a device (con, nul, com1..., with an extension too). The bytes of 1250 stay. The black box tells the log it begins by the same name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(renderer): a material's textures let go of in one place, for every backend Unload_Material walked the textures of a material and of its variants the same way in both opengl renderers, and Sonar counted its declarations, set into the long run of overrides the two headers share, as duplicated: 5.2% of the new code, 3% allowed. The walk is gfx_renderer's now, over IMaterial::GetAllTextures and the backend's Unload_Texture. Materials that don't tell their textures, the Vulkan renderer's, give none, and are left alone as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * AI: shunting brakes for a stop point again; test mode: no false SPAD for a train set across a signal (#409) * fix(ai): shunting AI brakes for a stop point again, the braking curve doesn't plan from a brake table left at zero The braking curve outside the final approach plans from the consist brake table since |
||
|
|
2f12768815 |
fix(timetable): the station of departure written in capitals is still a stop (#343)
The first row of a timetable, which usually gives only the departure time, became a stop only when its name matched the relation's first station case-sensitively. Os33733 of linia_107_poludnie.scn writes ZAGORZ in the rows and Zagorz in the relation, so its driver counted Zagorz as passed at the start, left before its departure time and the train manager never gave the departure signal. The names are now compared regardless of case (timetable::starts_at in the core library). Tests: unit test of the rule; td.scn scenario cases with a timetable of the case's own (first row STACJA1, and Stacja1 as control) and the td.scn train started with its head 80 m past the W4 of Stacja1; the scenario runner can copy a timetable of the case into the game for the run. |
||
|
|
8bff785886 |
build: optionally use the system nlohmann_json (USE_SYSTEM_JSON) (#360)
USE_SYSTEM_JSON (default OFF) takes an installed nlohmann_json 3.9 or newer (ordered_json, used by the unit tests) with find_package instead of the ref/json submodule. Both give the nlohmann_json::nlohmann_json target linked to eu07_settings. Drop the include directory from the never defined NLOHMANN_JSON_INCLUDE_INSTALL_DIR. Fixes #54. |
||
|
|
96bc3e6863 |
fix(cab): the compartment lights keyboard toggle works more than once in a cab without the switch (#353)
* fix(cab): the compartment lights keyboard toggle works more than once in a cab without the switch The compartment lights get two requests, on (CompartmentLights.is_enabled) and off (is_disabled), and the off one wins in LightsCheck(). The enable and disable commands withdrew the other request only when the cab had a toggle type compartmentlights_sw:. A push type switch and the separate compartmentlightson_sw:/compartmentlightsoff_sw: push buttons withdraw their own request when released, but a cab with none of these controls (the CD 810 cab A, where only the engine compartment has the switch) never withdrew anything: after one on/off both requests stayed set, the lights stayed off and ctrl+; kept choosing "turn off". Now a command withdraws the other request when the cab has the toggle type switch (as before), or when it has no compartmentlights_sw: and no push button for the other request, so the keyboard toggle acts as a two-state switch there. Cabs with a push type switch or with the on/off push buttons keep their behaviour. The decision is in vehicle/compartmentlightsswitch.h, unit tested together with the vehicle's LightsCheck() on the Elf definition. * fix(cab): the compartment lights keyboard toggle latches in a cab with the on and off push buttons (#355) In a cab with the compartmentlightson_sw: / compartmentlightsoff_sw: push buttons and no compartmentlights_sw: (the EN57-2000, the SA134, the 214M, the EN57AKL/AL/KM and EN71) ctrl+; turned the compartment lights off only while the key was held. OnCommand_compartmentlightstoggle picked the command from the lights' state again on the key release, after the press had changed that state, so the release went to the other command: the push button that was pressed never withdrew its request. After the first press the on request stayed set, and from then on every release withdrew the off request and the lights came back on. The toggle now sends the release to both commands, as a release of the push buttons would: each returns its own push type control to the neutral position and withdraws its request. The press is picked from the state as before. Mouse clicks on the push buttons go to the enable and disable commands directly and are unchanged; with a compartmentlights_sw: both commands release it the same way, and a cab without the controls has nothing to release. In the Elf cab (an impulse compartmentlights_sw: and the on/off return buttons) the lights worked, but the button the key had pressed stayed pressed; now it returns too. * test(cab): the compartment lights switch test without Sonar issues using enum for range_t in the release helpers, and the lights declared in the if that reads them. No change in what is tested. |
||
|
|
97a6218094 |
fix(audio): measure the start offset on the buffer queued last, not on AL_BUFFER (AL_INVALID_NAME) (#350)
* fix(audio): measure the start offset on the buffer queued last, not on AL_BUFFER (AL_INVALID_NAME)
openal_source::update() looked up the buffer left playing after a multipart
sound's opening bookend with alGetSourcei(AL_BUFFER). For a source with
queued buffers that is 0 in OpenAL Soft 1.18 (the version the game ships),
and in newer versions once the source has stopped, so alGetBufferi(0) raised
AL_INVALID_NAME ("sound: al error: AL_INVALID_NAME" in errors.txt) and the
sample offset came from an uninitialised size. It happened every time a
sound with a start offset (the motor blowers of the EN76/EN96 family, with
start/stop bookends) went from its start sample to the loop.
The source now remembers the buffer it queued last and measures that one.
The offset itself is computed by audio::start_sample(), in the core library
with unit tests; it also keeps the offset inside the buffer.
* refactor(audio): the start sample without Sonar issues
The sample count is cast to float explicitly, as it was converted
implicitly. No change in behaviour.
|
||
|
|
b24e87dc63 |
Cab: the light preset selector turns on past its end, with sound (#345)
* fix: the light preset selector turns on past its end with sound (eu07/maszyna#464) A selector with Wrap=Yes turned past its last position to the first one (or back) was set with PutValue(): no animation and no sound. On the EN57AKM these are the positions 0 and A1. A knob whose positions make a full turn now turns on the same way it was turned, sounding the position it reaches; other switches still jump, but sound the position too. * refactor(cab): the wrapping rotary switch without Sonar issues The full turn and the way on are declared in the ifs that use them, and the optional is tested with has_value(). No change in behaviour. |
||
|
|
3cbb529d16 |
fix(scene): write the region cache through a temporary file, reject a damaged one (#351)
* fix(scene): write the region cache through a temporary file, reject a damaged one
The static geometry cache of a scenery (<scenery>.sbt) was written in place,
and only its 8-byte header was checked before it was used. A write cut short
(a crash, the process killed, the test mode's real time watchdog) left a
truncated file which every later start loaded as it was: the sections up to
the cut, then whatever the reads past the end produced, with the section
index used unchecked and the section size read and ignored.
- basic_region::serialize() writes <scenery>.sbt.tmp and renames it over the
final name only when complete; a failed write is logged and the temporary
file removed, the previous file stays.
- basic_region::is_scene() checks the whole layout: header, section count,
every section index within the region and present once, and the section
sizes adding up to the length of the file. A cut-short file is turned down
there ("Bad file: ... ignored"), so the scenery loads from the text and the
cache is written anew at the end of the load.
- basic_region::deserialize() checks the layout again, reads each section out
of its own data (sectionsize bytes) and requires the section to use exactly
that; sections are restored apart from the region and taken over only when
the whole file was read, so a damaged file leaves nothing of itself behind.
If the content is damaged although the layout holds, the default .sbt (the
game's own copy of the text) is removed so the next start rebuilds it.
- A vertex count the rest of the data can't hold, a shape count running past
the data, and a string cut short by the end of the data
(sn_utils::d_str() looped forever there) now stop the read instead of
allocating or looping on.
- The layout check and the write through a temporary file are in
scene/regionfile.{h,cpp}, in the core library with sn_utils, and have unit
tests (test_region_file.cpp).
- run.py also removes a <case>.sbt.tmp left by a run cut short.
The file format is unchanged.
* refactor(scene): the region file code without Sonar issues
write_through_temporary takes the writer as a template parameter, the
messages are built with std::format, the reading of one section moves
into a helper (one break per loop), and the test drops chained
assignments and implicit lambda captures. No change in behaviour.
|
||
|
|
791281b306 |
Refactor/mover long functions (#239)
* test: real vehicles and golden traces in the unit tests The game's own vehicles (dynamic/ of the release used for the tests) as JSON of what the game's vehicle loader reads of their .fiz files, includes expanded: test_fiz.cpp converts them on demand and checks the loader reads the same sections, values and rows as of the game's file (fiz.h). Chosen to cover every engine type, brake valve, brake handle, local brake, coupler type, door type and brake delay set the game data uses. Golden traces (golden.h) characterise the simulation, compared within a relative tolerance or exactly, re-recorded with EU07_UNIT_TESTS_UPDATE_GOLDEN=1: - the parameters of every real vehicle as loaded, - the brakes of every real vehicle through charge, service steps, release, overcharge and emergency, on every brake delay setting, - every position of every driver's and local brake handle, - every powered vehicle started up the way the AI does it, driven to full power and braked to a stop (drive.h), - the real electric units and a locomotive with wagons driven whole, as trains of coupled vehicles stepped the way the game steps them (consist.h), - scenarios of the controls (scenario.h): doors, reversing and cab change, slip and sand, emergency stops, releasers, the ep and the electrodynamic brake, heating, loading, a collision, and frames of several physics iterations. * test: commands passed between vehicles Every command RunCommand knows run on every real vehicle and recorded, commands travelling through a train with a vehicle facing backwards, a coupling without the control cable, and loading and unloading by commands. * test: every switch of the cab, sent to the next vehicle Each switch sending its state to the train, each way and to each range, with the controllers and direction among them, on every real vehicle driving another of its kind, recorded for both. * test: the switches of the cab worked on a pair under the catenary The same switches with two seconds for the vehicles to act on each, so the pantographs rise, the main switch closes and the auxiliaries start. * test: gauges of trains in multiple and the damage descriptions The ammeters and the brake force the AI expects, recorded on the electric units and locomotives in multiple driven, the damage described on the driver's panel and ammeters showing the current of controlled vehicles. * test: give load commands their place, as the game does The loading test set its commands with SetInternalCommand, which leaves TCommand::Location as it is: uninitialised in a fresh vehicle, so the distance check of Load= and UnLoad= read garbage and the test failed now and then. The game gives them through PutCommand with the place of the platform, and so do the tests now. * test: brake valves and handles no vehicle of the game data has Fitted to a wagon and to an EU07: the valve variants and handles the loader knows that no real vehicle uses, the CV1 ones and the test handle among them, and a name the loader doesn't know. * test: braking from speed with the automatic ED brake, and a draisine Trains with the EP09, the E6ACT and the EW58 braked by ep, light and full service applications from speed, and the draisine pumped from rest and rolling. Only the E6ACT brings its electrodynamic brake in here. * test: the EP09's electrodynamic brake in service braking held to a stop start_up() took a vehicle for ready once its line breaker was closed and its reservoir full, which a train made already moving is at once: the EP09's manually started converter was never switched on, so there was no 110 V and no electrodynamic brake. It now waits for the converter. The EP09 with wagons is braked from 120 km/h by light, medium, high and full service applications held to a stop: the motors brake, the air of its cylinders is let out and given back as the train slows down. The flag of the electrodynamic brake stays on at a standstill below 2.1 bar. C strings given to CAPTURE are shown as text. * test: the converter switched on before a train is ready, the EW58's ep-staged electrodynamic brake start_up() called a train ready as soon as its line breaker closed and the air was there, so the converter of a unit having it in another car than the cab (the EW58's middle car) was never switched on, and its electrodynamic brake, gated by the 110 V, never came in. The converter and the compressor now always get switched on first. The EW58 brakes electrically by the stages of the ep brake, not by the pipe alone. * test: the ET42 and the 214M railbus among the real vehicles The ET42's halves (its own series motor branch: the motors in series at the high current setting) and the 214MA, a diesel railbus with the hydraulic torque converter, the retarder and the controller of an induction motor drive, converted from the game data and recorded in every sweep of the real vehicles. * test: the wagons' hand brakes released with the train's brakes; the 754, SM31 and SU46 release_brakes() released the hand brake of the driver's vehicle only, so every wagon set up braked kept its hand brake on and got dragged along. It now releases the hand and spring brakes of the whole train, as TController::AutoRewident() does when the AI takes it over, and the traces of the trains with wagons are recorded anew. The 754, the SM31 and the SU46 join the real vehicles for the kinds of the diesel-electrics' field shunting relays the others lack (RelayType 0, 1 and 46). * test: traction on a lost and too high catenary voltage, the ET42, the diesel-electrics' shunting relays The line breaker opened by the voltage relays of a series motor locomotive and by the limits of an induction motor one. The ET42 at the high current setting, which keeps its halves' motors in series, and its switched electrodynamic brake, whose current trips the overload relay from the top speed of the low setting. The field shunting of the diesel-electrics through each kind of their relays, at full power and notched back. * test: the EW58's electrodynamic brake stages, the EU47's speed control and braking at the voltage's limit The stages of the EW58's motor brake set by the positions of its ep handle, the first one alone over 100 km/h. The EU47's second controller holding, raising and lowering the speed set, its local brake setting the flag of the electrodynamic brake without the motors braking, and its brake feeding back less current into a catenary over the drive's MaxV. * test: diesel engines too cold and too hot to start, the 214M railbus's controller and retarder The heat of the diesel engines: at -10 degrees the ones with the lowest water temperature set don't start until the heater warms them, at 88 degrees the ones with a second water circuit don't start while it cools, and the SM42 run hot at full power is kept under its highest temperature by its fans and shutters. The 214M railbus's controller from the air brake through the retarder and neutral to power, its torque converter's lock-up and its gearbox. The controller helpers of the traction tests (full power, waiting for the line contactors, and notching back) move to test::scenario. * test: couplers coupled, uncoupled, broken and colliding; loads assigned, loaded and unloaded Coupling by hand touching or apart and of the same kind or not, with the sounds of what changes; uncoupling a screw coupler pressed together, stretched, with the hoses alone or broken; the automatic couplers of electric units coupling on contact, without the control cable between two kinds; a coupler broken with its brake hose; collisions over 15 km/h derailing. The pantographs set up by the pantstate load, a load of one kind at a time up to the capacity, and the steps of loading and unloading. * test: the battery drained and charged, the pantographs' tank and pressure switch, the 214M's speed control The EU07's battery drained without the converter by the lights and the small compressor until it opens the line breaker and nothing starts, charged by the converter, and switched off. The pantographs on their own leaking tank until the pressure switch opens the line breaker, and the small compressor pumping it up and priming the switch. The 214M railbus's speed control set by its buttons, steps and power limit, braking down with the retarder, and standing by. * test: the MHZ handles' buttons, the valves at speed, every brake material, the NESt3's relays The overload and the high pressure buttons of the MHZ handles. The KE and the LSt at speed in the R and P settings, under the anti-slip request and the releaser button. Every material of the brake shoes and disks the loader takes, braking a wagon from speed, the ones no game vehicle has among them. The CV1_R and the Oerlikon valve's relays set by its name (-ED, AL2 without ESt3) fitted to a wagon. * test: the loader's lists and lines: the 218M, SA134 and 22WEc, a compressor list, Pmax by speed, skipped lines The 218M (V2NList), the SA134 (HTCList) and the Elf 22WEc (ffBrakeList) join the real vehicles for the lists the others lack. Definitions made by the tests for what no game file has: a compressor list, whose table of whole numbers reads a factor of 0.9 as 0; the compressor's limits apart for the rear cab; the highest power of an induction motor drive by the speed, extrapolated past the table; and the lines the loader skips or trims (comments, a hash anywhere, leading spaces, carriage returns). * test: what the cab and the AI call on a vehicle: gauges of the train, the split ED brake, spring brake, cut-off The engine rotation of up to three vehicles in multiple and the lamps of the overload relay and the starting resistors read through the control cable; the engine's idle speed and the ET42's second controller shown in its dynamic brake; the controller of the electrodynamic brake apart from the local brake, which no game vehicle has yet; the spring brake shut off and released, the ep brake's fuse and the handle stepped by the AI; damaged motors cut off; the cab activated by itself; a road vehicle moved across a road, for which the tests' track gets a width; and the lamps and the buzzer of the security system left unattended. * test: the EP05 and its camshaft among the real vehicles, the headlights' colour and brightness The EP05, whose camshaft closes the line breaker and the line contactors by the camshaft's own position, converted from the game data and recorded in every sweep of the real vehicles. The Headlights section, which only the 214M's own file has, in a definition made by the test. * test: what the unit tests reach of the simulation core, what's dead or left, and what they found COVERAGE.md: the blocks of Mover.cpp, hamulce.cpp, Oerlikon_ESt.cpp and friction.cpp the tests run, the code nothing in the game runs, the code only data no game vehicle has would run, what's reachable and left, and the behaviour the tests found that may deserve a look. * test: check invariants of the physics on every step of every golden trace Rules any vehicle keeps whatever a test does (no NaN, cylinders and pipes within their limits, no current with the line breaker or contactors open, no force without power, distance as the speed runs, no acceleration over 5 g), checked on every step, with no comparison to a recorded file. The traces where a test or a game vehicle breaks one are excused with the reason; the vehicles' cases are in the findings of COVERAGE.md. * test: key figures of every golden trace, per part of the run Duration, speeds, distance, time to stop, the brake pipe's lowest pressure and time to recover, the peaks of the cylinders, the motor current and the tractive force, for each part between two events, in data/golden/<name>.figures. Compared within 0.5% or the last decimal, so they hold on any compiler, and an intended change of behaviour shows in a few readable lines. Traces sampled by hand keep none. * test: keep the golden samples out of the repository, recorded on the code before a change The samples of the golden traces are 29 MB and only mean something against the code before the change they check, so they're recorded locally before it (EU07_UNIT_TESTS_UPDATE_GOLDEN=1) and compared after it, and ignored by git. The key figures and the invariants stay, and are what the CI checks. Without samples recorded a trace compares only its key figures, but with EU07_UNIT_TESTS_GOLDEN_EXACT=1, the check of a change which shouldn't alter anything, it fails, so the check can't pass by having nothing to compare. * fix: draw the noise of the control pipe pressure in one order on every compiler The order of the two Random(10) calls in 'Random(10) - Random(10)' is unspecified: GCC draws them the other way round than MSVC Release, which mirrored the control pipe pressure around 5 bar and failed 32 unit tests on the Linux CI. The draws are sequenced in the order of MSVC Release, which the golden traces were recorded with. * test: count the start-up rounds with an integer, not a double (SonarCloud S2193) * test: behaviour in CHECKs, the key figures out of the repository The key figures of the golden traces are recorded with their samples on the code before a change, and compared after it, instead of being kept: a trace without them checks the invariants and its test's CHECKs, which is what the CI runs. The scenarios of the controls state what they show in CHECKs, and the runs of every real vehicle what holds for each of them. Writing them showed scenarios which didn't do what they were named for: the cab change stopped in the engine room, the slip runs put the controller to full power at once and never got the line contactors closed, and the train stopped by the alarm chain never got its pipe charged again. They do it now; the rest went to the findings. * refactor: TractionForce split into its parts and a function per kind of engine TractionForce() makes the engine's revolutions, the ventilators, the engine power and the voltage relays in turn, then the tractive force of its kind of engine, each in a function of its own: the dumb, wheels driven, series motor (with its dynamic brake by stages), diesel, diesel-electric (with the shunt field relays) and induction motor drives (its speed control, brake blending, motor model and the drive without power). The blocks moved line for line; the golden traces of the unit tests, recorded on the code before, compare bit for bit. * refactor: the shunt field relays of types 45 and 46 in functions of their own * refactor: RunCommand split by the area of its commands The controllers, the brakes, the auxiliaries, the power, the doors and the load each in a function of its own; RunCommand() asks them in turn. The branches moved line for line, and the commands are distinct, so the order of the groups changes nothing; the golden traces compare bit for bit. * refactor: the line loop of LoadFIZ_Parse split into table ends, sections and table rows Each part returns where the loop went on to the next line; the dimmer list's row, which never did, still falls through to the next table. The blocks moved line for line, continue became return; every real vehicle loads the same parameters. * refactor: CheckEIMIC split by the kind of the integrated controller The controller, the steps, the four positions and the universal controller each in a function of its own, besides the TRAXX local brake and the limit of the value. The blocks moved line for line; the golden traces compare bit for bit. * refactor: update_doors split into the requests, the movement and the timers of the doors The blocks moved line for line; the golden traces, the doors of the units and wagons among them, compare bit for bit. * refactor: UpdatePipePressure split into its valves The local brake valve, the driver's handle with the pipe lock, the emergency valve, the settings of the distributor and the ep brake of the FVel6 handles each in a function of its own. The blocks moved line for line; the golden traces compare bit for bit. * refactor: PowerCouplersCheck split into the local voltage, the voltages and the currents of the couplers The circuit of a coupler for the coupling being checked comes from TCoupling::power() instead of a nested conditional repeated five times. The blocks moved line for line; the golden traces compare bit for bit. * refactor: CheckLocomotiveParameters split into the brake parts it creates and the state it starts in The distributor valve, the handles, the pipes, and the vehicle ready to depart or braked each in a function of its own; the main pipe's starting pressure comes from InitialScndPipePress() instead of a nested conditional. The blocks moved line for line; every real vehicle loads and runs the same, bit for bit. * refactor: AutoRelayCheck split into the steps of the shunt field, the main relays and the line contactors Each step returns whether it moved, as OK was; the early returns of the main relays' step give false as before, so the relay timer isn't reset after them either. The blocks moved line for line; the golden traces compare bit for bit. * refactor: LoadFIZ_Cntrl and LoadFIZ_Engine split into their parts Cntrl. into the brakes, the controllers and the starts of the devices; Engine: into the diesel, diesel-electric and induction motor parts and what both diesels share. The blocks moved line for line; every real vehicle loads the same, and the golden traces compare bit for bit. * refactor: the steps of the main controller by the kind of the engine in functions of their own IncMainCtrl() and DecMainCtrl() keep the conditions common to all, the switch on the engine moved line for line to IncMainCtrlByEngine() and DecMainCtrlByEngine(). An early return false there gives OK false, after which nothing else happened before either. The golden traces compare bit for bit. * refactor: dizel_AutoGearCheck and Current split into their parts The automatic gearbox's shift and its clutch; the series motors' dynamic brake flag, their current when connected and their failures. The blocks moved line for line; the golden traces compare bit for bit. * refactor: dizel_fillcheck split into the integrated controller's fill and the governor The blocks moved line for line; the golden traces compare bit for bit. * refactor: the diesel-electric's generator and the camshaft's run-down in functions of their own DieselElectricTractionForce() keeps the tractive force, the generator's current and voltage and the shunting mode's power limit moved out; AutoRelayLineContactorsStep() keeps the line contactors, the camshaft's run back to zero moved out, which only ever sets OK. The blocks moved line for line; the golden traces compare bit for bit. * refactor: the battery's drain in a function of its own UpdateBatteryVoltage() takes the drop BatteryDrain() sums up as it did. The blocks moved line for line; the golden traces, the drained battery's among them, compare bit for bit. * refactor: the speed control's regulator, and the couplers' stretch and automatic coupling, in functions of their own CheckSpeedCtrl() keeps the standby and the turn-off, its PI regulator moved out; CouplerForce() keeps the forces, the breaking of a stretched coupler and the coupling on contact moved out. The blocks moved line for line; the golden traces, the couplers tests' among them, compare bit for bit. * refactor: the pantographs' pressure switch and the torque converter in functions of their own UpdatePantVolume() keeps the pantographs' air, its pressure switch moved out; dizel_Momentum() keeps the engine's and clutches' moments, the converter's fill and lockup and its moments moved out. The blocks moved line for line; the golden traces compare bit for bit. * test: the SonarCloud findings in the unit tests std::format for the texts put together, emplace_back, const references, string_view parameters, std::array and std::vector for the C arrays, the ranges algorithms, names no longer shadowing the coupler ends, comments in the empty loops; start_up(), trace::check() and the converter of the definitions split up. BrakeForceR() is const, which it always was in effect, so the gauges test needs no const_cast. The golden traces compare bit for bit. * refactor: the simple SonarCloud findings in Mover.cpp const where the functions change nothing of the vehicle, using enum, a const reference, init-statements, a value never read and an unused parameter dropped, the never read lines of the definition kept in a map with a transparent comparator, the cooling power's default set before it's read. The golden traces compare bit for bit. * refactor: the command groups and the sections of the definition split further RunCommand() asks the pumps, the blowers, the cab and the brake equipment as groups of their own; the doors' permit and remote opening and closing are functions of their own, the latter one for both; LoadFIZ_Section() keeps the sections of values, those opening tables moved to LoadFIZ_TableSection(). No section name begins another, so the order of the checks changes nothing. The golden traces compare bit for bit. * refactor: the doors' requests and the main relays' steps split further update_door_requests() asks door_open_request(), door_close_request(), doors_powered(), door_step_folding() and door_open_duration() for what its nested expressions worked out; AutoRelayMainStep() asks AutoRelayMainUp(), AutoRelayMainNotchUp() and AutoRelayMainDown(), and is indented as it should be. The golden traces compare bit for bit. * refactor: the battery's drain by its state, and the series motors' notches, in functions of their own BatteryDrain() asks BatteryDrainCharged(), BatteryDrainLow() and BatteryDrainSwitchedOff(), each summing the drains as before; the series motors' cases of IncMainCtrlByEngine() and DecMainCtrlByEngine() moved out, and the condition of a notch down by one which was true either way made plain. The golden traces compare bit for bit. * refactor: the universal controller's brake, the clutch, the EN57's camshaft and the driver's handle's supply in functions of their own The blocks moved line for line; the golden traces compare bit for bit. * refactor: the induction motors' speed control, brake blending and drive split further The speed control by time and by position, the electrodynamic brake's flag and share, the motors' force limits and the inverters' frequency each in a function of its own. The blocks moved line for line; the golden traces compare bit for bit. * refactor: the diesel-electric's characteristic in a function of its own The straight part and the hyperbola of the tractive force, worked out the same way for the integrated controller and the train mode, in DieselElectricForce(). The golden traces compare bit for bit. * refactor: the resistor blowers, the diesel-electric's target revolutions, the gearbox's request and the governor's revolutions in functions of their own The blocks moved line for line, and the governor's body is indented as it should be; the golden traces compare bit for bit. * refactor: the series motors' driving current, the pressure switch's trip, the shunt relays, the Cntrl. train brake and the couplers' current split further The blocks moved line for line; the anti-slip brake's kinds read without the nested conditions, the circuit's current picked by PowerCircuitCurrent() instead of a nested conditional, and the couplers' voltage summed through TCoupling::power(). The golden traces compare bit for bit. * refactor: the nesting Sonar found left in the series motors' current, the pressure switch and the diesel-electric The series motors' dynamic brake without the condition every braking vehicle passed, the pressure switch's priming as an else-if, the integrated controller's force of the diesel-electric in a function of its own. The golden traces compare bit for bit. * refactor: the GetPF() of the EStED and LSt valves split into their state, releaser and cylinders The blocks moved line for line; the golden traces of every real vehicle's brakes compare bit for bit. * refactor: the KE valve's cylinders and its held state in functions of their own The blocks moved line for line; the golden traces compare bit for bit. * refactor: the FV4a handle's chambers, wave and reductor in functions of their own The blocks moved line for line; the golden traces of every handle position compare bit for bit. * refactor: the MHZ_EN57 handle's time reservoir and supply pressure in functions of their own The blocks moved line for line; the golden traces compare bit for bit. * refactor: the EP2 valve's state and the ESt valve's held state in functions of their own The blocks moved line for line; the golden traces compare bit for bit. * refactor: the relays' commands and the diesel-electric's shunting force split out The blocks moved line for line; the golden traces compare bit for bit. * test: the SonarCloud findings in the unit tests std::format for the texts put together, emplace_back, const references, string_view parameters, std::array and std::vector for the C arrays, the ranges algorithms, names no longer shadowing the coupler ends, comments in the empty loops; start_up(), trace::check() and the converter of the definitions split up. BrakeForceR() is const, which it always was in effect, so the gauges test needs no const_cast. The golden traces compare bit for bit. * refactor: the SonarCloud findings left in Mover.cpp and hamulce.cpp The EStED's intermediate flow is computed by a const function and its caller fills the reservoir; the anti-slip brake's kind is read from a string_view; the doors' remote command no longer shadows the enumerator control; the diesel-electric's tractive force and the camshaft's run-down nest less. The golden traces compare bit for bit. * refactor: the door helpers aren't const, the door they change is the vehicle's own * refactor: the power couplers' voltage and current return early for a coupling which isn't a power one |
||
|
|
040e600bf6 |
Test the 6Dg's power demand in steps of 5% on its real definition (#336)
* test: the 6Dg's power demand in steps of 5% on its real definition The 6Dg's definition from the game data (6dg_v1/6dg.fiz, converted alone with test_fiz.cpp; SVN r9630 gave its UCList line CtrlValStep=0.05) joins the real vehicles of tests/unit/data/fiz. On it: - the key loads as shipped, and the demand of the universal controller (eimic) moves by 0.05 per tap or per step of the held raise and lower positions, 20 steps from 0 to 1 and back, never in between nor past the ends of the table; - with the engine running, the engine revolutions, generator power, tractive force and speed reached grow with the demand (0.25 to 1); - without the key the demand moves continuously, as before #273. * test: no empty loop bodies and emplace_back in the 6Dg power steps test (Sonar S1116, S6003) |
||
|
|
af3d5d9b9f |
CI: one pin of each GitHub Action in all workflows, Dependabot updates for them (#331)
* ci: one pin of actions/checkout and actions/download-artifact in all workflows build.yml moves from actions/checkout v5.1.0 to the v6.1.0 pin build_bin.yml already uses, and the two unpinned actions/download-artifact@v4 in the publish job of build_bin.yml get the v4.3.0 hash sonar.yml already uses (the commit the v4 tag points at today, so nothing changes at run time). * ci: Dependabot updates for the GitHub Actions One grouped pull request a week for all actions, so the hash pins and their version comments move together in every workflow. |
||
|
|
da1f10d6b7 |
feat(cab): i-compartmentlights: lamp showing the compartment lighting (#352)
A cab lamp keyword for the .mmd, lit while the compartment lighting of the cab's own vehicle (mvOccupied) is on: CompartmentLights.is_active, which LightsCheck() works out from the low voltage power and the compartment lights switches. Bound like i-cablight: in the autolights table, so it is bound again whenever the cab's .mmd is read on a change of the occupied vehicle. No vehicle uses it yet. Unit tests of the state the lamp shows on the real Elf definition. Refs eu07/maszyna#456. |