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

107 Commits

Author SHA1 Message Date
e433b43fef Script screens: led_post and resize of the Lua screens on the gpu 2026-11-10 16:22:35 +01:00
c4924f756d Lua script screens beside the WebAssembly ones 2026-11-10 15:29:25 +01:00
18c333b089 wasm display support 2026-11-10 00:57:37 +01:00
jerrrrycho
12299bb1fa Merge remote-tracking branch 'origin/master' into feat/elf-master-controller-emergency-brake 2026-11-09 16:33:31 +01:00
jerrrrycho
478727850d Merge remote-tracking branch 'origin/master' into feat/diesel-throttle-position-marker
# Conflicts:
#	vehicle/Gauge.h
#	vehicle/Train.cpp
2026-11-09 16:07:48 +01:00
jerrrrycho
cf3080c1f3 Merge remote-tracking branch 'origin/master' into feat/elf-master-controller-emergency-brake
# Conflicts:
#	McZapkie/Mover.cpp
2026-11-09 15:30:38 +01:00
d6b9a94079 Merge pull request #267 from MaSzyna-EU07/fix/light-programmer-coupled-side-headlights
Light programmer: switch off the lights at the coupled end, not the opposite one (eu07/maszyna#395)
2026-11-09 12:58:57 +00:00
7c103b5d2d Merge pull request #268 from MaSzyna-EU07/fix/ws-hold-coil-lever-bistable
Bistable hold coil lever of the line breaker (eu07/maszyna#364)
2026-11-09 12:57:49 +00:00
f61a4ab2e7 Merge pull request #269 from MaSzyna-EU07/fix/diesel-smoke-after-ignition
Diesel exhaust smoke only once the engine fires (eu07/maszyna#523)
2026-11-09 12:57:02 +00:00
7edf23b8ff Merge pull request #270 from MaSzyna-EU07/fix/fpslimit-frame-pacing
fpslimit: pace frames in integer clock ticks, show the real frame rate (eu07/maszyna#416)
2026-11-09 12:56:40 +00:00
fa00fff594 Merge pull request #273 from MaSzyna-EU07/feat/6dg-power-demand-5pct-steps
6Dg: power demand in 5% steps (eu07/maszyna#412)
2026-11-09 12:55:39 +00:00
ff88868d32 Merge pull request #275 from MaSzyna-EU07/fix/sm42-shunt-mode-toggle
SM42: shunt mode at the first move of the switch, CA off in the shunt mode
2026-11-09 12:54:21 +00:00
889aa2d5db Merge pull request #278 from MaSzyna-EU07/feat/shunt-lock-resistive
Field shunting locked at zero and on resistive positions (eu07/maszyna#402)
2026-11-09 12:53:57 +00:00
4a9ab1447e Merge pull request #279 from MaSzyna-EU07/fix/multiple-unit-electric-diesel
No multiple-unit control between electric and diesel locomotives (eu07/maszyna#520)
2026-11-09 12:53:30 +00:00
0c95dbfa5a Merge pull request #280 from MaSzyna-EU07/feat/radio-fuse
Radio fuse: a cut-off in the radio's power supply (eu07/maszyna#438)
2026-11-09 12:53:14 +00:00
ebc9eb8740 Merge pull request #281 from MaSzyna-EU07/feat/shunt-pantograph-config
AI: suggested pantograph setup for shunting in the .fiz (eu07/maszyna#461)
2026-11-09 12:52:58 +00:00
3710b2e5d6 Merge pull request #284 from MaSzyna-EU07/feat/light-programmer-cab-light
Light programmer: cab light flag per position (eu07/maszyna#529)
2026-11-09 12:51:37 +00:00
fedbf458b5 Merge pull request #285 from MaSzyna-EU07/feat/duplicate-cab-control-submodels
Cab controls with more than one submodel (eu07/maszyna#527)
2026-11-09 12:50:54 +00:00
28337b5f28 Merge pull request #286 from MaSzyna-EU07/fix/dimmer-position-bounds
fix(lights): keep the headlight dimmer position within the DimmerList
2026-11-09 12:50:35 +00:00
c1089a6b16 Merge pull request #292 from MaSzyna-EU07/fix/en57-ep2-brake-charging
EN57 brakes: charging when hauled with the brake hose alone, Knorr EP brake only with control power
2026-11-09 12:48:13 +00:00
cb1dd60630 Merge pull request #293 from MaSzyna-EU07/fix/door-inner-faces-lowpoly-lighting
Door wings: let the low poly interior have its own, moving inside of the doors (eu07/maszyna#512)
2026-11-09 12:47:58 +00:00
jerrrrycho
38202f4e57 Merge remote-tracking branch 'origin/master' into feat/second-loco-engine-start
# Conflicts:
#	CMakeLists.txt
2026-11-08 21:51:59 +01:00
jerrrrycho
c0f1749e87 Merge remote-tracking branch 'origin/master' into fix/door-inner-faces-lowpoly-lighting
# Conflicts:
#	vehicle/DynObj.cpp
2026-11-08 21:47:32 +01:00
jerrrrycho
01ec499f54 Merge remote-tracking branch 'origin/master' into feat/diesel-throttle-position-marker
# Conflicts:
#	vehicle/Train.cpp
2026-11-08 21:37:31 +01:00
jerrrrycho
d50a724bc8 Merge remote-tracking branch 'origin/master' into fix/ws-hold-coil-lever-bistable
# Conflicts:
#	vehicle/Train.cpp
2026-11-08 21:28:09 +01:00
jerrrrycho
db65dfa5f0 test: file-local helpers instead of lambdas in the brake handle tests (Sonar S2259)
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.
2026-11-08 21:15:12 +01:00
maj00r
9fecba82f0 Merge pull request #291 from MaSzyna-EU07/fix/sod-lamp-whole-consist
SOD lamp: doors of the whole consist, three states (eu07/maszyna#288)
2026-11-08 20:56:20 +01:00
maj00r
17676863bc Merge pull request #266 from MaSzyna-EU07/feat/exe-test-mode
Test mode: `--test` runs a scenery unattended and exits with the result (#541)
2026-11-08 20:41:57 +01:00
jerrrrycho
8fb596f218 fix(simulation): any exception ends a test run with error, other runs as on master
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.
2026-11-08 19:46:16 +01:00
jerrrrycho
bbd7d9c5bf fix: a stopped diesel engine no longer stops the others every frame (eu07/maszyna#80)
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.
2026-11-08 19:38:16 +01:00
jerrrrycho
7ba478aea9 test: reach the mover by reference in the brake handle lambdas (Sonar S2259)
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.
2026-11-08 19:30:46 +01:00
jerrrrycho
57db0087ff fix: the SOD lamp of the whole consist is opt-in per vehicle (DoorClosureSignal)
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.
2026-11-08 18:30:22 +01:00
jerrrrycho
d755c7708f fix: the SM42's CA off in the shunt mode only with AwareOffInShuntMode, an alarm on kept
Review of #275. The shunt mode suspends the vigilance device (CA) only on the
vehicles whose .fiz sets the new Security key AwareOffInShuntMode=Yes (default
No), instead of on every diesel-electric with ShuntMode=1 (SP42, SU42 and the
401Z generator car had it too). Suspended, the CA counts no time towards a new
alarm, but an alarm already on stays, goes on to the emergency braking and
needs the usual acknowledgement, instead of going out with the shunt mode.
2026-11-08 18:19:59 +01:00
jerrrrycho
97c483e827 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.
2026-11-08 18:05:00 +01:00
jerrrrycho
dc4cc45769 fix: the diesel throttle marker follows the controller only with a scaletable:
A mainctrlact: without a scaletable: (the shipped ST43 cabs) keeps its marker still, as before, instead of sweeping on an unchecked linear scale. A gauge redefined in the fixed form drops the scaletable: of its earlier definition.
2026-11-08 17:45:01 +01:00
jerrrrycho
91e0d90e8d fix: review of the separate engine start switches (eu07/maszyna#80)
- 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
2026-11-08 17:38:59 +01:00
jerrrrycho
200d3ae73b fix: review of the EN57 EP brake (Sonar null check, EP fuse of the cab car, AI re-asserts the EP brake)
- 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
2026-11-08 17:37:56 +01:00
jerrrrycho
22c588d8f9 feat(cab): 401Da oil pump lamp and slotted speedometer lever (eu07/maszyna#546) (#261)
* 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.
2026-11-08 14:48:42 +01:00
jerrrrycho
5f46aca43a fix: a latching line breaker lever goes off with the breaker knocked out (#277)
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)
2026-11-08 14:48:04 +01:00
jerrrrycho
b5953ef61e feat: lock the field shunting in both directions on resistive positions
With ScndCtrlResistiveLock=Yes the shunt controller can't be moved down
either while the master controller is at zero or on a resistive position
(eu07/maszyna#402: "inc/dec").

So that a shunt step can't be left stuck there, the shunt controller drops
to 0 whenever the master controller is at zero or on a resistive position:
right after IncMainCtrl()/DecMainCtrl() move it there (before the
positions go down the consist) and in every update, for the master
controller set directly (AI clamp, consist). Electrically nothing changes,
the relays already drop the shunting on resistive positions. Reducing
power is never blocked: the EP09/ET21 master controller turns back with
the shunt on, the ET22 keeps its interlock (shunt off first), and on the
ET22 a shunt left on at a resistive position would otherwise lock both
controllers.

Tests: the shunt goes down on resistance-free positions only; the master
controller taken back or up onto a resistive position from a shunt step,
by hand and directly, on the ET22 and EP09.
2026-11-08 13:00:24 +01:00
jerrrrycho
a6c7d53983 fix: SmokeDelay defaults to 0, the delay comes only from the vehicle's .fiz (eu07/maszyna#523)
Without SmokeDelay in its Engine section a diesel smokes as soon as the
starter turns, as before; the delay is set per locomotive in its own .fiz.
The value stays a member of the vehicle's mover, read from its .fiz with
an explicit default of 0.

Tests: the real SM42 and ST44 with SmokeDelay=2 and 5 in the .fiz, and
without it (smoke at once), next to a locomotive with a delay loaded
just before, which keeps its own value.
2026-11-08 12:33:53 +01:00
jerrrrycho
cea92f0170 test(unit): the test mode tests compare seconds with a tolerance
Floating point values of the command line, the real time limit and the
standstill clock are checked with doctest::Approx rather than ==.
2026-11-08 11:57:03 +01:00
jerrrrycho
e5aafd154f feat(simulation): the pass and the standstill wait for the train under test only
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.
2026-11-08 11:39:52 +01:00
jerrrrycho
03a417c7b0 feat(simulation): a real time watchdog ends a test run that hangs
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.
2026-11-08 11:33:36 +01:00
jerrrrycho
14d25520f3 fix(simulation): a test's standard output carries its result only
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.
2026-11-08 11:23:02 +01:00
jerrrrycho
1626df2bc4 fix(simulation): a scenery's config block can't turn back on what a test keeps off
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.
2026-11-08 11:22:37 +01:00
jerrrrycho
7f8892cda6 fix(simulation): a test doesn't read the player's own eu07.ini
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.
2026-11-08 11:21:57 +01:00
jerrrrycho
baf6bc2a20 feat(simulation): the test mode's exit codes keep clear of 1 and 3
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.
2026-11-08 11:21:30 +01:00
jerrrrycho
486a714f52 refactor(simulation): the rules of the test mode in a file of their own, with unit tests
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.
2026-11-08 11:20:52 +01:00
jerrrrycho
62526e9d6a test(scenarios): the timetable cases check where the train stops, not how long
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.
2026-11-08 11:16:40 +01:00