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.
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.
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.
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.
- 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
* 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)
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.
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.
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.
In vehicles like the ST43, the SP32 or the SN61 every engine of a train in
multiple has its own start and stop buttons in the cab. Until now the cab's
line breaker / engine start switch (main_sw, main_on_bt, main_off_bt) always
started and stopped the engines of all the vehicles under its control.
- .fiz, Engine: JointEngineStart=Yes|No (default Yes, as before). With No
the cab's main_* work the cab's own vehicle only, and an engine stopping on
its own (stalled, out of fuel) stops only its own vehicle instead of every
engine in the train.
- .mmd: mainb_sw, mainb_on_bt, mainb_off_bt work the second vehicle with an
engine under the cab's control, mainc_sw, mainc_on_bt, mainc_off_bt the
third one. They count along the control cable from the cab's vehicle,
behind the cab first. Like main_*, the start switch has to be held for the
vehicle's IniCDelay with the vehicle ready (MainSwitchCheck); an impulse
switch of an electric locomotive with series motors closes on release.
- New commands, added at the end of the command list: linebreakertoggleb,
linebreakeropenb, linebreakercloseb, linebreakertogglec, linebreakeropenc,
linebreakerclosec. No default keys.
- The logic is in vehicle/enginestart.{h,cpp} (core library), tested in
tests/unit/test_engine_start.cpp.
Nothing changes for existing vehicles: the new key and the new cab controls
are optional, and without them the code does what it did before.
Game data (SVN, not changed here, to be done separately; the code works
without it): for the SN61 (dynamic/pkp/sn61_v2), whose cab models already
have the buttons start02/stop02/start03/stop03,
- sn61.fiz, sn61-86.fiz, sn61_v1.fiz and the other SN61 .fiz: add
JointEngineStart=No to the Engine: line;
- sn61.mmd.inc (and the other SN61 includes): after main_on_bt add
mainb_off_bt: { stop02 mov -0.005 0 0.1 ... }
mainb_on_bt: { start02 mov -0.005 0 0.1 ... }
mainc_off_bt: { stop03 mov -0.005 0 0.1 ... }
mainc_on_bt: { start03 mov -0.005 0 0.1 ... }
with the sounds of main_off_bt / main_on_bt.
The tooltips "line breaker B" / "line breaker C" are new strings for lang/*.po.
The door wings are in the main model, where the door animation finds them, so seen from inside the
vehicle they are lit like the exterior and ignore the compartment lights. A door panel put into the low
poly interior instead stayed closed, since nothing moved it.
A door wing animation now also picks up the submodel of the same name in the low poly interior, if it
has one, and gives it the same pose (shift, rotate, fold with its child wings, plug). Placed under a
compartment section, such a wing is lit with the section and follows its light switch.
The pose maths moved unchanged to vehicle/doorwings.h, with unit tests.
Assets: optional. No low poly interior in the SVN or in the Steam install has a submodel named like a
door wing, so nothing changes for existing vehicles. To use it, a low poly interior gets the inside of
each door wing as a submodel named like the wing in the main model (door1, door01, drzwi1, ...), with
the same pivot and transform, under the compartment section it belongs to, with a SelfIllum threshold
like the section's, and slightly inside the wing of the main model.
eu07/maszyna#87: the EP2 (and EP1) valve charged its auxiliary reservoir only
from the main reservoir pipe. A dead EN57 hauled by a locomotive coupled with
the hook and the brake hose alone ("3") never charged it, its control
reservoir stopped at about 2.5 bar and the unit didn't brake. The valve now
refills the auxiliary reservoir from the brake pipe through the slide valve's
check valve, as every ESt does (TESt::FillBrakeRes, shared with TESt::GetPF,
which stays bit for bit the same). With the main reservoir pipe charged the
auxiliary reservoir stays above the brake pipe and nothing changes; the
reservoir now also takes air from the brake pipe while it is below it, e.g.
at start-up before the compressor has charged the main reservoir pipe.
eu07/maszyna#134: the EP brake of the Knorr St113 handle (EN57-001) worked
with the reverser in neutral, the battery off or the EP fuse switched off
(Ctrl+Z). It now needs the control powered, as the Oerlikon handle's does
(EPBrakeControlPowered: battery, reverser out of neutral, EP fuse), and an
EP brake switched on drops out (holding the cylinder pressure) when the
control loses power. The positions of the EP release and brake were already
moved by 810b7ad07; a test pins them.
No change to game data needed.
The door closure signalling lamp (i-door_blocked) showed only Doors.is_locked
of the occupied vehicle, so a door open in another car or a coupled unit
didn't show on it.
TMoverParameters::door_closure() gives the state of one vehicle (none, locked,
released, open), the driver gathers the most severe one of the train in
determine_consist_state(), next to IsAnyDoorOpen, and the lamp is lit for
locked doors, blinks for closed but released ones (a permit given, or no lock
engaged on doors that need no permit) and is dark with a door open.
doorclosuresignal in eu07.ini (default yes) switches it; with no the lamp
shows is_locked of the occupied vehicle as before. No data change needed.
modernDimmerPosition indexed dimPositions without a range check in
RaLightsSet(), SetLightDimmings() and the off_from_dimmer value of the
cab's Python state. An empty DimmerList, or a DefaultPos past the end of
a short one, read past the end of the vector; the dimmer commands could
also leave or put the position outside the list.
Reads go through currentDimPosition(), a plain entry (not off, not
dimmed) outside the list. DefaultPos and the position are clamped after
the .fiz is loaded, the increase/decrease commands step through
stepDimmerPosition(), which clamps and does nothing for an empty list,
and headlightsdimenable clamps its position 1.
A control defined again in the same cab section of the .mmd with the
block key "duplicate: yes" no longer replaces the control: the first
definition stays the control (sounds, type, command feedback), and the
duplicate adds a copy with its own submodel, animation type and scale /
offset, following the control's value and active state. The duplicate's
sound keys are ignored so the control is not heard twice, and clicking
any copy works the control. This lets e.g. the ASF cab move its second
master controller and reverser with the first ones.
Without the key a repeated definition still replaces the earlier one,
as some of the game's .mmd files repeat controls with other submodels.
A duplicate with no definition of the control loaded from the current
cab's models before it is just the control.
clear_cab_controls() now also clears ggCompressorListButton, which kept
the previous cab's submodel.
The rule is in vehicle/gaugeduplicates.h, covered by
tests/unit/test_gauge_duplicates.cpp.
(eu07/maszyna#527)
An optional third column in the LightsList rows of the .fiz sets the cab
interior light when the driver moves the light preset selector to that
position: 0 off, 1 on, 3 on dimmed (bit 2 the dimmer). Rows without the
column, or with a negative value, leave the cab light to its own switch,
so the existing tables work as before; a stray note after the two light
columns (e.g. "38 38 / A") is not read as the flag.
The light follows the occupied cab, or all cabs of a JointCabs vehicle,
as with the interior light commands; the dimmer switch is moved along.
The lightsset custom position and the AI leave the cab light alone.
Covered by tests/unit/test_lights_preset_cablight.cpp.
(eu07/maszyna#529)