18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 22:07:55 +01:00
Commit Graph

8 Commits

Author SHA1 Message Date
maj00r b267da1d6e Merge branch 'feat/editor-model-in-editor' into feat/editor-legacy-takeover
The section of the anchors is read as anchor records here, its comments skipped as in the rest of the file: the fix of #461 keeping
the lines of the section as they were read doesn't apply, and its test gives way to this branch's.
2026-11-29 22:37:45 +01:00
maj00r 3cfdaefe5e Merge branch 'feat/editor-turnout-catalogue' into feat/editor-model-in-editor 2026-11-29 22:37:13 +01:00
maj00r 9d5e32980f fix(editor): the anchors section keeps its blank lines and comments, a reason keeps its blanks, a scenery including itself is told
- The section kept for the anchors is written back as it was read: its blank lines and its # comments were dropped before the section
  was looked at.
- The reason of a legacy record is the rest of the line as written, its blanks kept: joined with one blank, a reason of two blanks
  came back changed after a save and a load.
- A file of a scenery including itself, on its own or through others, is told and not read again; before, only the depth of 32
  stopped it.
2026-11-29 22:36:58 +01:00
maj00r eb376a2d3e Merge feat/editor-model-in-editor into feat/editor-legacy-takeover 2026-11-24 19:15:17 +01:00
maj00r 14bbd392b2 fix(editor): a save writing some tracks of a line keeps the records of the others, a plan edit refused in part changes nothing
- record_written() erased every record of the line and added only the pieces written in this save, while the scenery writes
  only the tracks changed since. After a gizmo move and Ctrl+Z on one track of a line, the next save kept a record of that
  track alone: on reopening the line owned one track, and the next Plan edit left the others as duplicates. The records of
  the tracks the line still has and this save didn't write now stay.
- model_run() kept each command before trying the next: with the radius of one vertex carried out and the cant of the next
  refused, the first stayed changed under "Refused, nothing changed". Several commands are now all tried on a copy first.
- The fingerprint of the scenario index made a string of every file name before its .scn filter, which throws on Windows
  outside of the code page, on a detached thread (the class of GE#560). The extension is looked at first, as in the index
  itself; scenery_text::name_of() and has_extension() are shared by both.
- A Del deferred by the check of the scenarios reads Shift as it was at the key press, not at the click on "go on".
- open_project() writes no project file for a map with nothing to migrate (#461): the session test expects that.
2026-11-24 19:15:15 +01:00
maj00r b15f7dcdec fix(editor): file names outside the code page don't crash the project, includes are found in any case, a project file cut short isn't put in place
- The scenario index made a string of the name of every file in the folder, which throws on Windows for a name the ANSI code
  page can't hold (the class of GE#560). It looks at the extension first and leaves out a .scn the game couldn't open by its
  name either; the messages of the project file show paths as UTF-8.
- The includes are read with the FileCased() fallback of the game (scenery_text::file_text), so on Linux an include written in
  another case no longer drops the scenario from the index, skips the migration of its file or marks its tracks as changed by
  hand.
- save() closes the file before looking at it: a failed last flush no longer renames a truncated .new over the project.
- "next node 0" is refused instead of wrapping to 0xffffffff.
- open_project() writes no .eu07proj when there were no //$ lines to migrate, and asks exists() without throwing.
2026-11-24 18:54:33 +01:00
maj00r 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.
2026-11-23 16:59:29 +01:00
maj00r 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.
2026-11-23 13:11:46 +01:00