The angles of the whole gizmo matrix were decomposed every frame and the model was turned by their difference from its own.
The decomposition gives the angle about the vertical axis only within -90..90 degrees: past 90 it comes out as 180 - angle
with the other two axes turned by 180, so a drag one way turned the model back and flipped it. The turn is now taken from
the delta matrix of this frame (small, so its angles decompose with no ambiguity) and wrapped to -180..180.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDcMn1Q7wdYkbxDUWscNHZ
The analyser loses track of references captured by lambdas; the St113 EP and MHZ buttons tests call plain helpers, as ep_brake() and ready_knorr_ep() do, which it doesn't report.
- The Windows build job installs Pillow into the Python 3.14 whose Lib, with
site-packages, CMake copies next to the executable as python64\Lib, as the
Linux job already does; the README says the same for a local build.
- Both build jobs copy staticFiles/python/local (the Python 3 version of the
module every cab screen subclasses) into python/local of the build.
- The module puts back what Pillow 10 removed and the screen scripts use:
ImageFont.getsize() and ImageDraw.textsize() on top of getbbox() /
textbbox(), and Image.ANTIALIAS as LANCZOS. With an older Pillow nothing
changes.
Part of #300.
Review of the alpha to coverage change for alpha tested surfaces:
- An alpha which is flat over the pixel (fwidth 0) and equal to the opacity
threshold got a coverage of 0.5, so e.g. opacity 1 on an opaque or DXT1
texture turned half see-through with multisampling. Without an alpha edge
in the pixel the plain test decides now: step(opacity, alpha).
- The shaders took the coverage path whenever they were built with
multisampling, also where alpha to coverage is off (the reflections pass)
or does nothing (the single-sampled model previews), and grew the cut-outs
there by about half a pixel. model_ubo gets an alpha_to_coverage flag, set
together with the GL state, and the shaders keep the plain alpha test
without it. The previews no longer turn alpha to coverage on. The flag
takes 4 of the 12 padding bytes after shadow_tone, so the std140 layout and
the size of the block stay the same.
- The shader validator never set iMultisampling, so it never compiled the
alpha to coverage branches. Its "features on" configuration uses the
default of 2 now, on desktop GL and GLES.
A popup begun outside any window, as the context menus of the editor, the dialogs for a new scenery and for opening one and the
pause dialog of the driver are, takes no viewport from a parent. It was put into the main window only where it merged there:
with the main window minimized, or behind a panel taken out into a window of its own, it got a window of the system of its own,
with an OpenGL context of its own, the way the editor froze. With io.ConfigViewportsNoAutoDetach the tooltips and popups stay in
the main window there too.
The comment of io.ConfigViewportsNoAutoDetach tells how they're placed: as with the viewports off, not shrunk.
io.ConfigTooltipsWrapWidth moves to the miscellaneous options, it works with the viewports off as well, and its comment tells
that SetItemTooltip() wraps too and BeginTooltip() doesn't.
main() tells a test run (--test) apart before anything runs. Only a test run
catches every exception and installs a std::terminate handler, both ending the
run with the error code and a test: line; any other run keeps master's
exception handling, so on Linux an uncaught runtime_error aborts at the throw
site again.
A test run doesn't start the Discord RPC thread: it published the test
scenery as the player's presence and held the closing up to 5 s.
run.py drops a case scenery's .sbt cache after a run cut short (wall_timeout,
error, a crash, killed by run.py), which could have been writing it.
The -edit branch of the test command line parser had no effect (a token that
isn't an option is ignored either way) and is gone; its test checks what can
be seen instead.
dizel_Momentum() relayed MainSwitch 0 to the consist every frame while the engine stood still, whatever stopped it. In a train with mixed JointEngineStart flags an engine stopped from mainb_off stopped the engines behind it once it spun down, and the stopped engine of the cab's vehicle knocked out the one started from mainb_on. The stop is now relayed only when the engine stalls while running, as on master an engine stalling in a joint start still stops the others.
The lambdas of the St113 EP brake and the MHZ buttons tests called the mover through test::vehicle::operator->(), which the analyser takes as possibly null; they capture a reference from mover() instead.
With the panels in separate windows on (the default), a tooltip or a popup that didn't fit in the main window got a window of
the system of its own, with an OpenGL context of its own. The editor froze so on 2026-11-08: its main thread stuck for good in
the NVIDIA driver while making the context of an invisible window 1925 x 29 px, a tooltip in one line wider than the screen.
The Polish texts of the editor have tooltips of up to 360 characters in a line; the one of the curve mode of laying track is
2088 px wide.
- io.ConfigViewportsNoAutoDetach (a MaSzyna addition, set with the separate windows) keeps the tooltips and popups shown over
the main window inside it too, placed and shrunk as they are without the separate windows: they get no viewport of their
own. A panel dragged out of the main window by hand still gets its window, and the tooltips and popups over it may go past
its edge as before.
- io.ConfigTooltipsWrapWidth (a MaSzyna addition): SetTooltip() wraps its text at this width. The ui sets 40 em, 520 px at the
font of 13 px.
Checked in the editor on a hidden desktop: the tooltip of the curve mode, full screen 1920 x 1080, and the one of the redo
button at the edge of a window 1280 x 720 each made a window of their own before, and none now. Both are drawn in the main
window, the long one in five lines.
The lessons of looking around, laying, the curves, correcting a curve, joining, the switches, selecting and editing with
the gizmo each name a clip, lang/editor_tutorial/<name>.gif. The editor tutorial that #289 brings plays them, but doesn't
carry them: they were recorded on feat/switch-blades and stayed there. Taken from it as they are, 6.1 MB; the packages copy
lang/ whole, so they go out with the game. Without them a lesson just shows no clip.
The three-state door closure lamp is switched on by DoorClosureSignal=Yes in the
Doors: section of the .fiz of the vehicle whose cab shows the lamp (the occupied
vehicle), off by default: without it the lamp keeps showing the lock of the
vehicle's own doors. The eu07.ini switch doorclosuresignal is gone, the data
decides. Sets whose cars lack DoorNeedPermit would blink at every standstill, so
only the sets with permits get the key.
- initialise the cooling power read from the .fiz to its default, no division by an indeterminate value
- integer step counters in the engine start tests
- main_sw opening the consist turns the two-state mainb_sw / mainc_sw off too, left on they'd start the engines again
- the doc comment of MainCircuitOpensWithStarterOnly() back on it; the .fiz read is the controlled vehicle's
- tests: REQUIRE the brake handle before dereferencing it (Sonar cpp:S2259)
- TESt::FillBrakeRes is const (S5817)
- cab EP brake command: drop the mvControlled->EpFuse check, SwitchEPBrake
already checks the cab car's (mvOccupied) EP fuse with the control supply
- AI: with the handle already at the EP brake position, switch the EP brake
on again once the control supply is back
Since #187 the braking curve towards a stop or a lower speed leaves room for
the time the brake takes to respond, as long as the train brake handle is
still in the running position. The horizon it takes has the AI's old
look-ahead, (1 - a0) * 30/3.6 s, about 7-8 s, as its floor; at 60 km/h that
is over 100 m, up to half of the braking distance. Stops at signals were
tuned with it. A vehicle that brakes with its independent brake (an SN61, a
light engine) leaves the train brake handle where it is, so it kept that
room the whole way in: it braked early and gently, came down to 10 km/h
some 50 m out and crawled the rest, applying power and the brake in turn.
Making for a passenger stop (the point the train is to stop at, found by the
scan of the route, is a W4), the room now covers only the time the brake
takes to fill (half its application time), without the look-ahead floor.
Stops at signals and anything else keep the room as it was.
When a vehicle ahead is closer than the stop the scan found, the train makes
for that vehicle, so the room is the full one again.
* feat: 401da oil pump lamp and slotted lever animation (eu07/maszyna#546)
i-oilpump lights while the pre-lubrication oil pump works, so it goes
off once the engine runs. animslottedlever: in the .mmd turns a lever
by a pin on the coupling rod sliding in the lever's slot, which the
speedometer drive of 401Da needs.
The compressor start delay of #546 came with CompressorStartDelay
(Brake section) of master.
* fix: force GLM AVX2 only when the compiler targets AVX2
ENABLE_AVX2=OFF left GLM_FORCE_AVX2 defined, so MSVC still emitted
AVX2 intrinsics and the exe crashed on CPUs without AVX2.
* test: cover the compressor start delay and the oil pump lamp
The delay of an engine stopped before it passed starts over, a
compressor switched on by hand waits too, and the key is read from the
Brake section. In the converter-fed set-up of 401Da the compressor
waits for ConverterStartDelay and then its own delay. The oil pump
(i-oilpump lamp) works before the engine start and stops once the
engine runs.
The EP05's single two-state line breaker lever stayed on once the converter
overload relay knocked the breaker out: every press of the toggle tried to
close the open breaker, which the tripped relay refused. A press now puts
a lever left on over an open breaker off first.
(eu07/maszyna#394)
Whether a train is at a passenger stop (IsAtPassengerStop) was checked against
the final approach margins fMinProximityDist and fMaxProximityDist, which are
themselves set from that flag: 10-15 m and 15-40 m at a stop, 8 m and 50 m
otherwise. With the two sets different, the flag switched on and off on every
other scan of the route on the way to a W4. Each time the train went from a
final approach to a stop 50 m long to one 15 m long and back: braking in one
scan, full power below the 10 km/h coasting speed in the next. Close to the
stop the braking demand did not hold the train to a standstill, and below
1 km/h the stop counted as done, so an SN61 drove off without ever standing
still (#290).
The margins are now worked out in train_proximity_margins(), and the check of
the stop uses the margins of a passenger stop whatever the flag is at the
moment. A vehicle that is not a train keeps the present ones, as before.
* docs(claude): a PR has to pass the Sonar quality gate, not fix every remark
The section on SonarCloud asked for every remark on the changed code to
be fixed, code smells included. It now asks for the quality gate: new
code rated A for reliability, security and maintainability, duplication
at most 3%, hotspots reviewed. A remark that doesn't fail the gate needn't
be fixed, and large restructurings that only answer one stay out of the
PR. The rules that keep coming up stay listed, as the way to keep the
gate passing.
* docs(claude): what the gate's ratings mean for bugs, smells and hotspots
Every bug or vulnerability on new code drops its rating below A and
fails the gate, code smells only count together through the
maintainability rating, and a hotspot is reviewed in SonarCloud rather
than by rewriting the code.
---------
Co-authored-by: maj00r <maj00r@host>
The runtime_error the simulator throws on a fatal problem was caught on Windows
only. On Linux a test run aborted on it, with the code of abort() and no
`test:` line. It is caught there too in test mode and ends the test with the
error code and the reason; outside a test it is thrown on as before.
Both waited for every vehicle of the scenery to stand still, so on a scenery
with AI traffic a test could pass only when the traffic happened to stand too,
and the standstill end hardly ever came.
A test scenery names the train under test with test.vehicle <name> in its
config block (once for each train, if several): the pass and the standstill wait
for the consists of these vehicles as they are at the moment, so a train the
tested one couples to counts with it. A name the scenery doesn't have ends the
test with the error code. Without test.vehicle every vehicle counts, as before.
A signal passed at danger counts for every train either way.
run.py puts the case's lead vehicle into test.vehicle. test_mode_standstill_traffic
has the train under test standing on track 2 of Stacja1 while AI traffic leaves
track 1 on the timetable: it ends on its 100 s standstill, where counting every
vehicle runs into the 300 s timeout. Physicslogs of the other trains of a case
(<something>_<vehicle>) are moved out of the game dir too.
A test run that hung, in the loading or anywhere else, waited until whoever
started it killed it. A watchdog thread now ends a run still going test.wall_timeout
seconds of real time after the start of the simulator, loading included: it says
`test: timeout ... still running after N s of real time` and quits with the
timeout code, whatever the main thread is doing, with no dialog. A test that has
ended but whose simulator doesn't close ends with its own result.
The limit is test.wall_timeout (settings, the scenery's config block) or
--test-wall-timeout, which wins. Not given, it is test.timeout + 600 s: ten
minutes for the loading, and a simulation that runs at least as fast as real
time is never cut short. test.timeout 0 means no watchdog unless the limit is
given; test.wall_timeout 0 turns it off.
run.py passes the case's timeout as --test-wall-timeout and kills a simulator
only 30 s after it. A timeout from the watchdog counts as wall_timeout there, so
a run that hung doesn't pass a case expecting the simulation time to run out;
test_mode_wall_timeout ends while loading on a limit of 2 s.
The log was printed in colour to stdout too (debuglog bit 2), so a script reading
the verdict of a test got the whole log with it. In test mode the log goes to the
log file only and stdout has the `test: ...` line alone; the usage text of a bad
command line goes to stderr. Whether the run is a test is now known before the
log service starts.
The config block of a scenery is read like the settings files, after the test
mode settings were applied, so a scenery with soundenabled, multiplayer,
execonexit, feedbackmode or the like in it got them back in a test run. The test
mode settings now are applied again after each config block of the scenery;
apply_test_mode_settings() moved to simulationtest.cpp for that.
The simulator reads eu07.ini from %APPDATA%/MaSzyna (~/.config/MaSzyna on Linux)
when there is one, in place of the game folder's. A test run then depended on
whose machine it ran on. With --test only the game folder's eu07.ini is read,
then the files given with -ini. The test mode options are taken from the command
line before the settings for that; --test-timeout still wins over test.timeout
of any settings file.
1 is what a process killed with TerminateProcess (and the plain failure of most
programs) ends with, 3 what abort() ends with on Windows, so a fail or a timeout
couldn't be told from a run that was killed or blew up. The codes other than
pass now are 10 fail, 11 signal passed at danger, 12 timeout, 13 standstill and
14 error: none of them a code a process gets on its own, neither the shells'
126-127 nor 128 + a signal number on Linux. pass stays 0.
The command line options of the test mode and the end conditions checked after
each frame are now plain functions in simulation/simulationtestrules.cpp, which
needs nothing of the running simulation: parse_test_command_line() and
evaluate_frame(). The file is part of the core library, so the unit tests check
them (tests/unit/test_test_mode.cpp): the --test-timeout value, values of other
options not taken for options, a pass that waits for the stop, the standstill,
the timeout. test_manager only gathers what a frame brought and acts on the
verdict. No change in behaviour.
Przystanek on td.scn is a technical stop of the td/rozklad timetable (pt): the AI
doesn't wait there for the departure time but sets off as soon as it counts the
train as standing at the W4, below 1 km/h. How long the speed then stays under
0.5 km/h is only how fast the brake releases. With the AI braking of #264 the
trains creep up to the W4 at about 10 km/h on a light application and stood there
for 1-5 s; the SN61 turns back at 0.36 km/h without stopping. The hold of 5 s
(2 s for the SN61) failed for EP09, SN61 and Vectron and had well under a second
to spare for others.
The cases now check that the train comes down to 1 km/h, the AI's own standstill
at a W4, 1380-1420 m from the start; every vehicle stops at 1397-1401 m, before
and after #264. `stops` takes min_distance and max_distance for that.
- what the test mode turns off towards the outside (feedbackmode,
multiplayer, execonexit, showsystemconsole, imgui.ini),
- a command line it can't take or a failed start ends with `error`,
- cmd and PowerShell don't wait for the (windowed) simulator nor show its
output: start /wait, Start-Process -Wait,
- 15 cases, not 14.
The test mode turned off what comes in from outside, but a few settings
of the user's eu07.ini still reached out of a test run:
- feedbackmode: 1 and 2 toggle Caps Lock / Scroll Lock by injecting key
events into the whole system, 3 and 4 drive an LPT port or a PoKeys
desk (and 4 reads the desk's switches);
- multiplayer: events are reported to a multiplayer server, and some
events are held back for it;
- execonexit: a program is run with system() at the end of each run,
which also waits for it;
- showsystemconsole: a console of the run's own pops up and stdout is
reopened on it, so whoever started the test with a redirected output
doesn't get the `test:` line (and a console the run was started from
would be hidden without it);
- imgui.ini in the game folder was written by every run, and by several
at once with run.py -j.
All of these are off in test mode. Nothing changes outside it.
The crash handler of WITHDUMPGEN builds (on by default) shows a message
box before it writes the dump. It also gets the C++ exceptions nothing
catches, since it replaces the CRT's unhandled exception filter. In test
mode nobody is there to close the box, so a crashing test waited for it
until whatever started it gave up (run.py after the case's timeout,
600 s by default). The dump is still written, the exit code is the
exception's.
- `--test` is looked for before the rest of the command line is read. An
unknown option before it (e.g. `-s x.scn --test-timout 90 --test`) used
to end the run with exit code 0, which a caller reads as a pass.
- `--test-timeout` without a value, or with one that isn't a number of
seconds, fails the run instead of leaving the default or, through atof,
turning the timeout off.
- These, a missing -s, a failed start and an exception caught in main()
end the test through test_manager::conclude(), which writes the usual
`test: error (exit code 5) ... : <reason>` line to stdout and the log.
Before, `eu07 --test` alone exited with 5 and nothing anywhere: the
error went to the log queue and the process ended before the log
thread wrote it. In test mode main() now stops the log thread and
waits for it before _Exit().
Outside the test mode nothing changes: conclude() does nothing there.
- TController::TableCheck() calls TSpeedPos::Update() as it did before the
test mode: the check for a signal passed at danger is a call of its own
after it (CheckSignalPassedAtDanger), so the update lines nest no deeper
than on master (S134). A switch is a track, so a signal's update never
takes the switch-change branch and the check runs in the same place as
before; the physicslogs of all 15 scenario cases are byte for byte the
same.
- null_imgui_renderer is final (S1235), to_string(test_result) uses
`using enum` (S6177), init_result_cell() is const (S5817),
ConfigParseTest() takes a std::string_view (S6009) and the test settings
struct is declared apart from its member (S3646).