The name of a node or "(no name)" was written out in twenty places and
four local functions, a lower-case copy of a text in four files, the
test for a number, the file name of a template made comparable and the
heading of a direction in three and two, the green main button of a
panel in five and the key=value parameters of a self-test command in
five. Each of them is one helper now: name_of, tall_button_height and
main_button with the panel helpers, numeric with format, normalized
with the include helpers, heading_of with the plan geometry and
selftest_values with the tools; lower gives way to ToLower.
Found with an address and undefined behaviour sanitizer build, random
monkey sessions on the test sceneries and broken inputs:
- A deleted model left its pointer in the pick list of the renderer, the
bound node of the panels, the bindings of the infrastructure and the
selection: the next pick or panel frame read freed memory. The renderer
forgets it, and one erase_model does the cleaning for all the places
which deleted a model by hand.
- The plan band of a route read the vertex before the first one in the
frame a drag was let go.
- A scenery which can't be opened goes back to the launcher with the
reason in the log, a track of an unknown type or a tributary loads as
a normal track or a river with a message, and a spline with no finite
length or step gets a sane number of segments.
- Typed numbers which aren't (NaN, inf, ends 0 m or 1000 km apart, a
vector of 1e30, a diverging track part of 5 km, a curve threshold of 0,
a zero history size, radius norms below zero) are refused or clamped,
where they made the geometry run away or divide by zero.
- Folders which can't be read and file names which aren't valid in the
locale no longer throw out of the scans of sceneries, textures, sweeps,
roads and signal plates; the scans skip them.
- The launcher: Ctrl+Del with no trainset selected, a dropped vehicle
whose skin is gone and a text with a percent sign.
- A terrain mesh made for another resolution of its chunk isn't put into
the chunk, and a slot is reused only for a mesh of the same size.
- Vehicles on a track changed by the editor are moved over a copy of the
list they leave.
- The table of the keyboard shortcuts gives its stretched column a
weight, else ImGui divides 0 by 0 in the first frame of the window.
The include bank read every .inc of the scenery directory on the first use, on the main thread: opening the
switch panel or selecting a switch stopped the editor until all of them were read, which on a large scenery
directory under Windows takes long. The bank now starts looking as the editor starts, in the background,
and the main thread only reads the descriptions once the files are read.
- the switch drives, turntables and signals are read again from the bank when it changes; the panels show
"Looking for the templates..." meanwhile, only the edits which need the templates wait for them
- the sweep tool takes the templates from the bank instead of looking through the scenery directory again
- a folder linked into one of its own subfolders no longer leads the walk in circles
- the log tells how many templates were found and how long it took
Labels:
- every button, field, tooltip and message of the editor reread for a beginner: short nouns for the fields with the
sentence in the tooltip, the less used options under More settings, one glossary (field of work, template, track,
grade), sides told from directions, degrees and per mille as signs, messages built from one format string
- plural forms through STR_P; the last entry of a po file is read too, and the Polish plural rule is in the header
- lang/editor_pl.po: the code pass entries merged, 391 entries no code uses and 3 duplicates dropped
- roads: the notes and errors naming a road translated; the build options and the layout fold the texture length,
kerb sizes, traffic share, roundabout part, height over the ground and junction speed limit under More settings, the
lanes start folded
Grade lines fitted to the terrain model (NMT), a line or the whole scenery at once:
- fit_ground: a robust fit on nodes 5 m apart; the ground parting from the line (a bridge, a viaduct, a wall) is gone
past rather than followed, the bends keep off the switches as far as their curves reach, a run of bends the same way
is one point of intersection, a curve with no room is as sharp as the room lets it be
- the ends of the line and the other paths of its switches leading into lines fitted already bound the line by what
the tracks between can climb; ends meeting in the plan, laid apart in height by hand, are joined before the run
- apply_profile: the paths are split where split_path takes the parameter (a straight was cut in the wrong place, into
pieces of a few centimetres the game takes for zero length), no piece shorter than the margin; the paths off the
ends of the route are brought to its height
- Bytom: 1600 lines, grade breaks at the joints 89 -> 20; Tarnowskie Gory: 848 lines, 223 -> 3; no step over 2 cm