18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-19 22:44:59 +01:00
Files
maszyna/CMakeLists.txt
maj00r e6fa206e47 Split stack 3-5c into master (switch blades, 3D sleepers, editor core, SRK stations, tutorial) (#289)
* feat(track): the rail code split by concern, the blades of the switches with the key frogs shaped from their templates

The rails are laid by code of their own instead of inside Track.cpp: gauge lines (GaugeLine), knot lines (Knots.h), crossings and check rails (RailCrossings), rail materials (RailMaterials), measuring the rail profile (RailProfile), planning the cuts (RailPlan), the carving scan (RailCarve) and laying the geometry (RailLayer).

A switch with the key frogs draws its blades from the tip where their planed nose ends to the heel, bent as they're thrown, and the rail behind them from the heel on, where they were laid from the start of the switch before; on a switch of the catalogue they start at the cut tip of the tables, 1.248 m from the joint at R 190, 1.5 m at R 300 (track_features::blades). The frogs cut from the rails, the wing and the check rails are built but switched off (track_features::crossings), the rails laid whole as before. The switches without the key keep the blades they had.

A switch path can be a chain of pieces: pieces1 and pieces2 keep the parts of each path after the classic bezier, which stays as the approximation older versions read. A path with its radius given is a curve however gently it bends, a plain track a straight only where both of its control vectors lie along it. A vehicle trailing through a switch with a movable nose set the other way runs off the rails at it (TRAILED_SWITCH).

* feat(render): the shared treads of the rails and their cut faces drawn, the cut faces in the matte variants of the rail materials

Both renderers draw the treads a track shares with the rails it crosses, in the pick pass too, and a pass of their own for the faces where the rails are cut, the ends of the blades among them, in the matte variants of the rail materials, so the cut faces don't shine like the head the wheels polish.

* feat(vehicle): an axle on a switch keeps to the path it came on, and coming from the frog end trails the switch through where the wheels reach the blades

The switch thrown under an axle no longer moves it over onto the other path; it runs on along the one it entered. Coming from the frog end, where the blades are shaped or the frog has a movable nose, the switch set the other way is trailed through (rozprucie) only where the wheels get to the blades or to the nose, not as the axle enters the track; the other switches are trailed through as it enters, as before.

* fix(track): the tracks drawn straight before, which their second control vector bends now, written to the log

The simulator told a straight by the first control vector of a path alone, so a track whose second control vector bent it was drawn straight; now it's a curve. Such a track is named in the log as it loads, so a scenery made counting on the straight can be found: 25 tracks of lk357. Paths with both control vectors along them bend a centimetre or so at most and aren't named.

* feat(track): 3D sleepers and switch timbers laid where the simulator makes the ballast, switched off in the build

The sleepers of a track running alone are laid square to it, the timbers of the switches and crossings across the tracks running over them, shared by them, of the models set with sleepers3d and sleepers3dplain in eu07.ini; sleepers3dbed tells whether the ballast is laid under them too, lowered so they stick out of it. The layout of a cluster of tracks is worked out once and kept till a track of it changes, in a thread of its own while the simulation runs. timbermodel of a track, read and written back before, takes the place of the model of sleepers3d there. All of it is off whatever eu07.ini sets (track_features::sleepers), the tracks keeping their ballast and their sleeper models.

* feat(render): the 3D sleepers and switch timbers drawn in instanced batches

Render_Timbers lays the beams of the tracks in range where they're out of date and draws those of a run of tracks of a cell gathered by the model and its part or its level of detail, in as few instanced batches as they fit in; in the shadow pass only those near the camera. A track with them leaves its old sleeper model out. OpenGL 3.3 renderer only.

* fix(track): the counts of what's wrong with the sleepers kept safe from the thread laying them, and that thread stopped before what it works with goes

The counts of the beams clipped, dropped and off the plane, of the slowest and the biggest cluster, are counted by the thread working out the layouts in the background as well as by the simulation laying a cluster itself, and were plain values written by both; they're atomic now. What the thread keeps the clusters in, their version and the counts were made after the worker, as it first asked for them, and so destroyed before it at the exit while its thread could still be laying a cluster; they're made first now, the worker stopping and joining its thread before they go. The tracks go with the paths of the simulation, made before the worker.

* revert(track): a tributary and a track of an unknown type load as before

They came in with the rail code from the guards of the editor against crashing, and don't belong with the blades: a track of an unknown type loaded as a normal track of the railway could be joined to it and run on, and a tributary loaded as a river with its first path lost the second one when the editor saved the scenery. Both load as on master again; the place where the editor crashed on them is to be guarded where it is.

* fix(track): the tracks drawn straight before named in the log once, as they load, and the paths of the switches with no radius told a straight as before in one term

The log of the tracks the second control vector bends now was written each time the segments of a track were made again, as a track with its unevenness loads and as the editor changes or drags a track; it's written only the first time, as the track loads. The paths of a switch or a crossing with no radius keep the rule of master, a straight told by the first control vector alone, its two terms being the same length; they're one term now, with the comment saying so.

* fix(track): the thread laying the sleepers stopped as the application exits, and loading no models itself

The thread reads the scenery, which the application deletes as it exits well before the statics go: it's stopped and joined first thing in exit() now, the worker destroyed with the statics only where the application exits some other way, and not started again after. The models the beams are made of were loaded by the thread where it didn't find them, through the renderer, out of the thread of the renderer, into a map read by the simulation meanwhile: they're found under a lock now and loaded only by the threads other than it, again for all the tracks whenever a track changed since, before a layout is asked of it. With the 3D sleepers off in the build their settings aren't exported, and a track changed doesn't look for the tracks around to lay their beams again.

* feat(track): the 3D sleepers turned on with sleepers3d in eu07.ini, no longer switched off in the build

track_features::sleepers is gone: sleepers3d <model> in eu07.ini lays them, none (the default) lays nothing and the
tracks keep their ballast, as before. The sleepers3d settings are written back with the others.

The editor changes the tracks, so while it's open their sleepers are worked out on the main thread as they're needed,
not in the background.

* fix(render): only the part of a timber model drawn, not what else the model holds

A timber model of parts may hold more than its begin, main and end, as the kits with the fastenings of the rails do. Those
were drawn with each part of each timber, in the middle of the track; they aren't laid, so they're skipped now.

* fix(track): the 3D sleepers laid only for a renderer which draws them

Only the OpenGL 3.3 renderer draws the beams. With another one a track set to them lost its ballast to them, lowered or
not laid at all with sleepers3dbed no, and nothing was drawn in its place. Draws_Timbers() of the renderer tells now,
and where it's false the tracks keep their ballast, as with sleepers3d none.

* fix(render): the submodels of a timber model left as they were after its parts are drawn

They were all made visible after a part was drawn, the ones the model hides itself too, like Light_On, while the same
model may stand in the scenery. The submodels of the top level besides the parts are listed as the model is loaded,
hidden while a part is drawn and given back their own visibility after. The parts have to be at the top level of the
model for that; a model with them deeper is logged and drawn whole.

Render_Timbers no longer looks the model up under the lock for every run of tracks, the name set is enough there.

* fix(render): a vertex whose faces give its texture no direction gets a tangent across its normal, not a NaN one

The cut ends of the rails have one spot of the texture on all their corners, so their tangent came out of normalize() as NaN. The normal-mapped shaders then shaded them with a NaN normal: about half of the vertices of the cuts and frogs, and the end faces of the rails.

* feat(track): the frogs cut from the rails turned on with frogs in eu07.ini, no longer switched off in the build

frogs yes cuts the rails of the plain tracks and of the switches with the key frogs where they cross other rails, into frogs, wing rails and check rails. It's off by default: the rails are laid whole as before, the blades of the switches with the key are shaped still.

* refactor(editor): the track mode file split into the files of its tools, the code as it was

A pure move, so that the commits after it show what changes in each tool rather than a 4800-line file rewritten.
The member functions of editor_mode go to the file the editor of this branch has them in: route, straights, lay,
switchplace, switchdrive, switchtool, trackgizmo, and the rest stays in editormodetrack.cpp. The helpers of its
anonymous namespace go to editormodetrackshared.h, as they were but inline, in namespace track_mode, which the files
use. No line of code changes; the files add only their license, includes and the using line.

* feat(editor): the groundwork the tools of the editor share

- The tool interface (editortool.h), the gestures of the mouse (editorgestures.h) and what the modes share
  (editormodeshared.h); the projection, viewport, selection and texture picking taking them up.
- Scripted input (scriptedinput): the input of a selftest script fed to the editor as if typed and clicked, the real
  mouse and keyboard ignored meanwhile; EU07_EDITOR_SELFTEST_HIDDEN draws into a window never shown nor focused.
- The ui layers and panels of the editor, its settings, icons and the info of the includes; the layers of the scenery
  and their saving; the launcher mode.
- utilities: user_cache_path (the cache folder of the system for the user) and the helpers of the translations.
- stb_image: the gif loader takes the frame two back from the frames it decoded, not from before its buffer.
- tools/editor: the scripts making the headers of the drives, the turntables, the editor and its usage.
- Unit tests: test_area and the stubs of the editor the tests link.

Not built on its own: the tree builds again with the selftests commit, the one before the translation.

* feat(editor): the tracks laid along an alignment, to the PKP PLK norms, with their grade line and the ground

- The alignment of the laying (editorAlignment, editorAlignmentStore): straights, transition curves and arcs with the
  cant of the norms for the speed, the radius below the minimum for it a warning; the lay, route and straights tools
  build on it, the route plan reading the curves going on from the tracks adjoining.
- The grade line (editorProfile, the profile and gradeline tools): fitted to the terrain model or edited by hand, the
  tracks fitted marked in the scenery (//$f), the shared grade lines of nearly parallel tracks (//$n).
- The ground under the tracks (editorGroundFollow, trackbed): the terrain drawn to the tracks and restored, the tracks
  put onto the terrain.
- Connections between tracks (editorConnections, the connection and connection curve tools), the track presets, the
  shape of a track (editorTrackShape), digitizing tracks from the orthophoto, the properties sheet of the tracks
  (trackprops) and the track ux.
- Unit tests: alignment, ground fit, heights, with the data of two fits.

Not built on its own: the tree builds again with the selftests commit, the one before the translation.

* feat(editor): the switches placed, slid and designed from their templates

- The switch templates (editorSwitchStore, the template tool): the catalogue switches and the user's own, kept with
  the settings; the designer (editorSwitchDesign) with a drawing of the dimensions, a and b typed in with the shape
  making up the rest, a switch clicked off the orthophoto.
- The curve of a switch laid into a curve (editorSwitchCurve), placement on a straight or into a curve, slide along
  it, crossovers and double slips (switchplace, switchslide), the drives of the switches (switchdrive) and the records
  of the switches placed (records).
- Unit tests: test_switch_curve.

Not built on its own: the tree builds again with the selftests commit, the one before the translation.

* feat(editor): the tools of the infrastructure beside the tracks

The gauge, speed, joints, lineside, parallel tracks, vehicles, signals, turntables, sweep and road tools with headers
of their own; the kilometrage of the lines (editorKilometrage, the km tool); the infrastructure, roads and speeds
behind them (editorInfra, editorRoad, editorSpeed).

Not built on its own: the tree builds again with the selftests commit, the one before the translation.

* feat(editor): the terrain model of geoportal.gov.pl and the orthophoto downloaded for the editor

- editorNmt: the squares of the terrain model at 1 m (NMT GRID1, the WCS service of geoportal.gov.pl) fetched by two
  workers, kept in editor/cache/nmt/grid1 of the game folder, the heights of the scenery taken from them; the nmt
  mode loads it along the tracks or around the camera.
- editorHttp: the HTTP client of both, WinHTTP on Windows, libcurl elsewhere where it's built with it; without it the
  caches only.
- The orthophoto: its cache moved to the cache folder of the system for the user, the download area a polygon on the
  topo map (//$a) filled in the background, the 4K imagery, the tiles waiting outlined on the ground.
- editorGeoMap: the topo map of the top view; heightmapterrain and the terrain streamer grow the terrain made from the
  model around the camera.

Not built on its own: the tree builds again with the selftests commit, the one before the translation.

* feat(launcher): the scenery wizard picks the place of a new scenery on the topo map the editor shares

The wizard drops its own map download and decoding for the topo map widget of the editor (editorGeoMap). The place
clicked becomes the geographic reference of the new scenery (//$g PUWG1992), and the scenery starts with the
orthophoto of the editor on (//$o), lying under it in place.

Not built on its own: the tree builds again with the selftests commit, the one before the translation.

* feat(editor): the tools wired into the editor mode and the build

editor_mode takes the tools of the commits before: its header declares them, editormode.cpp and the track mode drive
them, and the renderers draw their overlays (opengl33 and legacy). CMakeLists lists the new sources and adds
WITH_EDITOR_SELFTESTS (off by default); the unit tests build the new test files.

Not built on its own: the tree builds again with the selftests commit, the one before the translation.

* feat(editor): the selftests of the editor split by what they test

The scripts of EU07_EDITOR_SELFTEST run the commands of editormodeselftest*.cpp: scene, track, rails, join, switch,
signal, sleepers, sweep, terrain, monkey. The code is in every build; only with WITH_EDITOR_SELFTESTS=ON does the
editor read the variables and run a script. The selftests of master now need the option too.

The tree builds again with this commit.

* feat(editor): the Polish texts of the editor, all of them in one update of editor_pl.po

* fix(editor): the marks of the editor moved off the letters the starters read, and its lines told by their words

The starters read some letters in a scenery file: the Starter the title //$n, the attachments //$f and the old scenery //$a,
StarterNG and the launcher of the game the attachments //$f and the title //$n. The editor wrote its download area,
shared grade lines and fitted tracks under them, and took every line of those marks as its own: saved, a scenery lost
its title and attachments, and the starters showed the lines of the editor as them.

- The download area is //$z, the shared grade lines //$w, the fitted tracks //$t.
- Their lines and those of //$o are told by their first words, as //$h, //$r and //$k were: //$o only as "on 0" or
  "on 1", the origin or the settings of older builds after it, so a trainset described as "on ..." isn't taken.
- The lines older builds wrote under //$a, //$n and //$f are read only by the words the editor wrote in them, or by
  its own comment line before them, under the new mark. Each save writes them again with it, also when the editor
  didn't change them; the lines of the starters stay.

* fix(editor): a square of the terrain model cut short isn't read, and the squares are kept in the user's cache

The service puts the directory of its GeoTIFF before the pixels, so a file cut short by a write or a fetch broken off
was read whole, the pixels missing coming out as heights of 0 m, for good.

- The reader (editorGeoTiff.hpp, with unit tests) wants all the strips the rows need, each within the file.
- A square is written under a name of its own and renamed.
- The squares are kept in the user's cache folder (nmt/grid1), as the orthophoto, since the game folder may not be
  writable; without one, in the game folder as before. The ones older builds kept there are moved over as each is
  asked for, a damaged one deleted.
- Capabilities that didn't come aren't kept as the fallback name for the session: the next square asks again.

* chore(editor): the http client said to serve the terrain model and the topo map too, the gif fix of stb_image marked local

- CMake names the orthophoto, the terrain model and the topo map as what goes without libcurl.
- The fix of the gif frame two back in stb_image is ours, not upstream's (v2.30 still has the old line): a comment at
  the line says so, for an update of stb_image to keep it.

* fix(editor): the lines moved off the letters of the starters in a merged layer written once, not again with each save

A merged layer's text goes into the file of its target on save, and the target is read again; the marked lines of the
merged layer were dropped only for the marks the editor had changed. The lines moved to the new letters stayed with
their old places, and the next save of the session wrote them into the target once more.

- After a save, the marked lines of every merged layer are dropped; those of its target are read again from its file.
- The lines of a dead layer aren't written again.
- The selftest layermerge merges the layer of one file into another's, as the layers panel does.

* feat(editor): the station as the signalling sees it, found from a switch of it, and its schematic

editorStation: the switches joined by plain track no longer than 1.5 km, the tracks between them and the lines leading
out, 400 m of each beyond the outermost switch; laid out as a schematic along the main track through the station. The
track circuits, the signals and their lights, the lengths of the station tracks and the lines to the next stations are
worked out from it for the signalling tool.

Nothing uses it yet: the signalling tool, wired in the next commit, does. It builds on its own.

* feat(editor): the signalling of a station in the Signalling tab, laid out from a switch of it as on the lines of PKP PLK

LMB on a switch in the Signalling tab opens its station: the schematic in a window of its own, the name, the code, the
line and the km of the station, and the steps of its signalling, each one step of undo:

- the switches numbered along the station after its code, bpd_1, the parts of a slip bpd_15a..d; the drives and the
  objects naming a switch follow it, events written by hand keep the old names;
- the tracks cut at the joints of the track circuits, Ie-4, and the circuits named, bpd_iz1, bpd_it1;
- the entry, exit and shunting signals placed and named, A, F1, Tm1, from the templates chosen;
- the signals of the lines out: the automatic block of three or four aspects, the block sections no shorter than the
  braking distance, or the semi-automatic one with a warning disc; block boundaries drawn by hand;
- the lights each signal needs for its routes, Ie-1 and Ie-4 § 8, its template fitted to them;
- the SHP track resonators the signals lack, rezonator.inc;
- the lengths of the station tracks as a table, and what the station and its lines still lack, with Repair.

The stations described are kept as //$s lines in the files of their layers.

* fix(editor): the signals of a station and of its lines not placed with no template for a kind, no track cut for them first

- Set the signals and Set the line signals cut the tracks first, and only then found no template for a kind. They
  stopped there, but the cuts stayed as a step of undo. Now they ask for the templates first, by the lookup
  signal_batch() uses (signal_template_for(), behind editor_signals::signal_templates_missing()). Without one
  nothing is cut.
- Set the signals and Set the track circuits again under Track lengths had the ids of the buttons of the steps
  above them. ImGui flagged them when hovered. Each now has an id of its own.

* fix(utilities): win1250_to_utf8 turns the polish letters into utf-8, not into themselves

utilities.cpp starts with a byte order mark, so the compiler reads it as utf-8. The game's targets don't get
/utf-8, though: set_target_properties(... COMPILE_OPTIONS ...) in the MSVC block of CMakeLists.txt replaces the
options add_compile_options gave them. So the string literals went into the program in the code page of the
system, windows-1250 on a polish one, and the map of win1250_to_utf8 turned each letter into itself.

What read windows-1250 through it got no utf-8: the names, descriptions and categories of the sceneries and the
names of the textures in the launcher, and the descriptions of the templates in the editor. The editor writes
such a description back through utf8_to_win1250, which makes a question mark of each byte that doesn't start
a utf-8 sequence, so the letters it had read unchanged didn't come back.

The utf-8 sequences are written as bytes now, the way utf8_to_win1250 has them, so they don't depend on the
options. The options stay as they are: with /utf-8 other literals of the files with a byte order mark would
change, the "±" of the table of Bezogonkow would take two bytes and move the letters after it.

The unit tests check the letters and that the text given is valid utf-8.

(cherry picked from commit 9ffed96ec1)

* fix(editor): the switches renamed only after the events by their old names are shown, the station records in windows-1250 and in the file the scenery had

Number the switches renames the switches and what the editor writes along with them, but not the events written
by hand: a switch event aiming at a switch, or <name>:event0 and the others named after it, would keep the old
name and lose its switch. Now the first click lists them in the status, up to six and how many more, and renames
nothing. A second click with the same renames goes ahead.

The name of a station is written in windows-1250, like the rest of the scenery file. A name read that isn't
valid utf-8 is taken for windows-1250; the utf-8 the earlier builds wrote is read as it is. utf8_to_win1250
moves from editorIncludeInfo.cpp to the utilities, beside win1250_to_utf8, and the unit tests check both ways.

The record of a station that had none goes beside the records of the other stations, in the file marked with
them, so a scenery saved under another name keeps them in one file. output_layer takes, after
<scenery>_<part>.scm, an included file of the part of another name, the one of the scenery it was copied from,
before it makes a new one.

The comments: the joints of the track circuits stand 4.2 m beyond the fouling points, where the axes are 3.5 m
apart, as joints() counts them; the regulation of the lengths is cited with its date and title.

* fix(editor): a scenery saved under another name keeps one file of the keys by the movable noses, not the old one beside its own

The editor writes the keys by the movable noses on each save to <scenery>_dzioby.scm and includes it. A copy of
a scenery, saved under another name, still included the file of the scenery it came from, and its save wrote a
file of its own and included it too, so each key stood twice.

Now the save leaves out of the scenery the other files of such keys it includes, told by the line the editor
writes at their start. Their files stay on the disk, for the scenery they were made for. A file made by hand,
without that line, stays included. The turntable controls had the same, fixed the same way on their own.

* fix(editor): a file of the scenery named like a part of a tool isn't taken for the one the tool made

output_layer took, after <scenery>_<part>.scm, any included file named *_<part>.scm, so that a scenery saved under
another name goes on with the file of the scenery it was copied from. A file of the scenery named alike, written by
hand, such as rejon_teren.scm, got the terrain directive, the hectometre posts or the new signals too.

The files output_layer makes start with a line of their own now, "// scenery layer created in the editor for its
<part> part", and a file of another name is taken only with that line. A layer gets it through the new parameter
of scene::node_layers::create(); the others start with the general line as before. <scenery>_<part>.scm of the
scenery itself is taken without the line, as it was. A file made for a part by an earlier build has only the
general line, so a copy saved from it gets a file of its own.

* feat(editor): a player of GIF clips for the windows of the editor

editor_clips::clip plays a GIF in an ImGui window, looped, from the time given. stb_image decodes the whole
file on a thread of its own, so the window isn't held up; until then the clip says it's loading. The frames are
kept as stb_image decoded them, and the one shown is a texture of the ImGui renderer (Create_Image), made again
only when the frame changes. A file that isn't there is told missing at once, with no thread started.

Nothing uses it yet; the tutorial of the next commit shows its clips with it.

* feat(editor): Help > Tutorial, fifteen short lessons of the editor

The lessons: looking around, laying track, curves, the radius of the curves at the bends, correcting a curve,
joining tracks, switches, switch templates, signals and posts, selecting and fixing, editing with the gizmo, the
grade line, terrain from the terrain model, sceneries made before, saving and driving.

Each lesson has:
- in eight lessons, a looping clip from lang/editor_tutorial/<lesson>.gif, played from the start on a click;
  in six others, a moving drawing (the radius at a bend, a switch template clicked, the signals, the grade
  line, the terrain, a trainset);
- the mouse buttons and keys drawn as pictures beside what they do;
- ticks that fill in as the user does it, told by the tools through editor_guide::first_step_done();
- a button that turns the tool of the lesson on;
- Back / Next and a dot per lesson, green when the lesson is done.

The window follows the work: when the tool in use changes, it turns to the first lesson of that tool not done
yet, and a page turned by hand stays until then. In a lesson of laying it warns when there's no ground under
the cursor.

Where it opens:
- by itself when an editor session starts, until "Show when the editor opens" is unticked (first_steps in the
  editor's settings);
- from the Help menu;
- from a Tutorial button beside Lay a track in the hint of an empty scenery, which isn't drawn while the
  tutorial is open;
- at its lesson, from a "?" by the radius at the bends in the lay panel.

A lesson whose clip isn't there is shown without it; the clips aren't in this commit.

editor_guide is a new role of the editor, given to the hekto-post and trainset tools. Selftest command
tutorial <page>: opens the tutorial at a lesson, from 0; -1 closes it.

* fix(editor): the lessons of the tutorial say what the editor does

The lesson texts checked one by one against the tools; the ones that told otherwise:
- Switches: a connection isn't chosen at the top of the panel, its kind comes from where the drag is let go (a
  crossover onto the other track, over a crossover the other way a double one, or scissors where they overlap).
- Switches: a ladder leads onto the parallel tracks it's dragged across, let go on the farthest, with the
  straights up to where they start; it lays no missing tracks.
- Terrain: there is no step 3. Step 1 is Location, step 2 is Load around the camera while there are no tracks
  and Tracks and terrain with its three ways once there are. The rows had the step numbers in the keys column,
  and 1, 2 and 3 switch the edit modes in the Terrain field. Now the steps show the mouse, the terrain under
  some tracks only is a row of F3 (the line the terrain panel shows), and the rows that only tell what the
  fit does have no key.
- Sceneries made before: a plain include can be changed; the row lists what can't: an include template (.inc),
  the binary terrain cache, a file included twice or with parameters, a locked or hidden layer.
- Laying: the second Esc drops the points only within 3 s.
- The radius at the bends: two transition curves from 6000 m down to 2000 m while they're long enough for the
  speed, then an arc; a label turns orange where the curve breaks the norms, not because it came out smaller;
  two transitions meeting read 2xL and R; the labels of each transition curve are on laid tracks, close up.
- Signals and posts: the W17 markers go by the selected switch, around the camera or the whole scenery, not
  along a line.
- Selecting and fixing: E lengthens the track, the control vectors bend it.
- The gizmo: at a point Q moves the point alone, W turns the whole track about it.

The tooltip of Help > Tutorial no longer speaks of clips: the tutorial goes without them. lang/editor_pl.po
has the new texts.

* fix(editor): the lessons of the tutorial in plain words

Every row, goal and warning of the tutorial is said again for someone
who has never laid a track, in English and in Polish:
- the words of the railway and of the editor are said in everyday ones,
  or explained where they come: the radius (how big the curve is), the
  transition curve (the easing into it), the cant (the outer rail
  raised), the gizmo (handles on the track), the control vectors (points
  that bend it), the grade line (how the line goes up and down), the
  terrain model (the real ground), the orthophoto (the aerial photo),
  the hectometre posts (every 100 m), W17 (how far a wagon may stand);
- what only a designer needs is left out: the 6000 and 2000 m of the
  radius ladder, the compound curve, the hump, the kinds of include that
  can't be changed;
- the buttons are named as the panels name them: Apply to the scenery,
  Template editor..., the tiles of the switch tool;
- the Polish names of three lessons say what they are about ("Uchwyty na
  torze (gizmo)", "Wzniesienia i spadki", "Prawdziwy teren"). Their
  English titles stay, the lessons are found by them;
- the warning of no ground under the cursor tells what happens to the
  track;
- two captions of the drawings say what they show (the tracks inside a
  box, posts every 100 m), and in Polish the button of the top view is
  "Widok z góry (O)", without "ortogonalny".

What each row tells of is the same as before. The msgid of the length
typed while laying stays, the window of the keys (F1) uses it.

* feat(editor): the semaphores and the warning discs chosen by what their descriptions say they show

The descriptions of the signal templates can now say what a semaphore shows and what a disc
repeats, and the editor reads it:

- signal: {arms: 2, aspects: {Sr1: ..., Sr2: ..., Sr3: ..., Sz: ...}, repeats: {stop: ...,
  vmax: ..., "40": ...}} is kept with the template, the events named for each aspect
- the palette shows a template with arms as a semaphore of its arms, with 1 arm / 2 arms and
  Sz picking the template of the same tile that has them
- the signals of SRK take a semaphore whose aspects cover what the signal needs (Sr3 where a
  speed is reduced, Sz on the main signals), the fewest arms that do it, and say which one
  does when the placed one hasn't them or has more than it needs
- the warning disc before a semaphore is one whose repeats cover stop, the highest speed and
  40 km/h when the semaphore shows Sr3; SRK writes no events of the routes, so this only
  chooses and checks the disc
- the linked signal (parameter 7) is read for the role link as well as text
- signal_headers.py keeps the keys written by hand in a description (arms, aspects, repeats,
  the description and the parameters from 6 on) when it writes the guessed ones again
- signaltemplates of the self test lists what the templates say and the heads made of them

* feat(editor): the shaped discs swapped and set by hand, the warning discs checked by what they repeat

The shaped shunting and stop discs (mk1, tzm, z1) are known to the signalling, but it doesn't
place them by itself:

- a shaped disc chosen in the palette for the shunting or the stop signals is placed by hand
  only; the signalling of a station takes the light template of the kind there, and says so
  when there is none
- the template of a shunting or a stop signal standing can be swapped for a light or a shaped
  one of another mount as well (dwarf and mast, not gantry)
- a signal whose description lists its aspects shows a button for each under its card: it sets
  the signal to that aspect in the editor, by the animations, the lights and the submodels its
  event sets off, the time standing still; nothing of it is saved. TAnimContainer::Finish takes
  an animation to its end at once, giving the submodel its angles, multi_event::branches tells
  the events set off when the condition isn't met

From the review of the descriptions:

- a shaped warning disc standing before a semaphore described is checked by the events it
  repeats: stop, the highest speed and 40 km/h of a second arm told apart; one which doesn't is
  offered the disc which does, and Fit swaps it
- the disc offered is of the mount of the disc chosen, taken from the template even when it
  isn't described
- 1 arm / 2 arms / Sz of the palette pick the template leaning as the chosen one and most like
  it by its name
- a semaphore described with its arms but not its aspects has Sr1, Sr2 and with a second arm
  Sr3
- Fit leaves a semaphore having what it needs with its arms, for the events written by hand to
  the aspects of a second one; the messages of the fitting speak of what the signals need, not
  of their lights
- signal_headers.py warns of a signal map written as a block, whose keys it can't keep

* fix(editor): an aspect shown by hand doesn't name a vehicle that may be gone

The Show button runs the events of the aspect outside the queue. run() writes
the vehicle that set the event off last into the log, and nothing clears that
pointer, so a train deleted since would have been read after it was freed. The
queue sets the activator anew each time, so it is cleared before the run.

* fix(editor): a disc not described is only offered the one that tells, a light stand-in of the mount of the shaped one

- A shaped warning disc whose template doesn't say what it repeats may tell
  all its semaphore shows as well. It is no longer marked as not fitting:
  the disc described is offered as a hint, and Fit leaves it be. A disc whose
  template isn't among the scanned, its mount not known, is offered nothing
  rather than discs of any mount.
- A shaped disc chosen for shunting or stop is stood in for by a light
  template of its own mount first, a dwarf for a dwarf.
- The tooltip of the aspect buttons says the trains read the signal as its
  events set it last, in a run started from the editor too.
- The Polish texts of the fitting speak of signals, not semaphores, since it
  takes the discs too.

* refactor: the Sonar remarks on the switch blades taken care of

- the big functions of the rails split into helpers with one job each:
  the carving, the laying and the planning of the rails, their
  crossings, the blades, the lofted spans of a segment, the profile of
  a rail measured piece by piece, the joining of the switches
- the floating-point loop counters are while loops doing the same
  additions, so the samples come out where they did
- C arrays are std::array, the two sides of the paths path_sides; the
  ends of a cut are two parts of one struct, ending and starting
- the rail laid by a course of its own, not eleven parameters
- the globals kept in functions, the nested ternaries taken apart, one
  declaration per statement, explicit captures, ranges algorithms,
  std::format, std::numbers, emplace_back, structured bindings
- the region finds the sections around a point into a list the caller
  gives, so the search for the rails around a track shares no list with
  another thread
- check_rails and create_track_rail_profile are const, the pool of the
  reused chunks can't be copied

The geometry of every chunk of lk357 and td_fog, with the frogs on and
off, comes out the same as before.

* refactor: the Sonar remarks on the 3D sleepers taken care of

- the big functions of the sleepers split into helpers with one job
  each: the clusters and the lines of timbers, the gaps under the rails,
  the models and their parts, the check of the layout, the drawing of
  the timbers in instanced batches
- the tracks near a track found into a list of their own, the region
  searched into a list the caller keeps, not the one the region shares
  with the main thread; the callbacks are templates, not std::function
- the layout of a cluster takes a span of its tracks
- the globals kept in functions, the parts of a beam int constants,
  beam_overhang no longer hidden by a field of the same name
- scoped_lock, jthread, contains, ranges algorithms, std::format,
  emplace_back, structured bindings, explicit captures, upper-case
  literal suffixes, one declaration per statement
- the uniform buffer takes a span of bytes

* fix(editor): the editor core builds with GCC again

- kCrossoverStraights is constexpr, so the connection curve can take it into
  a constant expression; GCC refused a double that was only const there.
- the track_hover alias inside editor_mode dropped: declared after
  hovered_track had already used the name, it changed what the name meant in
  the class (-Wchanges-meaning); the definitions name the shared track_hover.
- <cstring> included where the rail self-test uses std::memcpy, which MSVC
  reached through other headers.

* refactor: the second round of Sonar remarks on the switch blades

- the carve of a throwable part takes the cut before it only where there
  is one, as only that cut makes it throwable
- the splitting of a grooved profile by the floor of its groove moved out
  of the rail layer into a class of its own, which is given the profile,
  the size of the rail, the texture of the plates and the side
- the rail drawing is made by a const function
- the triangles of an ear-clipped outline go in as the arrays they are,
  the search for a corner within an ear is an any_of, the loop pruning
  thin corners keeps the count it started with, as it stops at the first
- the bytes of the blocks of a texture are taken off the file through
  its buffer, with no cast of their storage
- the log of a carved part takes the tracks around it as a span
- the joint length of a switch, a constant, isn't captured, and the
  directions at the ends of a crossroads are tested in one condition each

* refactor: the Sonar remarks on the tutorial

- the window of the tutorial in smaller pieces: the steps reached, the
  lesson followed and its clip, the clip or the sketch of a lesson, its
  keys and steps, the button under it and the buttons of the pages; the
  lessons are a table of their own, the button of each kind of lesson
  picked from a switch
- a clip whose delays add up to nothing shows no frame instead of
  dividing by them
- the frames of a clip are decoded by a function of their own, on a
  thread kept with them and joined once it's done, or as the editor
  closes, instead of a detached one
- the sleepers of the signal sketch counted by a whole number, the texts
  of the sketches made by std::format, their points kept in std::array,
  the whole numbers turned into floats where it's meant

* fix: the bugs and vulnerabilities Sonar found in the editor core

- the loops stepping along a track, a curve or the view count their
  steps by a whole number and take the station as so many steps from
  the first, instead of adding a fraction up, which drifts
- the self-test of the guard rails keeps the plan of the rails of the
  track against while it goes through them: the range of the loop was
  in a plan made for it and gone before the loop began
- the generators of the self-tests and of a unit test are seeded on
  purpose, so a run can be repeated: marked for Sonar as such
- the tool writing the descriptions of the templates takes the names
  out of its tables only where they stay in the data folder

* fix: the loops of the signalling stepping by a whole number

the places of the block signals along a line and the marks of the
chainage under the plan of a station are counted by a whole number and
taken as so many steps from the first, instead of adding a fraction up,
which drifts; Sonar took the counters of floats for bugs

* refactor: the checks of the signal heads and the signal sheet in smaller pieces

the remarks Sonar made on the signal descriptions: the warning about
a disc on the mount of a signal is worked out by a function of its own,
the fit and the aspects of a head, the swap of a template and its
aspects in the sheet of a signal are drawn by members of their own, the
walk over the events of a signal is a free function instead of a
std::function held by a lambda, and the description of an include is
read a part at a time; the names of the kinds are kept in a std::array
and looked up by the algorithms of ranges, a name is taken as a
std::string_view where it is only compared, and the locals named event,
which hid the enumerator, are renamed

* style: a space after a comma in the join self-test

* style: a space after the question mark in the terrain sketch

* style: a space after the question mark in the status of the fitting

* refactor: the last Sonar remarks on the small fixes

the opening of a scenario catches the exception the scenery throws when
it can't be read, not any runtime error; the vehicle moved between
trainsets keeps its source by a reference to const; the messages of a
track of an unknown type and of a tributary are raw string literals;
the parser opens a file by a std::filesystem::path, and the log of a
file it can't open still names its folder and its name

* refactor: the crossings of a track found without casting its const away

the radius of a node can be read off a const one: radius_() is const
across the nodes, the ones of the tracks and the models marked override,
and a const radius() gives the radius worked out already, or works it
out anew without keeping it; the helpers finding the crossings of a
track only read it and take it const, its own run of rails typed apart
from the ones of the tracks it crosses, which the crossings found name;
the triangles of a filled outline are pushed as named corners

* refactor: the paths around a track sampled without casting its const away

the sampling of the paths and the clusters of tracks laid together only
read the tracks, so they take and keep them const: the path sampled
points at a const track, the tracks near one are found from a const one
by its const radius, and a cluster holds const tracks; the shared zones
of the timbers no longer cast the const of their track away

* fix(editor): the Sonar blocker remarks on the stack, no side effects in the operands of && and ||, no local named final (S912, S1669)

Counting the leftover signals, the pieces of a station walk, the places with nothing beside a run and the joints and fouling points
logged by the self-tests no longer counts inside a condition; the last span of a straight is named tail. The counts and what they
log are the same.

* revert(vehicle): an axle on a switch follows the switch as it is set, as before the stack

The axle kept to the path it came on, so a switch thrown under a moving train no longer sent the rest of it onto the other
branch, and coming from the frog end it trailed shaped blades only where the wheels reached them. That changed the running of
every switch in every scenery, and the AI still scans its route by the switch as set. TrkFoll is as on master again, and the
trailing point of the blades it used is gone.

* revert(track): a path is told a straight by its first control vector alone again, as the sceneries are made for

A plain track was drawn bent where its second control vector was off the chord though the first lay along it, and a path with a
radius given was never straightened. Tracks of existing sceneries drawn straight before would have been drawn bent, with their
length, cant and the models along them. TTrack::straightened is the rule of master, for plain tracks and the paths of switches.

The editor keeps a bend dragged with the second control vector, or set by joining the tangents, by moving the first one 2.5 cm
off the chord to the side of the bend, past the tolerance, so the track is drawn, saved and read back bent, by older builds too;
the second one dragged back along the chord takes the first one back onto it.

* feat(track): the switches joined directly to other switches at load told in the log

A switch right after another one is joined to it as the sceneries load, where its end was left open before and vehicles came off
the track there. Each switch joined so is logged with its place and the number of ends, and the whole number once, so a scenery
can be checked for places that run differently now.

* fix(editor): a bend kept by lengthening the first control vector, not turning it

keep_bent moved the first control vector 2.5 cm sideways, which turned the
start tangent: a kink of 0.29 deg on a 15 m track, flagged by the joints
check, and against the fixed direction at a switch or a locked track.

Now the vector keeps its direction and gets 2.5 cm longer than a third of
the chord, which the simulator no longer takes for a straight. It is also
applied after an end is moved or snapped, since a new chord or a snap onto
a neighbour could bring the vector back within the tolerance. With the
second vector back on the chord, the first goes back to a third of it.

* fix(track): each switch joined directly to another one logged with both names

join_switches counted ends, while one join links both switches, and only
the first switch of a pair was named. It now returns the switches joined
to, and the log names both of each joint and gives the number of joints.

* fix(editor): a path drawn bent is kept bent through every edit, one drawn straight is left as it is

The first control vector is made longer past the 2 cm tolerance only where the path was drawn bent before the edit, or where
the edit itself sets the second vector: the end of the path moved, its first vector, its second one, a neighbour followed or
its grade taken, the controls aligned at a joint, an end snapped. A path drawn straight keeps being straight when its ends
move, and the paths of a track that the edit doesn't bend aren't changed. Moving the second vector back along the chord takes
the first one back to a third of the chord where it was made longer here.

* fix(app): a scenery that can't be opened takes the game back to the launcher whatever the file system throws

Catches std::runtime_error again, as master did: invalid_scenery_exception is one of them, and so is what the file system
throws while the scenery is opened.

* fix(track): the beams worked out in the background don't read the ends a switch is set to

The ballast a switch trackbed takes is asked of the tracks joined to its main path, as the trackbed is made at the load,
not of the ends the switch is set to now, which change as it's thrown while the thread runs. What the thread reads with no
lock against the main thread is written down where it runs, with the two things driving can change: a switch thrown and a
turntable turned.

* perf(render): the cut faces of a track drawn with nothing put on the heap, a track with none passed over at once

* chore(track): the switch drawing the cut faces in the unrolled material read only in the builds with the self-tests

* docs(track): the blades flag said to be switched on, and what frogs in eu07.ini changes of it

* fix(editor): a response over 64 MB is refused, curl kept to http and https, the address read as UTF-8

The body of a map or of a service the user typed is read into memory up to 64 MB and fails above that, with WinHTTP and
with curl. curl follows at most 10 redirects and only to http or https. WinHTTP gets the address widened from UTF-8, so a
pasted one with letters past ASCII isn't turned into garbage.

* fix(editor): only the orthophoto an older editor kept is deleted from the settings folder, not all its cache

The geoportal folder of the old cache is removed, and the cache folder itself only where nothing else is left in it.

* fix(editor): the square metre of the outlined area written as its UTF-8 bytes, shown right where /utf-8 doesn't reach

* docs(track): why the velocity read for a switch is put back after its segments are made

* fix(track): the blade tips and the open ends of a track take the dark of the rail, not the colour of a worn tread

No wheel runs over them, so their cut faces aren't drawn as worn: the beige the matte material gives a worn face is left
to the cut faces of the frogs.

* fix(editor): a neighbour followed or given its grade is bent only where its second vector really changed

follow() and follow_grade() write the second vector of a track joined at its end back as it was when the joint didn't
turn or keep its grade; a track the simulator draws straight with that vector off the chord was made bent then, though
the edit never touched it. Its first vector is lengthened now only where the path was drawn bent or the second vector
took another direction or grade.

* fix(track): the open ends of a track laid with cuts take the dark of the rail too

The rails a frog or a crossing cuts are laid piece by piece; the caps of their pieces at the open ends of the track were
drawn worn with the cuts of the frogs. They aren't worn now, as the open ends of the other tracks.

* fix(editor): a neighbour drawn straight is bent only where the edit took its second vector off the chord

follow_grade() sets the height of the second vector anew on every graded joint, a fraction of a millimetre off the height
the scenery has, so a change of the vector bent a track whose second vector stood off the chord sideways already, though
the simulator draws it straight. follow() and follow_grade() keep a path drawn straight bent now only where its second
vector lay along the chord before the edit and stands off it after; a path drawn bent is kept bent as before. How far the
vector stands off the chord is measured in one place, keep_bent() uses it too.

* docs(editor): the comment of keep_bent above keep_bent again, not above the measure of the chord

* Editor: signal reads kept by the signal, level crossing discs, signals out of the gauge, indicators, the signalling tools split (#307)

* fix(editor): the read of a signal stays by it as its track is split, on a switch and when it is moved, and a level crossing disc is placed

The trains find a signal by its read, a passive event in a list of the track, and measure the way to the cell it reads along three
tracks further at most. The editor let the read drift away from the signal, or put it where trains of another path read it.

- A track split in two: a read the trains scan for (a passive event) goes to the piece by the point it reads, whatever its list;
  before, those of the runs towards the end stayed on the first piece. Five splits left the reads of A, B, C and J on the first
  piece while the signals stood on the sixth, out of the reach of the trains. The reads of signals placed since the scenery was
  opened, not bound to an event yet, go to the piece by their signal the same way.
- A signal moved off its track jumped back to that track's end once the track was changed: the track had taken it up as its
  object and measured it again along itself. A moved signal is let go by the track it stood by, and an object of a single point
  moved off the side of its track no longer follows it.
- A switch reads its events to the trains of both its paths. A signal past the frog of a path, where the axes are a gauge apart,
  is passed by the trains of that path only, so its read goes to the track joined to the far end of the path, in the list of
  the trains running from the switch onto it or the other way. Before the frog it stays on the switch. Moving the signal across
  the frog takes the read between the two.
- A signal by a switch on the side of its other path stood on that path, in the way of its trains (0.45 m from its axis); it
  is refused there, placed or moved, with the reason.
- The kind crossing of the descriptions (tsosp, tsospn) is known: the level crossing disc is listed in the palette and placed
  with its read.

Checked in the editor on a hidden desktop: five splits of a track with bound and fresh reads, a signal moved to another track
and the old one raised, signals placed before and past the frog of a switch on both paths, turned and moved across the frog,
saved and opened again with the reads bound, the tracks raised, shifted and bent with the signals following. Unit tests pass.

* fix(editor): a split keeps reads far off the path and bound objects up to 30 m by their pieces

A read the trains scan for moves to the piece by the point it reads only from event1 and event2, only
when it isn't ignored and only when that point is within 50 m of one of the pieces; a read at the
station building stays in its list. An object bound by hand keeps its binding as its path moves up to
30 m from it, an adopted one up to 12 m as before.

* feat(editor): the tracks that read a signal are drawn and can be picked, flipped or dropped

The selected signal shows each read of its _sem_info as a thick band over the reading track, arrows
in the way the read is scanned, a line from the foot of the signal and a plate with the list and the
track; the hovered one shows them thinner and placing or moving a signal shows where it will be read.
The panel lists the reads: each can be turned the other way or removed, "Pick the path" takes a
click on a track (with Shift one read more or less) and "By the path it stands by" puts back the
read the signal gets when it is placed. Each change is one step of the undo.

The self-test gets signalread, signalreadflip, signalreaddrop and signalreaddefault, and the probe
lists every read of a signal.

* fix(editor): a moved or turned signal keeps the reads picked by hand, and a read set again isn't an undo step

Moving a signal, taking it across the track or turning it put back only the read by the track it
stands by and dropped the others: those stay on their tracks now, on the other list when the signal
is turned. Setting the reads the signal has already says so and adds no step to the undo. Picking a
reading track disarms the template, so a click after Esc doesn't place a signal, and the signals
are listed again after any change of the history, also once it is full.

* feat(editor): a signal is placed out of the gauge of the tracks around it

As a signal is placed, moved, taken across or turned, its models are measured against the gauge
chosen in the Gauge window along every path near it. One that enters it is taken sideways, away
from the axis of the track whose gauge it enters, as deep as it went in and 3 cm more, in the same
step of the undo; between two tracks too close for it, it stays where it was put and the status
tells which gauge it enters and how deep. A gantry is only measured.

The panel of the selected signal tells when it stands in the gauge, with a button to move it out,
and the view marks the deepest place. The gauge tool measures any models against the paths around
them for it. The self-test places a signal at a given offset and its probe tells the gauge.

* fix(editor): a moved signal leaves only the read of the track it stood by, and the gauge is checked on its level

The reads a moved signal keeps were all but the first one listed, which is the first track of the
scenery having it, not the one the signal stood by: a read picked by hand could go and the track
it left could keep it. It is the read of the track it stood by that goes with it now, and turned,
eventall1 and eventall2 swap as well. A track more than 2 m above or below the foot doesn't push
the signal aside, the status tells the real distance it went, the gauge is measured again when the
signal follows a dragged track, and the marker in the view shows only what is up to date.

* feat(editor): indicators put on a signal from the panel, they move and go with it

The indicators of scenery/pkp/wskazniki described as "category: indicator"
are offered under the selected signal, grouped by their sign. One is put
in as an include named after the signal, on the srk layer:

- a lit one (place: head) under the lowest lamp of the signal, 0.73 m
  below it and 5 cm ahead of the mast, each next one 0.45 m lower; a dwarf
  signal is refused, it has no mast for one;
- a plate (place: foot) at the foot of the signal, its model has its place
  by the mast built in.

The panel lists the indicators standing by the signal with a Remove
button. They are found as the includes whose first parameter is the
signal's name, within 1 m of it in plan. When the signal is flipped,
turned or moved, they keep their place in its frame, in the same undo
step; deleting the signal deletes them too. If the signal and the
indicator both define an event, the status says so, since the scenery
keeps only one of them.

The self-test gets signalindicator and signalindicatordrop, and its
signalprobe gives each indicator's height and the height of the lowest
lamp.

* feat(tools): indicator descriptions and the indicators taken out of the signal templates

indicator_headers.py writes //$e descriptions into the LED indicators of
scenery/pkp/wskazniki (W19, W20, W21, W24, W26) with the events each
shows. It also makes the indicators that were so far only built into the
signal templates:

- W1 of the warning discs, new, old and with the light strip;
- W1 and W18 (new and old) of the block signals;
- the I, II and III plates of the repeaters.

The plates fixed flat to the mast are moved 4 cm ahead. Their back is
5 cm from the mast's axis, while the mast is 6.1 cm thick and its clamp
under them 8.3 cm, so the mast went through the plate, in the templates
too.

* fix(editor): a signal turned or moved by the gizmo is read and kept out of the gauge, its indicators go with it everywhere

The gizmo of an include only rewrote the numbers of a signal. Its read stayed on the event it had, even when the signal was turned
to the trains of the other direction. Its indicators stayed behind, its height could be dragged off the ground, and the gauge
wasn't checked. Now:

- the gizmo moves a signal in the plan only, at the height it has;
- while it is dragged, its indicators keep their place by it;
- once it is let go, the drag is made again as a move of the signal tool, one step of the history: the read goes to the event of
  the trains it faces on the path it stands by, and it is taken out of the gauge;
- dropped away from every track, it goes back where it stood.

The indicators of a signal are found in the scenery now, not in the list the signal tool keeps up only while it is open:

- deleted from another tab, the signal takes them with it;
- a signal renamed in the node properties gives its new name to them in the same step of the history;
- in the station and line batches, a renamed signal renames them, and a removed one removes them;
- the binding of objects to tracks puts them on the path reading their signal, not on the one nearest to them, and a signal moved
  by hand lets go of them too.

Also:

- a signal on a gantry takes no indicator from the list;
- an indicator a signal has already isn't put on it twice;
- the signals and their indicators are found in one pass over the includes, the indicators by the name of their signal;
- a step of the history with tracks is always one of their edit, so they are taken back with the includes.

The self-test gets signalgizmo, which turns and moves a signal as the gizmo does.

* fix(tools): indicator_headers.py keeps the files it replaces, writes beside the data on request

- An indicator it made, found changed, is put into a tar in editor_backup before it's written again.
- --sidecar writes the descriptions of the lit indicators into editor/templates, as the other header scripts do, the files of
  the game left alone.
- The indicators it makes are copies: the signal templates keep their own, and the docstring and the files say so.

* fix(editor): a signal moved by the gizmo by another track is read by it, the templates known without the signal tool

- At the end of a gizmo move the nearest track takes the signal when it is nearer than its own by more than 0.5 m; a track it
  was dropped onto, within 1.2 m of its axis, doesn't, so a signal only turned between two tracks or dropped onto one in a
  switch keeps its own.
- The signal templates and indicators are looked for when a signal is renamed or its gizmo shown, so its indicators follow
  without the signal tool opened first.
- A drop refused puts the gizmo and the node properties back where the signal stands.
- The indicators follow only once the gizmo made its step, and the ones not changed are left alone: grabbed and let go it
  changes nothing.

* fix(editor): a signal dropped by the gizmo onto a track keeps its own, the gizmo doesn't wait for the template scan

- When the nearest path to the drop is within 1.2 m of its axis, the signal keeps its own track, instead of only that path
  being left out: dropped onto a middle track it no longer goes to the track beyond it.
- The gizmo starts the signal template scan without waiting for it, so a rescan with a signal selected doesn't stop the
  editor; renaming a signal still waits.

* feat(editor): the signalling split into Signals, Station, Station signals and Line block

The one Signalling tool held the signals placed by hand, the whole wizard of a station and its checks; each is now a tool of its
own in the toolbar:
- Signals (I): the palette, a signal placed by a track, dragged along it, selected; a click on a switch no longer opens a station.
- Station: LMB on a switch lays the station out; its name, code, line, km, speed and braking distance, the numbers of the
  switches, the track circuits, the number of the selected track, the list of the switches.
- Station signals: the signals of the whole station placed at once, the template of each of their kinds (main, shunt) chosen in
  a table, and below what the signalling lacks: the repairs, the SHP resonators, the track lengths, the signal heads.
- Line block: the block of each line, the block boundaries drawn by hand, the line signals, the templates of the block signals
  and warning discs.
The station tools share the open station and its schematic; Station signals and Line block show what the Station tool set for
it, the line and the km in red where the line block needs them. The template table replaces the palette in the station
tools, so choosing a template there no longer arms placing. Two icons drawn for the new tools, in editor_icons.py too; the
png is drawn by the same shapes, Pillow wasn't at hand. The tracktab self-test takes a tool by its name, and srkopen shows the
Station tool.

* feat(editor): a signal shows its distance from the track axis and to the switch ahead, and goes to 50, 100 m... from it

- editor/editorTrackTrace: the track followed the way a train runs, shared by the W17 markers and the signals. The fouling
  point of a switch (where the axes of its tracks are 3.5 m apart) moved here from the lineside tool, and danger_ahead
  finds where a train first comes to a switch: the start of one it runs onto from its start, or the fouling point of one it
  runs onto from behind, which may lie behind the point (a signal in the fouling zone).
- The card of the selected signal: its distance from the axis of its track, and along it to the start or the fouling
  point of the switch ahead, in red when it stands inside the fouling zone. The overlay draws the same as a dimension line
  beside the track on the side of the signal, with the distance at the place.
- Placed, dragged along or moved with the gizmo, a signal goes to a round distance to the switch ahead (50 m steps) when
  within 2.5 m of one; Alt keeps it where it is. The drag of a new one is measured from where it was pressed.
- The fixes of the review of the split: the click label of the station tools in their own branch and a plain select in
  Signals, the card of a signal picked from the check lists shown in Station signals, and the help texts naming the
  Templates table and the Signals tool.
- Self-tests: signalprobe logs the distance from the axis and to the switch ahead, signal snap=1 snaps as placing does.

* feat(editor): the fouling point widened in the curves under 250 m, as the standard of the gauge says

Standardy techniczne PKP PLK, tom II (from 2025-07-17), 6.5-6.6: the W17 marker stands where the axes of the tracks are
nominally 3.50 m apart; where one of the tracks lies there in a curve under 250 m that spacing grows by the widening of the
gauge from its radius (annex 1, table 1), the widenings of both summed when both lie in curves.

- editor/editorFouling: the fouling point found along the axes of the main track and the branch, standing on its own: at
  each point of the branch the spacing wanted is the nominal one plus, for each track, the widening on the side of the
  other track from its radius there (taken over 5 m each way): 50000/R - 185 mm towards the centre of the curve,
  60000/R - 225 mm away from it, none from 250 m up.
- gauge::curve_widening gives table 1 of the gauge the editor checks already.
- The W17 tool and the distance of a signal to the switch ahead both use it; the card of a signal shows how far apart the
  axes are at the fouling point, the help of the W17 tool says where the figures come from.
- Unit tests: a straight branch at 1:9, a branch in a curve of 300 m (no widening) and of 200 m (outer widening), both
  tracks in curves (both widenings summed) and a straight branch off a curving track.

* feat(editor): the cant leans the cars into the fouling point, and the fixes of the review of the metre

- The fouling point takes the cant in, as Ie-1 wants it placed "with the gauge, the cant and the widening in the curves":
  the cars of a track on a cant lean towards the inside of its curve by D Hi / 1500 (bD of table 1 of the standard of the
  gauge), so when the other track lies on that side the spacing wanted grows by it, taken at 3.05 m over the rail top, the
  top of the widest part of GPL-1. The cant of each point comes from the roll of its path as the gauge tool takes it. At any
  radius, as the table has it; the track leaning away adds nothing.
- Below 150 m, where table 1 ends, the widening from the radius is that of 150 m rather than the formula run on.
- A switch run onto from behind has its fouling point looked for once its own path is walked too, so one lying on that
  path is found rather than skipped for a farther switch.
- A point behind a signal lies on the track of the farther end of its segment, so a signal snapped back over a joint lands
  at the round distance rather than at the joint.
- Alt keeping a signal off the round distances reads the key from ImGui, which Global.altState misses while ImGui holds the
  keyboard. The gizmo doesn't snap a signal: a1d10bb0 says it does, it's placing and dragging with the tool only.
- The help of the distance on the card stays on the distance, the spacing of the axes under it. The unused
  track_trace::nearest_on is gone.
- Unit tests: the cant leaning towards the other track in a curve and at 300 m, nothing when leaning away, and the table
  ending at 150 m.

* fix(editor): the cars lean the way the cant of their track tips them, taken 3.25 m up

- The cant along the trace keeps its sign: a roll above 0 lowers the left rail of the path (as the editor lifts its
  terrain by it), turned to the way the track is walked. A track adds the leaning of its cars to the spacing wanted at the
  fouling point when the other track lies on the side its lower rail is, whichever way it curves: a branch on a cant
  against its own curve leans towards the main track on its outer side, which d70f189c missed, and a cant on the straight
  counts too.
- The leaning is taken 3.25 m over the rail top, the top of the widest part of the cars, rather than 3.05 m of GPL-1.
- Unit tests: a cant against the curve, a cant on the straight, and the leaning away still adding nothing.

* fix(editor): the station tools tell by the mouse what a button came to, and the fields of a station read as empty

What a button of the Station, Station signals and Line block tools came to was written at the foot of the panel, under the
lists, scrolled away: a click which refused for want of the code of the station looked as if nothing happened. It's told now by
the mouse which clicked, a refusal in red as the other tools do, and in the status bar. The fields of a station still empty
show their examples as such, "e.g. BPd", not as values typed in; the Station tool says above its steps that the code is to be
typed first, Station signals that the code and the track circuits are wanted, the code marked there as needed.

The check of a warning disc and of a block section went by the braking distance of the station, while Set the line signals
places them by the one of their line: on lk357 a disc placed 700 m before Z, the line run at 100 km/h, was marked as standing
nearer than the 1000 m of the station. A signal of a line out is checked by the braking distance of its line now.

* feat(editor): the joints of the track circuits put, moved and taken away by hand, kept by the station

The Station tool gets Edit the joints by hand: LMB on a plain track of the
station puts a joint there, LMB on a joint takes it, then on a track moves
it, on it again takes it away. The circuits are set again at once, one step
of undo each. The joints so changed are kept in the //$s record of the
station (joints +x/y/z for one put, -x/y/z for a planned one taken away),
so Set the track circuits keeps them; As planned forgets them. The undo
step carries the hand joints of the station with the tracks.

srkjoint drives it in the self-tests.

* feat(editor): the indicators under the lights reordered, a signal set from the axis and raised, standing on the ground by default

The indicators under the lights of the selected signal get arrows up and
down: one changes places with the indicator above or below it, a plate at
the foot keeps its own. One step of undo each.

The distance of the selected signal from the axis of its track is typed in
the panel, it moves across as far along the track as it stands, the gauge
pushing it out again where it comes too near. Its height is set the same
way, raised over where it stands by default, over the rail heads on a
gantry.

A signal is put on the ground by default, the zero of its model 0.38 m
under the rail heads: the ground lies 0.35 m under them as Ie-102 draws it
(Lx), the foot of the mast stands on the foundation 3 cm over it in the
models of pctga, and the sceneries made by hand (Wrzosy, Baltyk) stand
their signals 0.20 m under the rail foot so. It stood on the rail heads.

signalindicatorswap and signalacross drive it in the self-tests.

* fix(editor): the hand joints of a station without a record, of its ends and of another station; a dragged signal keeps its place across and its height

- Edit the joints by hand on a station not described yet read the record
  of index -1: the hand joints are shown only for a station with one.
- The joint between the station and a line out of it can't be taken: taken
  away, the circuit of the switch ran on over the tracks of the line.
- A joint held is let go when another station opens, a move by less than
  half a metre lets it go, and a change no step of the history takes is
  undone, so the undo knows every change of the joints.
- A signal dragged or snapped along its track keeps its distance from the
  axis and its height over the default, set by hand or standing so before.

* fix(editor): a dragged signal carries what it had by its own track; As planned forgets the hand joints that change nothing

The distance from the axis and the height of a dragged signal were taken
against the track it was dropped onto: dropped on the next piece of its
line, on a grade or by a parallel track it came out too far, in the gauge
or off the ground. They are taken as it stood by its own track at the
start of the drag. As planned clears the hand joints even where the
circuits come out the same.

* fix(editor): a signal stands as high over the rail heads as its include gives, lowered only where its bottom would hang over the ground

The default height of a signal was 0.38 m under the rail heads for every model. It is now read from the
description of its include, `//$e signal: {..., height: <m>, depth: <m>}`: height is where the zero of the
model stands over the rail heads (by Ie-117 § 15 the top of the foundation of a mast 0.10 m under them, of
a dwarf 0.20 m), depth how far the model reaches under its zero. With a depth, a signal whose bottom would
hang over the ground, down an embankment, goes down onto it, by at most 3 m (more is taken for a bridge).
Without a height the zero stands at the rail heads.

"Raised" in the panel, a signal moved across or dragged, all count from that default height.

* fix(editor): a signal flipped, given another template or its variant for the other side stays as raised as it was

The default height now depends on the template and on the ground under the signal, so keeping the height
as it was no longer keeps the raise. Flipped to the other side of the track, the signal is raised over the
default there as it was over the default on its own side. Given another template (Swap), or the variant of
its template for the other side when moved or placed, it goes up or down by how much the default height of
the new template differs from the old one.

* fix(editor): As planned forgetting hand joints that change nothing is a step of undo of its own

With nothing in the circuits to change no step of the history took the forgotten joints, so they went with no undo for it: Ctrl+Z took back the step before. The anchor of the station as it is now carries them in a step of their own. The signalmove selftest gets its carry indented with the block it is in.

* feat(editor): an indicator under the lights goes in its place by Ie-117, from the top W21, W24, W20, W19, W26

Put on a signal, an indicator under its lights was put below the ones there. It now goes in its place by Ie-117 section 12.1 among them, under the last one it doesn't go above, the others (W18 and the rest) below these; the ones under it move a place down, in the same step of undo.

* fix(editor): the signal card and the move of a signal keep no pointer across a refresh of the signals

- The card of the selected signal went on after "To the other side" or
  "Turn around" with found pointing into the list of the signals
  standing, which their refresh had just replaced: the indicators and
  the gauge of the card read freed memory. It now ends that frame there.
- signal_move_to read the mount of the template after the refresh,
  which may scan the templates again; it is taken before it.
  signal_place takes a copy of the template given for the same reason.
- The fouling test counts its metres with an int, and the search of the
  middle point of the radius is a while loop (no floating loop counter).

* fix(editor): the dimension line to the danger point counts its metres with an int (Sonar S2193)

The line drawn by the track from a signal to the switch or fouling point
ahead stepped a double by 1 m. It now counts the whole metres with an
int from the same first one: the points are the same, since adding 1 to
a whole double and adding a whole int to it give the same values.

---------

Co-authored-by: maj00r <maj00r@host>

* feat(editor): ride the camera along the tracks, and a minimap with stations by their W4 (#317)

* feat(editor): the camera rides along the tracks, over the joints and switches and over to the tracks alongside

Y puts the camera onto the track under the cursor (or the nearest one), looking along it 3 m over the rails.
W/S drive it ahead and back the way the camera looks, Shift and Ctrl faster (20, 60, 250 m/s); A/D take
it over to the track alongside, a click to any track; E/Q and the wheel raise and lower it; the mouse looks
around as when flying. At a switch entered from its blades it goes straight on, Z picks the turnout for the
camera alone: no switch is thrown, no track learns of the ride. The bar over the view shows the track, the
km, the speed, the height and the switch ahead. Y or Esc ends it. Self-test commands ride, ridewalk,
ridejump, rideahead, rideprobe and rideleave.

* feat(editor): a minimap of the tracks with the camera on them, and the stations found by the names of their W4

View / Minimap and stations (W4), Ctrl+M: a window with the rail tracks seen from above, the camera as
a triangle the way it looks, the track ridden along in orange and the stops of passenger trains as dots
with the names of their stations. It follows the camera, or is dragged and zoomed apart from it; a
click takes the camera there, riding along the track onto the track there. Above it the stations the
PassengerStopPoint memory cells and events name, searched by a part of the name with or without the
polish letters; a click (or Enter for the first found) flies the camera over to the stop looking along
the track, riding it rides on from there, each click to the next W4 of the station. Self-test commands
minimap, stations, station and minimapclick.

* fix(editor): the ride and the minimap after the review, with fewer words on the screen

- Ctrl+S, Ctrl+Z and the other shortcuts reach the editor while riding; Esc closes
  an open popup first
- no key stays held when a window takes the keyboard, the place is kept within
  a path that got shorter, a release of the mouse goes where its press went
- the minimap keeps under the vertex limit of a draw list, Enter in the search
  goes round the stops of the station, the marked station stays marked
- the bar of the ride is one line: the track, km, speed and height; the switch
  ahead under it, the keys only while standing
- the minimap in the Map menu, opening over the view, with short texts; the
  context menu of a track rides along it

* feat(editor): the ride drives with the right button held, as the camera flies, and the editor works on along it

- W/S, A/D and Q/E drive the ride only with the right button held; without it
  they're the editor's keys again (Q/W/E the gizmo)
- the left button and Esc go to the tools while riding: tracks and objects are
  laid and selected from where the ride took the camera; Y leaves, a flight of
  the camera to a framing leaves too
- after the review: the help names Ctrl+W/Ctrl+Down as the much faster drive,
  the stops of the minimap stay within the vertex limit, the search field lets
  the keys go after Enter

* fix(editor): the tools keep their wheel and the menu of a track its click while riding, a pan or the view from above ends the ride

---------

Co-authored-by: maj00r <maj00r@host>

* feat(editor): signals placed by the editor get a name plate drawn by python (#316)

* feat: Elf emergency brake position in the master controller (eu07/maszyna#413)

The Elf's master controller (EIMCtrlType 2) gets an optional emergency
brake position below its position 0, turned on by the new .fiz key
EIMCtrlMainEmergency=Yes in Cntrl (default No, no change without it).
With it the old positions move up by one (MCPN 5, neutral at 4): the
emergency position brakes fully at once and vents the brake pipe, like
the alarm chain or the Impuls's EIMCtrlEmergency. The loader raises a
too small MCPN to 5 and logs it. The Elf code with hard-coded positions
(CheckEIMIC, the MED full braking, the AI) takes the shift into account.

SVN data to change afterwards (dynamic/pkp/elf_v1, needs this exe):
- every .fiz with EIMCtrlType=2: EIMCtrlMainEmergency=Yes, MCPN=5,
  DirChangeMaxPos=4 where present;
- the cab .mmd mainctrl entries: offset one notch lower (-0.06 -> -0.09),
  sounds shifted one index up, new sound0 with
  26284_elf_nastawnik_nagle_*.wav.

Issue: (eu07/maszyna#413)

* fix: Elf emergency brake position vents the pipe only from the driven vehicle, coupled units agree on the controller position

The emergency position of the master controller vented the brake pipe from
every vehicle whose controller stood there, and "MainCtrl" reached the coupled
vehicles raw, so an Elf with EIMCtrlMainEmergency and one without it disagreed
by one notch (the full braking of one was the emergency brake of the other,
neutral of one a power position of the other). The pipe is now vented only
from the vehicle driven from (IsCabMaster()), and the position goes to the
coupled vehicles in the positions without the key (MainCtrlPosForCoupled(),
the emergency one as the full braking), each adding its own shift on receiving
it (MainCtrlPosFromCoupled()).

The loader's fix-up for the old MCPN=4 raises DirChangeMaxPos by the same
shift, so the reverser keeps working at the new neutral.

* feat(editor): the signals the editor places get a plate with their name, drawn by python

A signal placed with the signal tool used to get the plate texture of
textures/tabl named like it, or none at all. Now, unless a texture is
picked, its plate is made by python/local/signal_plate.py:
"make:signal_plate?name=<name>", a light plate with a dark edge, four
screws and the name in black, the way the plates of textures/tabl look.
Renaming the signal in its properties renames a drawn plate with it; a
picked texture stays.

The templates put the plate after a folder, "tabl/(p6)", so
material_data::assign() takes the folder off a skin which names a
texture made by a script.

* fix(editor): a drawn signal plate keeps following a cleared name, and isn't made for a name it can't carry

Clearing the name of a signal in its properties made its plate the drawn
plate of no name, which then never followed the name again. A drawn
plate now follows any rename to a name, and keeps the last one while the
name is cleared.

A name with '|', '&' or '?', or one longer than 64 characters, gets no
plate (0_nothing) instead of a broken one: '|' splits the skin, '&' and
'?' the query of the script, and a very long name made a path too long
for the file system when the skin was looked for on the disk.

* fix(editor): a signal plate keeps its last name through a name it can't carry, and a plate named by hand stays

Renaming a signal to a name its plate can't carry turned the drawn plate
into 0_nothing, and it stopped following the name for good. Such a name
now leaves the plate with the last usable one, like a cleared name does,
and the plate follows again once a usable name is typed.

A drawn plate whose name was given by hand, different from the name of
the signal, is no longer replaced on a rename: only the drawn plate of
the signal's own name follows it.

* feat(editor): the drawn signal plates come in three looks, plain, toned and aged

The plate drawn by python/local/signal_plate.py looked too clean. It now
takes a look in its query, "make:signal_plate?look=toned&name=Tm12":
plain is the bright plate it was, toned a greyish field with a little
grain and dust towards the bottom and the sides, a thinner edge, smaller
screws and graphite letters, aged a darker, grainier and dustier one.
Toned is drawn when no look is given.

The signal tool picks the look under the plate, kept in the settings of
the editor. A rename of the signal in its properties keeps the look of
its plate.

* perf(editor): the grain and the dust of a drawn signal plate are made on whole images

The toned and aged plates shaded their field a pixel at a time in
python, about 34 ms a plate with the interpreter held, so a station of
a hundred signals in view kept the python queue, and the screens of the
cabs, waiting for seconds. The dust is now made once per look, and the
grain from random bytes of the name, both put on the field with
ImageChops: about 2 ms a plate. The mean colour of the plates stays the
same; only the grain falls differently.

* fix(editor): the station signalling draws the plates of its signals as their schematic names them

The plates the station signalling places and renames say what its
schematic shows (Tm3, F1, ToA, a block signal without the stem), and a
template swapped in for a signal without a plate draws that text too
rather than the small letters of the name. A signal left for removal
gets a plate of no text again, not one saying "_old".

No plate, 0_nothing, or the texture named like the signal, what the
editor gave before the plates were drawn, become the drawn plate when
the signal is renamed, in the properties panel as by the station
signalling, in the look set in the editor.

* fix(editor): a plate of a scenery named like the end of the name of its signal stays through a rename in the properties

A texture pzs_a was given by its scenery as a, its real plate: a rename in the properties panel keeps it. Only the station signalling, which looked its plates up that way, takes such a one for its own.

* feat(editor): the drawn signal plates are 256 pixels across, sharp up close

The edge, the screws and the blur are drawn bigger by as much as the plate is, and the grain is as coarse as before, so the three looks stay as they were. The smallest letters tried grow with the plate too.

* feat(editor): a drawn signal plate takes a speed index and the m of shunting signals, typed in the signal tool

signal_plate.py draws the speed index after the name, one digit up at
its right or two as a fraction across the height of the letters (index=4,
index=12 for 1/2), and with m=1 an "m" on a strip of its own under the
name, as Ie-1 marks a semaphore giving shunting signals and as the
textures/tabl a-12m plates show it.

The signal tool has a field for the index and a box for the m under the
look of the plate; the hint of the plate names them (B 1/2 m). The
style of a drawn plate, its look with the index and the m, stays with
it through a rename, in the properties panel and by the station
signalling, which sets neither. The signal selftest takes index= and m=.

* fix(editor): the speed index of a plate takes only digits as they are typed

The decimal field let in signs and dots, which stayed shown while the index held only the digits, and filled the two places before a second digit could go in.

* fix(sonar): the remarks on the drawn signal plates, to pass the quality gate

The new code of the plates was 5.2% technical debt against the 5% of the
gate. Fixed the small remarks; the big functions stay as they are:
- the speed index field and the plate looks are std::arrays, the index is
  copied without snprintf, the combo of the looks has a function of its own
- ranges algorithms, a string_view for signal_plate_drawn, emplace_back
- signal_plate.py: dict literals, a cache of fonts not named like FONTS,
  no unused local, the name and the m drawn by methods of their own; the
  plates drawn are byte for byte the same as before

---------

Co-authored-by: jerrrrycho <jurek.pakula@gmail.com>
Co-authored-by: maj00r <maj00r@host>

* fix(editor): the tutorial and the hints tell of the kilometrage, and the first lesson takes O either way

The kilometrage (X) was in no hint, no shortcut list and no lesson, though the hectometre posts and the block signals are numbered after it. The row of the track tools now reads L T G N U I X B P V J, the turntable with it, and F1 lists I / X / B. The lesson of the signals and the posts says what X does and where the posts take their numbers from, the km of the line or the km typed in their panel for the place clicked, and it opens with the kilometrage tool too. The first lesson asked to switch to the view from above, which a scenery made in the wizard opens in already: O either way does it now.

* fix(editor): master's road lifting texts translated, and the panning by the wheel told of in 3D too

The merge of master left the status and the label of the lifting of the road points in English: both go through the translations now. Master pans the 3D view by the wheel as well, so the lesson, the hint row and its line say it works in both views. <cstring>, dropped from the road tool before, came back in the merge and is gone again.

* fix(editor): the tools of a plain line in sight, the km of a line set once, a lesson of a whole line and of the ride along a track

What a layman building a line with signals and posts couldn't find:
- The Signals, Kilometrage and Posts tools are in the main row of Tracks, after the tools of laying; the stations, their signals, the line block, the turntable, the trainset and the checks stay behind More.
- "Objects" was where the hectometre posts are: the tool is Posts now (Słupki), its hints say the line the posts go along.
- The km of a line could be typed in three places that didn't lead to each other. The panel of the posts and the one of a station, where the line has no km set, say the typed km is theirs alone and have Set the km of the line (X), opening the Kilometrage tool; that tool says first that one known point serves the posts, the stations and the block signals.
- The hint of the Signals tool says to pick a signal in the list, then click beside a track; with no templates the panel says so in plain words.
- A new lesson, A whole line, step by step: the tracks and switches, the km, the station, its signals, the line block, the posts and the drive, with a button to the station tool, and opened with the station tools.
- The first lesson shows the ride of the camera along a track (Y, then W S A D and Z) and has it as a step to try.
- lang/editor_pl.po: "Restore the terrain" and "Drag an end" were there twice, the second copies are gone.

Checked: MSVC build, unit tests 459/459; editor run on a small scenery, screenshots of the toolbar, the new lesson, the first lesson with the ride ticked after Y, the panels of the posts, the kilometrage and the signals. The station panel with no km of the line wasn't seen, the scenery had no station.

* fix(editor): the posts open expanded from the trainset, and the Polish of the whole-line lesson reads right

B or the Posts button pressed while the trainset tab is shown opens the hectometre posts with their panel expanded.
The Tracks area tooltip names the kilometrage and the posts.
The station step names the shunting signals, the station button says Narzędzie Stacja, and the ride rows and the lesson list read smoother in Polish.

* fix(editor): a bent model is lengthened along the tracks joined to its own, laid along another track after the bending, and set by fewer settings

The ends of a bent model have handles in the view: dragged, the model goes on along the tracks joined there, at a switch the way it's dragged to.
Its length, a drag of the whole model and a drag of an end all follow the joined tracks; before, they went on straight past the end of the track under the model.
The panel of a bent model picks its track: another one picked, the model stays where it stands, a platform turns its edge to the new track and keeps its length.
On top stay the track, the length, the offset and the height, bent or repeated, and the platform edge; the reference point, the position along, turned, mirrored, the cant and the gauge widening went under More settings.
The buttons of the model's own length and of the whole track are gone: the length field and the handles do it.
The links of a model to its tracks are counted anew when its pieces change, undo and redo included.

* fix(editor): the bends of straights laid from the end of a curve begin with a straight, not a compound curve

In the mode of straights the curve of a plain track's free end no longer goes on into the curve of the first bend as a compound curve.
The line comes out of the end's curve by a transition onto a straight, and each bend gets a curve of its own.
Only a curve traced in the mode of a curve goes on from the curve of the end, as it already did at a switch.

* fix(editor): the bent model keeps its links and its line to what it reaches, and drags without rebuilding at each track

- the links of a bent model are matched anew whenever any of its pieces change, not only the first
- the line is lengthened by the plan lengths of the joined tracks and built once a round; a drag reuses the line made at its start while it doesn't grow
- the tracks of one name are told apart in the track lists, and a deleted track leaves them
- the tracks at the ends the copies no longer reach are left out of the line after an edit or a drag

* fix(editor): a click on a bent model's handles changes nothing, and the track picked stays picked

- the line is trimmed on a drag's release only when the drag changed the model, and an edit that trimming undoes makes no undo step
- the track picked for the bending is kept by the track, not its place in the list, when the list is gathered anew

* fix(lang): a stray line taken out of editor_pl.po

A single "r" between two entries, left by an edit of the switch texts: msgfmt refuses the file with it.

* feat(launcher): the range of the aerial photos of a new real scenery given on the map, changed later in the editor (#328)

* feat(launcher): the new real scenery gets the range of its aerial photos on the map, changed later in the editor

The wizard of a new scenery asked only for the centre; the editor then
downloaded the photos around the camera wherever it went, and a scenery
had no range of them until one was drawn in the orthophoto settings.

The realistic scenery is made in three steps: the name, the place (a
click on the map or the place typed, degrees or PUWG 1992), and the
range of the aerial photos: a square of 1, 2, 5 or 10 km around the
centre, or an area of the user's, its corners clicked on the map. The
range is drawn on the map with its size and the number of the tiles,
and it's written to the scenery as the download area (//$z), so the
editor downloads the photos and the terrain model inside it only.

What a beginner gets wrong is told before the scenery is made: the
button stays off with the reason under it (no name, the name taken, no
centre, the centre outside Poland, an area being drawn or crossing
itself), and a warning comes with the centre outside the area, a large
area and a centre clicked on the map of the whole country (the map
zooms to the place after the first click).

In the editor the download area says in plain words what it does, a
square around the camera replaces it in one click, and with the camera
outside it a note at the bottom of the view says there are no photos
there, with the way to the range.

* fix(launcher): the range of the photos asked for after the centre, the drawing given up as with Cancel, the square named by its sides

The review of the range of the aerial photos found:
- with My own area chosen before the centre, the clicks meant for the
  centre went to the corners of the area: step 3 waits for the centre;
- switching to Fictional while drawing dropped the area there was
  before, and an unfinished one of three corners counted as done: it's
  given up as with Cancel now, also with Esc; Enter ends it, Backspace
  takes the last corner back, as in the editor;
- the error of a place mistyped stayed after a click on the map;
- the largest square was told to be large or not by the rounding: the
  warning comes from 50 sq km on;
- "2 km" read as a radius: the squares say "2 x 2 km", the tooltip how
  far each edge is;
- a place typed with an area of the user's fitted the map to the area,
  not to the place.

In the editor the note of the camera outside the range says the terrain
model isn't there either, its button says it opens the settings, it
stands above the strip of the profile and the keys of the tools, and it
can be closed until the camera is back inside. The squares around the
camera want the place of the scenery on the map, and replace an area
there is, or start one of 10 x 10 km, only with a yes.

* fix(editor): one note of the empty scenery in the middle of the view, the warnings of an area told once it's drawn

A new scenery opened in the editor showed two notes of the same over
each other in the middle of the view: the panel of the track tools
("The scenery has no tracks yet") and the line of the terrain ("This
scenery is still empty"). The line gives way to the panel now.

In the wizard the centre outside the area and the crossing edges were
told while the area was still being drawn; they're told once it's done.

* fix(editor): the note of the camera outside the range of the photos hidden while the camera rides a track

Its lines at the bottom of the view are where the camera riding a track writes the next switch and its keys.

---------

Co-authored-by: maj00r <maj00r@host>

---------

Co-authored-by: maj00r <maj00r@host>
Co-authored-by: Hirek193 <polomarket73@gmail.com>
Co-authored-by: jerrrrycho <jurek.pakula@gmail.com>
2026-11-11 21:34:39 +01:00

893 lines
30 KiB
CMake

cmake_minimum_required(VERSION 3.26)
if(POLICY CMP0058)
cmake_policy(SET CMP0058 NEW)
endif()
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
if(POLICY CMP0069)
cmake_policy(SET CMP0069 NEW)
endif()
include(CheckCXXSymbolExists)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake_modules/")
set(DEPS_DIR ${DEPS_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/ref")
project("eu07")
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize=undefined")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=undefined -Wformat")
#set(CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -fsanitize=address -fsanitize=undefined")
string(TIMESTAMP VERSION_YEAR "%y")
string(TIMESTAMP VERSION_MONTH "%m")
string(TIMESTAMP VERSION_DAY "%d")
# Use these as version numbers
set(VERSION_MAJOR ${VERSION_YEAR})
set(VERSION_MINOR ${VERSION_MONTH})
set(VERSION_PATCH ${VERSION_DAY})
set(VERSION_STRING "${VERSION_YEAR}.${VERSION_MONTH}.${VERSION_DAY}")
set(CMAKE_CXX_STANDARD 20)
file(GLOB HEADERS "*.h"
"Console/*.h"
"McZapkie/*.h"
"gl/*.h"
"network/*.h"
"vr/*.h"
"network/backend/*.h"
"widgets/*.h"
"launcher/*.h"
"extras/*.h"
"global_include/*.h"
"simulation/*.h"
"scene/*.h"
"rendering/*.h"
"audio/*.h"
"environment/*.h"
"application/*.h"
"input/*.h"
"scripting/*.h"
"model/*.h"
"utilities/*.h"
"world/*.h"
"vehicle/*.h")
set(GLOBAL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(GLOBAL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/global_include")
set(IMGUI_DIR "${CMAKE_CURRENT_SOURCE_DIR}/imgui")
if (APPLE)
set (CMAKE_FIND_FRAMEWORK LAST)
endif()
option(WITH_OPENGL_MODERN "Compile with OpenGL modern renderer" ON)
option(WITH_OPENGL_LEGACY "Compile with OpenGL legacy renderer" ON)
option(WITH_PYTHON "Python 3.14 embedded scripting" ON)
option(WITH_UART "Compile with libserialport" ON)
option(WITH_LUA "Compile with lua scripting support" ON)
option(WITH_WASM "WebAssembly script screens (wasmscreen:, wasmdestinationsign:), run by the WAMR interpreter in ref/wamr" ON)
option(WITH_OPENVR "Compile with OpenVR" OFF)
option(WITH_ZMQ "Compile with cppzmq" OFF)
option(WITH_CRASHPAD "Compile with crashpad" OFF)
option(WITH_DISCORD_RPC "Compile with DISCORD RICH PRESENCE" ON)
option(USE_LTO "Use link-time optimization" OFF)
option(WITH_TESTS "Build and run the unit tests with the game, a failing test fails the build" ON)
option(WITH_EDITOR_SELFTESTS "Run the scripts of the editor and launcher self-tests named by the EU07_EDITOR_SELFTEST and EU07_LAUNCHER_SELFTEST variables" OFF)
option(WITH_BETTER_RENDERER "Experimental multi-backend renderer based on NVRHI" OFF)
option(GENERATE_PDB "Generate executable with program debugging symbols" ON)
option(ENABLE_MCC "Enable multicore compilation" ON)
option(WITHDUMPGEN "Enable generating DMP files on crash" ON)
option(ENABLE_AVX2 "Enable AVX2 instruction set (requires AVX2-capable CPU, Haswell/2013 or newer)" ON)
option(ADD_VERSION_SUFFIX "Add date and commit hash to the executable name" ON)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
# vcpkg init
set(VCPKG_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/ref/vcpkg")
set(VCPKG_INSTALLED_PATH "${VCPKG_ROOT}/installed/x64-windows")
list(APPEND CMAKE_PREFIX_PATH "${VCPKG_INSTALLED_PATH}")
list(APPEND CMAKE_MODULE_PATH "${VCPKG_INSTALLED_PATH}/share")
set(SOURCES
"model/Texture.cpp"
"utilities/Timer.cpp"
"world/Track.cpp"
"world/TrackSleepers.cpp"
"world/SleeperPaths.cpp"
"world/SleeperFeatures.cpp"
"world/SleeperLines.cpp"
"world/SleeperLayout.cpp"
"world/SleeperModels.cpp"
"world/SleeperWorker.cpp"
"world/GaugeLine.cpp"
"world/RailCrossings.cpp"
"world/RailMaterials.cpp"
"world/RailProfile.cpp"
"world/RailPlan.cpp"
"world/RailCarve.cpp"
"world/RailLayer.cpp"
"world/TrackUneven.cpp"
"world/Road.cpp"
"world/Sweep.cpp"
"world/RoadPoint.cpp"
"world/Traction.cpp"
"world/TractionPower.cpp"
"vehicle/Train.cpp"
"world/TrkFoll.cpp"
"vehicle/AirCoupler.cpp"
"model/AnimModel.cpp"
"vehicle/Button.cpp"
"vehicle/Camera.cpp"
"vehicle/Driver.cpp"
"application/driverhints.cpp"
"vehicle/DynObj.cpp"
"EU07.cpp"
"export_e3d_standalone.cpp"
"export_btf_standalone.cpp"
"nodebank_previews_standalone.cpp"
"world/Event.cpp"
"world/EvLaunch.cpp"
"utilities/Float3d.cpp"
"vehicle/Gauge.cpp"
"utilities/Globals.cpp"
"utilities/Logs.cpp"
"model/MdlMngr.cpp"
"world/MemCell.cpp"
"model/Model3d.cpp"
"world/mtable.cpp"
"rendering/nullrenderer.cpp"
"rendering/renderer.cpp"
"model/ResourceManager.cpp"
"scene/sn_utils.cpp"
"world/Segment.cpp"
"environment/sky.cpp"
"environment/sun.cpp"
"environment/stars.cpp"
"rendering/lightarray.cpp"
"environment/skydome.cpp"
"audio/sound.cpp"
"world/Spring.cpp"
"rendering/frustum.cpp"
"application/uilayer.cpp"
"rendering/openglmatrixstack.cpp"
"environment/moon.cpp"
"input/command.cpp"
"input/keyboardinput.cpp"
"input/gamepadinput.cpp"
"input/drivermouseinput.cpp"
"utilities/translation.cpp"
"model/material.cpp"
"stdafx.cpp"
"input/messaging.cpp"
"scene/scene.cpp"
"scene/scenenode.cpp"
"simulation/simulation.cpp"
"simulation/blackboxrecorder.cpp"
"model/vertex.cpp"
"audio/audio.cpp"
"audio/audiorenderer.cpp"
"utilities/motiontelemetry.cpp"
"application/uitranscripts.cpp"
"world/station.cpp"
"application/application.cpp"
"simulation/simulationtime.cpp"
"simulation/simulationtest.cpp"
"scene/sceneeditor.cpp"
"rendering/screenshot.cpp"
"input/driverkeyboardinput.cpp"
"application/drivermode.cpp"
"application/driveruilayer.cpp"
"application/driveruipanels.cpp"
"input/editorkeyboardinput.cpp"
"editor/editorSettings.cpp"
"editor/editorModelSets.cpp"
"editor/editorTrackPresets.cpp"
"editor/editorIncludeInfo.cpp"
"editor/editorTerrain.cpp"
"editor/editorTrack.cpp"
"editor/editorTrackTrace.cpp"
"editor/editorFouling.cpp"
"editor/editorRoad.cpp"
"editor/editorAlignment.cpp"
"editor/editorTrackShape.cpp"
"editor/editorGroundFollow.cpp"
"editor/editorAlignmentStore.cpp"
"editor/editorSwitchStore.cpp"
"editor/editorSwitchCurve.cpp"
"editor/editorKilometrage.cpp"
"editor/editorStation.cpp"
"editor/editorSwitchDesign.cpp"
"editor/editorConnections.cpp"
"application/editormodeconnection.cpp"
"application/editormodeconnectioncurve.cpp"
"application/editormodedigitize.cpp"
"editor/editorSpeed.cpp"
"editor/editorProfile.cpp"
"editor/editorGauge.cpp"
"editor/editorInfra.cpp"
"editor/editorTerrainStreamer.cpp"
"editor/editorOrthophoto.cpp"
"editor/editorHttp.cpp"
"editor/editorNmt.cpp"
"editor/editorGeoMap.cpp"
"editor/editorPreviews.cpp"
"editor/editorIcons.cpp"
"editor/editorClips.cpp"
"application/editormode.cpp"
"application/editormodetrack.cpp"
"application/editormoderoute.cpp"
"application/editormodestraights.cpp"
"application/editormodelay.cpp"
"application/editormodeswitchplace.cpp"
"application/editormodetrackgizmo.cpp"
"application/editormoderecords.cpp"
"application/editormodeswitchdrive.cpp"
"application/editormodeswitchtool.cpp"
"application/editormodeswitchtemplate.cpp"
"application/editormodenmt.cpp"
"application/editormodegradeline.cpp"
"application/editormodeswitchslide.cpp"
"application/editormodeswitchdesign.cpp"
"application/editormodetrackbed.cpp"
"application/editormodetrackux.cpp"
"application/editormodetrackprops.cpp"
"application/editormoderoad.cpp"
"application/editormodeprofile.cpp"
"application/editormodetextures.cpp"
"application/editormodegauge.cpp"
"application/editormoderide.cpp"
"application/editormodeminimap.cpp"
"application/editormodeinfra.cpp"
"application/editormodespeed.cpp"
"application/editormodesrk.cpp"
"application/editormodekm.cpp"
"application/editormodejoints.cpp"
"application/editormodeparallel.cpp"
"application/editormodelineside.cpp"
"application/editormodevehicle.cpp"
"application/editormodeselection.cpp"
"application/editormodeviewport.cpp"
"application/editormodesignal.cpp"
"application/editormodesweep.cpp"
"application/editormodeturntable.cpp"
"application/editormodeselftest.cpp"
"application/editormodeselftestscene.cpp"
"application/editormodeselftestsleepers.cpp"
"application/editormodeselftestsweep.cpp"
"application/editormodeselftesttrack.cpp"
"application/editormodeselftestswitch.cpp"
"application/editormodeselftestjoin.cpp"
"application/editormodeselftestsignal.cpp"
"application/editormodeselftestterrain.cpp"
"application/editormodeselftestrails.cpp"
"application/editormodeselftestmonkey.cpp"
"application/scriptedinput.cpp"
"input/editormouseinput.cpp"
"application/editoruilayer.cpp"
"application/editoruipanels.cpp"
"application/scenarioloadermode.cpp"
"application/scenarioloaderuilayer.cpp"
"scene/scenenodegroups.cpp"
"scene/scenelayers.cpp"
"scene/scenelayerssave.cpp"
"scene/sceneterrain.cpp"
"scene/heightmapterrain.cpp"
"scene/scenemodelentries.cpp"
"simulation/simulationenvironment.cpp"
"simulation/simulationstateserializer.cpp"
"rendering/precipitation.cpp"
"scripting/pythonscreenviewer.cpp"
"utilities/dictionary.cpp"
"rendering/particles.cpp"
"utilities/headtrack.cpp"
"rendering/geometrybank.cpp"
"rendering/openglcolor.cpp"
"simulation/simulationsounds.cpp"
"rendering/openglcamera.cpp"
"network/network.cpp"
"network/message.cpp"
"network/manager.cpp"
"network/backend/asio.cpp"
"widgets/vehiclelist.cpp"
"widgets/map.cpp"
"widgets/map_objects.cpp"
"widgets/popup.cpp"
"widgets/time.cpp"
"widgets/vehicleparams.cpp"
"widgets/trainingcard.cpp"
"widgets/perfgraphs.cpp"
"${DEPS_DIR}/glad/src/glad.c"
"${DEPS_DIR}/dds-ktx/src/dds-ktx.c"
"${DEPS_DIR}/zstd/zstd.c"
"gl/shader.cpp"
"gl/vao.cpp"
"gl/ubo.cpp"
"gl/framebuffer.cpp"
"gl/renderbuffer.cpp"
"gl/postfx.cpp"
"gl/cubemap.cpp"
"gl/glsl_common.cpp"
"gl/buffer.cpp"
"gl/fence.cpp"
"gl/pbo.cpp"
"gl/query.cpp"
"imgui/imgui.cpp"
"imgui/imgui_demo.cpp"
"imgui/imgui_draw.cpp"
"imgui/imgui_widgets.cpp"
"imgui/imgui_tables.cpp"
"imgui/imgui_impl_glfw.cpp"
"imgui/ImGuizmo.cpp"
"stb/stb_image.c"
"launcher/launchermode.cpp"
"launcher/scenery_list.cpp"
"launcher/launcheruilayer.cpp"
"launcher/vehicle_picker.cpp"
"launcher/keymapper.cpp"
"launcher/textures_scanner.cpp"
"launcher/scenery_scanner.cpp"
"launcher/scenery_wizard.cpp"
"vr/vr_interface.cpp"
)
set(DEFINITIONS)
set(SOURCES ${SOURCES} "imgui/imgui_impl_opengl3.cpp")
set(SOURCES ${SOURCES} "imgui/imgui_impl_opengl2.cpp")
set_source_files_properties("imgui/imgui_impl_opengl3.cpp" PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)
set_source_files_properties("imgui/imgui_impl_opengl2.cpp" PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)
if (WITH_CRASHPAD)
set(DEFINITIONS ${DEFINITIONS} "WITH_CRASHPAD")
set(SOURCES ${SOURCES} "utilities/crashreporter.cpp")
if (WIN32)
include_directories("${DEPS_DIR}/crashpad/include" "${DEPS_DIR}/crashpad/include/mini_chromium")
else()
include_directories("${DEPS_DIR}/crashpad/crashpad" "${DEPS_DIR}/crashpad/crashpad/third_party/mini_chromium/mini_chromium")
endif()
endif()
if(WITH_PYTHON)
set(DEFINITIONS ${DEFINITIONS} "WITH_PYTHON")
set(SOURCES ${SOURCES} "scripting/PyInt.cpp")
else()
set(SOURCES ${SOURCES} "scripting/PyIntStub.cpp")
endif()
if (WITH_UART)
set(DEFINITIONS ${DEFINITIONS} "WITH_UART")
set(SOURCES ${SOURCES} "utilities/uart.cpp")
endif()
if (WITH_ZMQ)
set(DEFINITIONS ${DEFINITIONS} "WITH_ZMQ")
set(SOURCES ${SOURCES} "input/zmq_input.cpp")
endif()
if (WITH_OPENVR)
set(DEFINITIONS ${DEFINITIONS} "WITH_OPENVR")
set(SOURCES ${SOURCES} "vr/openvr_imp.cpp")
endif()
if (WITH_LUA)
set(DEFINITIONS ${DEFINITIONS} "WITH_LUA")
set(SOURCES ${SOURCES} "scripting/lua.cpp")
endif()
# the script screens (scripting/scriptscreens.cpp), with the Lua and the WebAssembly runtime when they're built
set(SOURCES ${SOURCES} "scripting/scriptscreens.cpp")
if (WITH_LUA)
set(SOURCES ${SOURCES} "scripting/luaprogram.cpp")
endif()
if (WITH_WASM)
set(DEFINITIONS ${DEFINITIONS} "WITH_WASM")
set(SOURCES ${SOURCES} "scripting/wasmprogram.cpp")
endif()
if (WITHDUMPGEN)
set(DEFINITIONS ${DEFINITIONS} "WITHDUMPGEN")
endif()
if (WITH_OPENGL_MODERN)
set(SOURCES ${SOURCES}
"rendering/opengl33geometrybank.cpp"
"rendering/opengl33light.cpp"
"rendering/opengl33skydome.cpp"
"rendering/opengl33precipitation.cpp"
"rendering/opengl33particles.cpp"
"rendering/opengl33terrain.cpp"
"rendering/opengl33screenpost.cpp"
"rendering/opengl33renderer.cpp")
set(DEFINITIONS ${DEFINITIONS} "WITH_OPENGL_MODERN")
endif()
if (WITH_OPENGL_LEGACY)
set(SOURCES ${SOURCES}
"rendering/openglgeometrybank.cpp"
"rendering/opengllight.cpp"
"rendering/openglskydome.cpp"
"rendering/openglprecipitation.cpp"
"rendering/openglparticles.cpp"
"rendering/openglrenderer.cpp")
set(DEFINITIONS ${DEFINITIONS} "WITH_OPENGL_LEGACY")
endif()
add_subdirectory("${DEPS_DIR}/glfw/" EXCLUDE_FROM_ALL)
set(SOURCES ${SOURCES} "extras/piped_proc.cpp" "widgets/cameraview_extcam.cpp")
find_package(Git)
if (GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --match=DUMMY --always --dirty
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${GIT_EXECUTABLE} show -s --format=%ci
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE SRC_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${GIT_EXECUTABLE} show -s --format=%cs
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE SRC_SHORT_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
string(TIMESTAMP SRC_SHORT_DATE %Y-%m-%d UTC)
string(TIMESTAMP SRC_DATE UTC)
set(GIT_HASH "(unknown)")
endif()
configure_file("${CMAKE_SOURCE_DIR}/version_info.h.in" "${CMAKE_BINARY_DIR}/geninc/version_info.h")
# the icons of the editor are built into the executable: the png is written out as the bytes of an array, see editor/editorIcons.cpp
set(EDITOR_ICONS "${CMAKE_SOURCE_DIR}/editor/icons/editor_icons.png")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${EDITOR_ICONS}")
file(READ "${EDITOR_ICONS}" EDITOR_ICONS_HEX HEX)
string(REGEX REPLACE "(................................)" "\\1\n" EDITOR_ICONS_HEX "${EDITOR_ICONS_HEX}")
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," EDITOR_ICONS_HEX "${EDITOR_ICONS_HEX}")
file(CONFIGURE OUTPUT "${CMAKE_BINARY_DIR}/geninc/editor_icons_png.inc" CONTENT "${EDITOR_ICONS_HEX}\n")
set (PREFIX "")
set (SUFFIX "")
if (ADD_VERSION_SUFFIX)
set (SUFFIX "_${SRC_SHORT_DATE}_${GIT_HASH}")
endif()
set(OPENVR_LIBRARY "openvr_api")
set(OPENVR_INCLUDE_DIR "")
if (WIN32)
set(DEFINITIONS ${DEFINITIONS} "HAVE_ROUND") # to make pymath to not redefine round
# set(DEFINITIONS ${DEFINITIONS} "GLFW_DLL")
set(SOURCES ${SOURCES} "windows.cpp" "Console.cpp" "Console/LPT.cpp" "Console/PoKeys55.cpp")
#set(GLFW3_INCLUDE_DIR ${GLFW3_INCLUDE_DIR} "${DEPS_DIR}/glfw/include/")
set(PNG_INCLUDE_DIRS ${PNG_INCLUDE_DIRS} "${DEPS_DIR}/libpng/include/")
#set(ZLIB_INCLUDE_DIR ${ZLIB_INCLUDE_DIR} "${DEPS_DIR}/zlib/")
set(OPENAL_INCLUDE_DIR ${OPENAL_INCLUDE_DIR} "${DEPS_DIR}/openal/include")
set(LIBSNDFILE_INCLUDE_DIR ${LIBSNDFILE_INCLUDE_DIR} "${DEPS_DIR}/libsndfile/include")
set(LUAJIT_INCLUDE_DIR ${LUAJIT_INCLUDE_DIR} "${DEPS_DIR}/luajit/include")
set(libserialport_INCLUDE_DIR ${LIBSERIALPORT_INCLUDE_DIR} "${DEPS_DIR}/libserialport/include")
set(OPENVR_INCLUDE_DIR "${DEPS_DIR}/openvr/include")
#if(${CMAKE_EXE_LINKER_FLAGS} STREQUAL "/machine:x64")
# set (ARCH "x64")
#else()
# set (ARCH "x86")
#endif()
set(ARCH "x64")
set (PREFIX "-${ARCH}")
#set(GLFW3_LIBRARIES ${GLFW3_LIBRARIES} "${DEPS_DIR}/glfw/lib/${ARCH}/glfw3dll.lib")
set(PNG_LIBRARIES ${PNG_LIBRARIES} "${DEPS_DIR}/libpng/lib/${ARCH}/libpng16.lib")
set(OPENAL_LIBRARY ${OPENAL_LIBRARY} "${DEPS_DIR}/openal/lib/${ARCH}/OpenAL32.lib")
set(LIBSNDFILE_LIBRARY ${LIBSNDFILE_LIBRARY} "${DEPS_DIR}/libsndfile/lib/${ARCH}/libsndfile-1.lib")
set(LUAJIT_LIBRARIES ${LUAJIT_LIBRARIES} "${DEPS_DIR}/luajit/lib/${ARCH}/lua51.lib")
set(libserialport_LIBRARY ${LIBSERIALPORT_LIBRARY} "${DEPS_DIR}/libserialport/lib/${ARCH}/libserialport-0.lib")
set(cppzmq_LIBRARY ${cppzmq_LIBRARY} "${DEPS_DIR}/cppzmq/lib/${ARCH}/libzmq.lib")
set(OPENVR_LIBRARY "${DEPS_DIR}/openvr/lib/${ARCH}/openvr_api.lib")
endif()
set(cppzmq_INCLUDE_DIR ${cppzmq_INCLUDE_DIR} "${DEPS_DIR}/cppzmq/include")
set(GLM_INCLUDE_DIR ${GLM_INCLUDE_DIR} "${DEPS_DIR}/glm/")
# Process version.rc.in into version.rc
configure_file(${CMAKE_SOURCE_DIR}/eu07.rc.in
${CMAKE_BINARY_DIR}/eu07.rc @ONLY)
if (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
set(SOURCES ${SOURCES} ${CMAKE_BINARY_DIR}/eu07.rc)
set(SOURCES ${SOURCES} eu07.ico)
set(SOURCES ${SOURCES} eu07.ico
editor/editorSettings.hpp)
add_compile_options("/utf-8")
endif()
# the build settings of the game: include dirs, definitions, compile options and libraries. the game,
# its core library and the unit tests all build with the same ones
add_library(eu07_settings INTERFACE)
# the parts of the simulation the game shares with the unit tests: the vehicle physics, the vehicle
# definition parser, the helpers they use and the rules of the test mode. built once, and tested as the game uses them
set(CORE_SOURCES
"McZapkie/friction.cpp"
"McZapkie/hamulce.cpp"
"McZapkie/Mover.cpp"
"McZapkie/couplerphysics.cpp"
"McZapkie/Oerlikon_ESt.cpp"
"utilities/parser.cpp"
"utilities/utilities.cpp"
"scripting/ladderlogic.cpp"
"scripting/scriptscreenrules.cpp"
"scripting/scriptscreenkernels.cpp"
"scripting/scriptscreendrawing.cpp"
"simulation/simulationtestrules.cpp"
"vehicle/blackbox.cpp"
"vehicle/enginestart.cpp"
"vehicle/brakesetting.cpp"
"vehicle/handover.cpp"
"vehicle/horn.cpp"
"vehicle/linebreaker.cpp"
"vehicle/smoke.cpp"
"vehicle/odometer.cpp"
)
add_library(eu07_core STATIC ${CORE_SOURCES})
target_link_libraries(eu07_core PUBLIC eu07_settings)
set_target_properties(eu07_core PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
FOLDER "libraries")
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
target_link_libraries(${PROJECT_NAME} eu07_core)
target_compile_definitions(eu07_settings INTERFACE ${DEFINITIONS})
target_include_directories(eu07_settings INTERFACE
"."
"Console"
"McZapkie"
"gl"
"${DEPS_DIR}/glad/include"
"${DEPS_DIR}/dds-ktx/include"
"${DEPS_DIR}/zstd"
"${CMAKE_BINARY_DIR}/geninc"
"${GLOBAL_INCLUDE_DIR}")
if (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
# override cmake defaults
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO " /MD /Zi /O2 /DNDEBUG")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO " /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF")
target_link_options(${PROJECT_NAME} PRIVATE "/MAP")
# /wd4996: disable "deprecation" warnings
# /wd4244: disable warnings for conversion with possible loss of data
# /wd5033: disable because it is all over Python headers
target_compile_options(eu07_settings INTERFACE /wd4996 /wd4244 /wd5033)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/LARGEADDRESSAWARE")
endif()
set_target_properties( ${PROJECT_NAME}
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/pdb"
OUTPUT_NAME "${PROJECT_NAME}${PREFIX}${SUFFIX}"
DEBUG_POSTFIX "_d"
)
check_cxx_symbol_exists(__GNUC__ "" COMPILER_HAVE_GNUC)
if (COMPILER_HAVE_GNUC)
target_compile_options(eu07_settings INTERFACE -fvisibility=hidden)
endif()
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.16.0")
option(USE_PCH "Use precompiled header" ON)
if (USE_PCH)
target_precompile_headers(${PROJECT_NAME} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/stdafx.h>")
target_precompile_headers(eu07_core PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/stdafx.h>")
set_source_files_properties("/glad/src/glad.c" "ref/dds-ktx/src/dds-ktx.c" "ref/zstd/zstd.c" "stb/stb_image.c"
"imgui/imgui.cpp" "imgui/imgui_demo.cpp" "imgui/imgui_draw.cpp" "imgui/imgui_widgets.cpp" "imgui/imgui_tables.cpp" "imgui/imgui_impl_glfw.cpp" "imgui/ImGuizmo.cpp"
PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)
endif()
endif()
if (USE_LTO)
set_property(TARGET ${PROJECT_NAME} eu07_core PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
if (WITH_OPENVR)
target_include_directories(eu07_settings INTERFACE ${OPENVR_INCLUDE_DIR})
target_link_libraries(eu07_settings INTERFACE ${OPENVR_LIBRARY})
endif()
if (WITH_CRASHPAD)
if (WIN32)
target_link_libraries(${PROJECT_NAME} "${DEPS_DIR}/crashpad/lib_md/base.lib")
target_link_libraries(${PROJECT_NAME} "${DEPS_DIR}/crashpad/lib_md/client.lib")
target_link_libraries(${PROJECT_NAME} "${DEPS_DIR}/crashpad/lib_md/util.lib")
else()
target_link_libraries(${PROJECT_NAME} "${DEPS_DIR}/crashpad/crashpad/out/Default/obj/client/libclient.a")
target_link_libraries(${PROJECT_NAME} "${DEPS_DIR}/crashpad/crashpad/out/Default/obj/util/libutil.a")
target_link_libraries(${PROJECT_NAME} "${DEPS_DIR}/crashpad/crashpad/out/Default/obj/third_party/mini_chromium/mini_chromium/base/libbase.a")
endif()
endif()
target_link_libraries(eu07_settings INTERFACE glfw)
if(WITH_PYTHON)
find_package(Python3 3.14 REQUIRED COMPONENTS Development)
target_include_directories(eu07_settings INTERFACE ${Python3_INCLUDE_DIRS})
target_link_libraries(eu07_settings INTERFACE ${Python3_LIBRARIES})
if(WIN32)
# Python3_ROOT_DIR is only an input hint and is not populated by
# find_package(... COMPONENTS Development). Derive the install root from
# the include dir (parent of <root>/include) when it was not provided.
if(NOT Python3_ROOT_DIR)
get_filename_component(Python3_ROOT_DIR "${Python3_INCLUDE_DIRS}" DIRECTORY)
endif()
set(EU07_PY_DLL "${Python3_ROOT_DIR}/python314.dll")
set(EU07_PY_ZLIB "${Python3_ROOT_DIR}/DLLs/zlib1.dll")
set(EU07_PY_LIBDIR "${Python3_ROOT_DIR}/Lib")
set(EU07_PY_DLLSDIR "${Python3_ROOT_DIR}/DLLs")
endif()
endif()
if (NOT WIN32)
find_package(PNG 1.6 REQUIRED)
target_link_libraries(eu07_settings INTERFACE PNG::PNG)
else()
include_directories(${PNG_INCLUDE_DIRS})
target_link_libraries(eu07_settings INTERFACE ${PNG_LIBRARIES})
endif()
find_package(Threads REQUIRED)
target_link_libraries(eu07_settings INTERFACE Threads::Threads)
find_package(GLM REQUIRED)
target_include_directories(eu07_settings INTERFACE ${GLM_INCLUDE_DIR})
# JSON lib
add_subdirectory(ref/json)
target_link_libraries(eu07_settings INTERFACE nlohmann_json::nlohmann_json)
target_include_directories(eu07_settings INTERFACE ${NLOHMANN_JSON_INCLUDE_INSTALL_DIR})
if (WITH_DISCORD_RPC)
add_subdirectory(ref/discord-rpc)
set_target_properties(discord-rpc PROPERTIES FOLDER "libraries")
target_link_libraries(eu07_settings INTERFACE discord-rpc)
# Add the include directory so the compiler can find discord_rpc.h
target_include_directories(eu07_settings INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/ref/discord-rpc/include"
)
target_compile_definitions(eu07_settings INTERFACE WITH_DISCORD_RPC=1)
else()
target_compile_definitions(eu07_settings INTERFACE WITH_DISCORD_RPC=0)
endif()
if(WITH_EDITOR_SELFTESTS)
target_compile_definitions(eu07_settings INTERFACE WITH_EDITOR_SELFTESTS=1)
else()
target_compile_definitions(eu07_settings INTERFACE WITH_EDITOR_SELFTESTS=0)
endif()
find_package(OpenAL REQUIRED)
if (TARGET OpenAL::OpenAL)
target_link_libraries(eu07_settings INTERFACE OpenAL::OpenAL)
else()
target_include_directories(eu07_settings INTERFACE ${OPENAL_INCLUDE_DIR})
target_link_libraries(eu07_settings INTERFACE ${OPENAL_LIBRARY})
endif()
find_package(SndFile REQUIRED)
target_link_libraries(eu07_settings INTERFACE SndFile::sndfile)
if (WITH_LUA)
find_package(LuaJIT REQUIRED)
target_include_directories(eu07_settings INTERFACE ${LUAJIT_INCLUDE_DIR})
target_link_libraries(eu07_settings INTERFACE ${LUAJIT_LIBRARIES})
endif()
if (WITH_UART)
find_package(libserialport REQUIRED)
target_include_directories(eu07_settings INTERFACE ${libserialport_INCLUDE_DIR})
target_link_libraries(eu07_settings INTERFACE ${libserialport_LIBRARY})
endif()
find_package(ASIO REQUIRED)
target_link_libraries(eu07_settings INTERFACE asio::asio)
if (WIN32)
target_link_libraries(eu07_settings INTERFACE ws2_32)
endif()
# http client of the editor, for the orthophoto, the terrain model and the topo map of geoportal.gov.pl: WinHTTP on Windows,
# libcurl elsewhere when available
if (WIN32)
target_link_libraries(eu07_settings INTERFACE winhttp)
else()
find_package(CURL QUIET)
if (CURL_FOUND)
target_link_libraries(eu07_settings INTERFACE CURL::libcurl)
target_compile_definitions(eu07_settings INTERFACE EU07_WITH_CURL)
else()
message(STATUS "libcurl not found: the editor's orthophoto and terrain model will only show what's cached, its topo map nothing")
endif()
endif()
if (WITH_ZMQ)
find_package(cppzmq REQUIRED)
target_include_directories(eu07_settings INTERFACE ${cppzmq_INCLUDE_DIR})
target_link_libraries(eu07_settings INTERFACE ${cppzmq_LIBRARY})
endif()
if (WIN32)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy -t $<TARGET_FILE_DIR:${PROJECT_NAME}> $<TARGET_RUNTIME_DLLS:${PROJECT_NAME}>
COMMAND_EXPAND_LISTS
)
endif ()
# Linux: the game loads its shared libraries from its own folder first ($ORIGIN), and the build copies them there,
# so the folder runs on a system that doesn't have them, or has other versions. the RPATH is a DT_RPATH rather
# than a DT_RUNPATH, because only that one is also used for the libraries the copied ones load (libsndfile's codecs)
if (UNIX AND NOT APPLE)
option(BUNDLE_RUNTIME_LIBS "Linux: copy the shared libraries the game needs next to it and load them from there" ON)
endif()
if (UNIX AND NOT APPLE AND BUNDLE_RUNTIME_LIBS)
set_target_properties(${PROJECT_NAME} PROPERTIES
BUILD_WITH_INSTALL_RPATH TRUE
INSTALL_RPATH "$ORIGIN")
target_link_options(${PROJECT_NAME} PRIVATE "LINKER:--disable-new-dtags")
# the RPATH no longer leads to libraries outside the system folders (Python from setup-python, an OpenAL Soft
# in /usr/local), so their folders are given to the script as well
set(EU07_BUNDLE_SEARCH_DIRS "")
foreach(library IN LISTS Python3_LIBRARIES OPENAL_LIBRARY LUAJIT_LIBRARIES libserialport_LIBRARY)
if (IS_ABSOLUTE "${library}")
get_filename_component(library_dir "${library}" DIRECTORY)
list(APPEND EU07_BUNDLE_SEARCH_DIRS "${library_dir}")
endif()
endforeach()
list(APPEND EU07_BUNDLE_SEARCH_DIRS ${Python3_LIBRARY_DIRS})
list(REMOVE_DUPLICATES EU07_BUNDLE_SEARCH_DIRS)
string(REPLACE ";" "|" EU07_BUNDLE_SEARCH_DIRS "${EU07_BUNDLE_SEARCH_DIRS}")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND}
-DGAME=$<TARGET_FILE:${PROJECT_NAME}>
-DSEARCH_DIRS=${EU07_BUNDLE_SEARCH_DIRS}
-DCMAKE_OBJDUMP=${CMAKE_OBJDUMP}
-P "${CMAKE_CURRENT_SOURCE_DIR}/CMake_modules/bundle_runtime_libs.cmake"
COMMENT "Copying the shared libraries next to the game"
VERBATIM)
endif()
if(WIN32 AND WITH_PYTHON)
# the Python runtime next to the game, copied when it isn't there yet or the Python install changed, rather
# than after every link of the game: the library alone is thousands of files. the folder is the game's
# RUNTIME_OUTPUT_DIRECTORY, spelled out: $<TARGET_FILE_DIR:eu07> here would make this target depend on the game
get_property(EU07_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (EU07_MULTI_CONFIG)
set(EU07_PY_TARGET_DIR "${CMAKE_BINARY_DIR}/bin/$<CONFIG>")
else()
set(EU07_PY_TARGET_DIR "${CMAKE_BINARY_DIR}/bin")
endif()
set(EU07_PY_STAMP "${EU07_PY_TARGET_DIR}/python64/python_runtime.stamp")
add_custom_command(
OUTPUT "${EU07_PY_STAMP}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${EU07_PY_DLL}" "${EU07_PY_TARGET_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${EU07_PY_ZLIB}" "${EU07_PY_TARGET_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different "${EU07_PY_LIBDIR}" "${EU07_PY_TARGET_DIR}/python64/Lib"
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different "${EU07_PY_DLLSDIR}" "${EU07_PY_TARGET_DIR}/python64/DLLs"
COMMAND ${CMAKE_COMMAND} -E touch "${EU07_PY_STAMP}"
DEPENDS "${EU07_PY_DLL}" "${EU07_PY_ZLIB}"
COMMENT "Copying the Python runtime next to the game"
VERBATIM)
add_custom_target(eu07_python_runtime DEPENDS "${EU07_PY_STAMP}")
set_target_properties(eu07_python_runtime PROPERTIES FOLDER "libraries")
add_dependencies(${PROJECT_NAME} eu07_python_runtime)
endif()
if (WITH_WASM)
add_subdirectory("CMake_modules/wamr" "${CMAKE_CURRENT_BINARY_DIR}/wamr")
target_link_libraries(${PROJECT_NAME} eu07_wamr)
endif ()
if (WITH_BETTER_RENDERER)
add_subdirectory("betterRenderer")
set_target_properties(betterRenderer betterRenderer_fsr2 betterRenderer_shaders PROPERTIES FOLDER "renderers")
target_link_libraries(${PROJECT_NAME} "betterRenderer")
endif ()
# yaml-cpp, for the descriptions of scenery templates edited in the scenery editor.
# the experimental renderer brings in the same copy on its own, when enabled
if (NOT TARGET yaml-cpp)
add_subdirectory("betterRenderer/thirdparty/yaml-cpp" "${CMAKE_CURRENT_BINARY_DIR}/yaml-cpp" EXCLUDE_FROM_ALL)
endif ()
target_link_libraries(eu07_settings INTERFACE yaml-cpp)
# Enable compiling with debug symbols
if(GENERATE_PDB)
if (MSVC)
# Ensure Debug and Release configurations use appropriate runtime libraries
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Zi /MDd")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /MD")
# Add compile options for debugging
add_compile_options(/Zi) # Always enable debug symbols
add_link_options(/DEBUG /MAP)
# Ensure that the PCH is built with the correct runtime library for each configuration
set_target_properties(${PROJECT_NAME} eu07_core PROPERTIES
COMPILE_OPTIONS "$<$<CONFIG:Debug>:/MDd>$<$<CONFIG:Release>:/MD>")
else()
# GCC/Clang (ensure -g is set for all configurations)
add_compile_options(-g)
endif()
endif()
if(ENABLE_MCC AND MSVC)
message(STATUS "Enabling multi-processor compilation for MSVC.")
add_compile_options(/MP)
endif()
if(ENABLE_AVX2)
message(STATUS "Enabling AVX2 instruction set.")
if (MSVC)
target_compile_options(eu07_settings INTERFACE /arch:AVX2)
else()
target_compile_options(eu07_settings INTERFACE -mavx2)
endif()
endif()
if(WITH_TESTS)
enable_testing()
add_subdirectory(tests/unit)
# the unit tests run at the end of building the game, once it's linked: a failing one fails the build
# (and removes the game binary, so the next build links it again and reruns them)
add_dependencies(${PROJECT_NAME} eu07_unit_tests)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND}
-DTESTS=$<TARGET_FILE:eu07_unit_tests>
-DGAME=$<TARGET_FILE:${PROJECT_NAME}>
-P "${CMAKE_CURRENT_SOURCE_DIR}/tests/unit/run_tests.cmake"
COMMENT "Running the unit tests"
VERBATIM)
# a change of the tests alone links the game again, so they run (Ninja and Makefile generators;
# Visual Studio builds rerun them with the next change of the game)
set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY LINK_DEPENDS
$<TARGET_FILE:eu07_unit_tests> ${UNIT_TEST_DATA} "${CMAKE_CURRENT_SOURCE_DIR}/tests/unit/run_tests.cmake")
endif()