18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 16:27:11 +01:00
Commit Graph

5 Commits

Author SHA1 Message Date
maj00r 348cc2df47 fix(editor): migrated switches leave to the side their records say, bent ones migrate, a record fitting two types isn't guessed
- The migration mapped L to hand 1, but switch_store::classify() writes R where the diverging end lies to the positive cross of
  the direction, which is the side of hand 1 of the domain (its curvature above 0 turns that way). Every migrated switch came
  out mirrored, and the test checked hand == 1 for an L record without looking at where the diverging end lies. R is hand 1
  now, and the test checks the side of the diverging end.
- classify() writes a switch bent into a curve as Rlj or Rld with the radius of the ordinary switch it's bent from; the
  catalogue has it as an Rz, so no bent switch could migrate. They're looked up as Rz.
- catalogue_type() took the first loose match. A movable nose isn't in the record, so the ordinary frog is taken where the
  catalogue has both; a record fitting two other types (the variants of an Rpd) is kept as it was, why with it.
- Slips and crossings are kept as they were, as the header of the migration says.
- Smaller: the type looked up is checked before its length is read; new diverging, slip and crossing tracks get the
  chainage of the turnout as a diverging track had before; the walk of a bent transition stops on a step that turned nothing
  instead of dividing by it.
- Sonar: the leg check skips an end whose turnout isn't found (S2259), the spacing of a crossover is measured in whole steps
  counted in an integer (S2193), the seeded generator of the turnout kinds test is marked (S2245).
2026-11-24 19:15:13 +01:00
maj00r 28a81ee0bd Merge ui/editor-lay-flow into feat/editor-turnout-catalogue
# Conflicts:
#	editor/layout/layoutGenerator.cpp
#	editor/layout/layoutNetwork.cpp
2026-11-24 19:15:02 +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 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.
2026-11-23 14:49:35 +01:00
maj00r 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.
2026-11-23 13:11:47 +01:00