read_spec() took every token up to the end of the file into the block when the closing brace was
missing, so endmodels, sounds:, the lights and the rest were lost. The block now ends at the first
token that is neither a key nor the value right after one (or at endmodels), and that token is
put back for the caller.
With EDBrakeV0 = EDBrakeV1 = 0 the whole force acted down to the stop and turned round each time
the speed crossed zero; in FTrain it never let the stop of ComputeMovement() catch it, so the
speed swung round zero. Near the stop the force is now no more than what stops the vehicle within
the step.
pick() kept m_lastposition of the vehicle before, so the next motion_of() took the step between
the two vehicles for a move: the direction could point back along the train, the ends swapped and
the railfan went to a spot 80+ m behind the tail. Now a change of the vehicle sets m_moved to
false, and the way is set again from the way the user drives.
read_timetable() went on from the StationCount it was given and checked only the upper bound, so
TimeTable[StationCount] and TimeTable[StationCount - 1] could index out of the table (Sonar cpp:S3519).
It now resets the count and the table first, and checks both bounds before the next station.
[Shift]+[F4] goes on after the four views it had (front of the train, its rear,
a bogie, drive-by) to four views that go with one vehicle of the train:
- orbit: around the middle of the vehicle. Left/right arrows (and the mouse)
turn the camera around it, up/down arrows bring it closer and further
(from outside the body to 250 m), PgUp/PgDn (and the mouse) raise and
lower it; it never goes below 0.5 m above the rails. It turns with the
vehicle.
- shunting: straight down from above the vehicle, the way the user drives up
the screen, going with it. Arrows move it along and across the train,
PgUp/PgDn up and down (from above the roof to 300 m).
- coupling: low beside a coupler, looking at it. At an end of the train with
another vehicle (not coupled) closer than 150 m, it starts at that end and
steps back from the track as the gap grows, looking between the two
couplers. Left/right arrows pick the side of the track, up/down the
distance, PgUp/PgDn the height.
- trackside: a railfan beside the line ahead of the train, looking at the
vehicle picked as the train comes and goes by. Once its tail is 40 m past
(or the train is 1 km away) the railfan walks to a new spot ahead, 15 s of
the train's run away (80-500 m, along the curve of the line), on the other
side of the track.
[ and ] pick the vehicle the view goes with (the coupling, in the coupling
view), towards the front and the rear of the train; the view starts with the
vehicle the user drives. [ and ] are bound to nothing by default nor in the
shipped eu07_input-keyboard.ini; [Ctrl]+[ / ] stay the debug train moves.
The camera follows from pure functions in vehicle/cameraviews.cpp (eu07_core),
tested in tests/unit/test_camera_views.cpp; application/consistviews.cpp hands
them the vehicles of the train and keeps what the user set. The four older
views and their order don't change. "consistviews no" in eu07.ini keeps the
cycle of [Shift]+[F4] to the four older views. The black box writes the new
views as 4-7 (blackbox_doc.md).
A universal control (window, door, sun blind) whose definition in the .mmd
has the new optional key drag: can be dragged with the left mouse button to
any position between its ends, and stays where it is let go:
universal1: { okno_p mov -0.71 0 0.3 drag: left soundinc: ... }
The value is the direction the mouse moves to open the control: up, down,
left or right (yes = up, no = off). The drag works like the sliders of the
controllers: the cursor is hidden, its move over 0.6 of the window height
takes the control from one end to the other. A click without dragging
toggles the control as before, and so do the keys: to the end farther from
where it is. Push controls aren't dragged. Without the key every universal
works as it did; none of the cab definitions has it yet.
New commands genericset0..29 set universal N to the position in param1
(0-1); the mouse sends them, and they can be bound to a gamepad axis.
The rules (the key's values, the move of the cursor along the direction,
the ends, click or drag, the keys) are in vehicle/universaldrag.h, with
unit tests.
A timetable can now tell the AI how the train is served, for trams,
underground trains and the like. The whole train gets them from a new
row of the first box of the header:
[ Flagi AI | drzwi_centralne=tak,stopien=nie,kierownik=nie,proba_hamulca=nie ]
and a station changes them from there on with entries of its station
ware (the second line of the station, next to R2, ph, @):
[ | | po,kierownik=nie 1 12.54 | ]
- drzwi_centralne=tak: the driver opens all the doors from the cab,
those of mixed control too (otherwise left to the passengers)
- stopien=tak/nie: the doorsteps switched on/off before the doors open
(the AI didn't touch them before; new driver hints for it)
- kierownik=nie: no conductor, so no departure signal (direct or by
radio) and no first door kept open for him before the departure
- proba_hamulca=nie: no running brake test
A flag left out keeps today's behaviour, so a timetable without flags
drives as before. Old builds skip the header row and keep the station
entries as station ware text (none starts with R or holds @, po, pt).
The reader moves out of TTrainParameters::LoadTTfile into
world/timetablereader.cpp (eu07_core) unchanged, so the tests can run it;
the flags come out of the station ware there. It now ends at the end of
the file with an error where the old one spun forever (a truncated file,
a missing number), and stops at 100 stations instead of writing past
the table.
Every .txt of the game's sceneries and of the SVN data reads the same
as with the old reader (compared field by field against a verbatim copy
of it); EU07_UNIT_TESTS_TIMETABLES=<scenery folder> reads them in the
unit tests and EU07_UNIT_TESTS_TIMETABLES_DUMP writes what was read.
A vehicle can now have door wings of different kinds on one side, e.g.
111Ainw (Bdhinu) with folding doors at one end and wider ones at the other.
A new optional entry in the models section of the .mmd:
animdoor: <wing number> { type: <Shift|Rotate|Fold|Plug> range: <m or deg> rangeout: <m> }
gives one wing (door1, door2... of animdoorprefix) its own kind of
animation and range; the keys left out keep the values of the .fiz. The
wing still follows the door of its side: it is as far along its own range
as the door is along DoorMaxShift. The entry may come before or after
animdoorprefix; a faulty one is logged and the wing keeps the .fiz kind.
Wings without an entry get the same update functions as before, so the
existing vehicles, .mmd and .fiz files are unchanged. The door state, the
physics, AI, cab controls, sounds and exports are not touched.
The parsing and the wing position live in vehicle/doorwings.h, tested in
test_door_wings.cpp.
The drive of a diesel-electric vehicle is computed from the power of its
generator, not from a circuit, so neither the EP09's resistor brake
(Current()) nor the inverter model of the induction motors has anything to
work on, and a negative setting of the integrated controller did nothing:
the BR285's TRAXX controller has its braking range (EB+, EB, EB-) and brakes
nothing.
A vehicle opts in with keys of its Engine section, read only for the
diesel-electric ones; without EDBrake nothing changes:
- EDBrake=Controller: the negative range of the integrated controller
(EIMCtrlType > 0) sets the effort, which goes to the vehicles in multiple
with the EIMIC command; EDBrake=Lever: a lever of its own, the one of
SplitEDPneumaticBrake (DBPN steps, the dynamicbrakecontroller commands),
working with the master controller at zero.
- EDBrakeFmax [kN], EDBrakePmax [kW]: the force at the wheels, limited by
the power of the resistors at speed; EDBrakeV0, EDBrakeV1 [km/h]: no force
below V0, the whole above V1. An inverter's brake fades only at the stop,
a resistor brake of direct current motors grows with the speed from 0.
- EDBrakeRate [1/s]: how fast the effort follows (0.5).
- EDBrakeBlending=Yes: the locomotive's train brake lets off by the share of
the force (Hamulec->SetED, LSt and EStED valves).
The brake works while the engine runs, with the direction set, the
overload relay closed, the wheels rolling and no power asked for. Its force
takes the place of the drive's in TractionForce(), the ammeter shows the
motors' current, DynamicBrakeFlag lights the dynamic brake lamp.
The traces of all 615 test cases recorded before the change compare bit for
bit after it (EU07_UNIT_TESTS_GOLDEN_EXACT=1).
The secondary controller (ScndCtrl) is the switch of the cruise control
(SpeedCtrl) on the vehicles which have one: its first position switches
it on (IncScndCtrl), zero off (DecScndCtrl), and the speed buttons and
steps work only off its zero position. On the 6Dg, the ST45 and the
BR285, diesel-electrics with SpeedCtrl=Yes, the same controller shunts
the field of the traction motors by itself (AutoRelay), refuses the
driver's moves, and nothing could switch the cruise control on.
Now the cruise control has a switch of its own wherever the secondary
controller shunts the field (ElectricSeriesMotor, DieselElectric) or
there's none:
- IsSpeedCtrlSeparate(): which vehicles; IsSpeedCtrlEngaged(): on or
off, SpeedCtrlUnit.IsActive for those, ScndCtrlPos > 0 for the rest;
- SpeedCtrlSwitch(): the driver's switch, on at the speed of the moment
or off; on the others IncScndCtrl(1) / DecScndCtrl(2), as before;
- the buttons, the steps and the power limit go by IsSpeedCtrlEngaged(),
the automatic turning off (SpeedCtrlATOF) by SpeedCtrlSwitch(false);
- the cab's tempomat_sw / tempomatoff_sw toggle it, and follow its state
rather than the secondary controller's; the AI's SpeedCntrl() uses it.
The .fiz and .mmd formats are unchanged, with no new keys: the
SpeedControl section and the cab's scndctrl and tempomat_sw entries
stay as they are and now work side by side. Nothing changes for the
vehicles with only one of the two: the whole unit test suite matches
golden traces recorded before the change bit for bit.
Tests (test_speed_control.cpp): the field shunting of the EU07, SM42 and
SU45 and the cruise control of the Impuls and EU47 as before, the 6Dg's
and ST45's shunting as before, the 6Dg's and ST45's cruise control on
its own switch holding and changing the speed with the shunting going
on by itself, the 214M railbus switched by the secondary controller
through SpeedCtrlSwitch(). The 6Dg's definition joins
tests/unit/data/fiz as on test/6dg-power-steps-real-data.
The main reservoir hoses (ctrain_scndpneumatic) exchanged the air explicitly inside each vehicle's step at the
physics step of 0.01 s, as the brake hoses did before eu07/maszyna#387. One step through the hose (0.38 of
area, whatever the vehicles) moves about 1.5 times the air which evens out the pipes on its ends (EN57 cars
8.3 l per bar against 5.5 l, SM40 8.6 against 5.7, passenger cars 9.3 against 6.3), and the vehicles with a
main reservoir of their own feed the pipe from it in the same step. Where a vehicle has both, and hoses on both
ends, the pipe can't settle: with all the main reservoirs held at 7.0 bar, the middle cars of a three unit EN57
kept jumping 0.8 bar to and fro between the steps for good (6.6/7.4), three SM40s in multiple traction the
same, a two unit Impuls 1.7 bar. Freely evening out, the reservoirs of a three unit EN57 took 13.9 s at 0.01 s
against 7.6 s at 0.001 s. A locomotive with passenger cars, whose pipe only it feeds, was stable already.
The main reservoir pipe now goes through the brake pipe's mechanism: UpdateScndPipePressure() leaves the hose
exchange to UpdatePipeCouplers() (GetScndDVc(), ScndPipeCouplersSubsteps(), 2 sub-steps for these vehicles),
which vehicle_table::update_brake_pipes() calls after every vehicle stepped. The two pipes share the code and
take their sub-steps apart, so the brake pipe's exchange is as it was. With it the EN57 pipes stand at 7.000,
and its reservoirs even out in 7.0 s against 7.5 s at 0.001 s.
The air the brake hoses carry between the vehicles was taken explicitly inside each vehicle's step, at the
physics step of 0.01 s. Through the hose between two 14 m freight wagons (Spg 0.792, 11.5 l of pipe) one
step moved 11.8 l per bar, 2.06 times the 5.7 l that evens out the two pipes: the pipes overshot each other
in turns and settled into a pattern in which every distributor saw the pipe up to 0.28 bar off the pressure
left in it after the step. ESt3 valves charged at 5.0 bar saw 4.79 and lapped at the first stage, and the AI
of a standing freight train never got its brakes released (the report of eu07/maszyna#368).
The exchange now comes after every vehicle has stepped (vehicle_table::update_brake_pipes(), once per
physics iteration), for the vehicles which stepped their pipe, in as many sub-steps as keep the air a hose
carries in one below what evens out the pipes on its ends (3 for 14 m freight wagons, 2 for passenger
cars), each going through the vehicles in the order they step. The distributors see the pressure the pipe
holds, and an application reaches the end of the train as with a step of 0.001 s.
The date of the scenery wizard's .scn header and the stamp of the
editor's terrain backups use local_tm() (localtime_s/localtime_r)
instead of std::localtime. The goto out of the loop over the four
tracks of a cross switch, into the continue of the failed "ac"
assignment, becomes a std::all_of check which continues the outer
node loop, as the goto did.
The driving aid panel works out its throttle and brakes numbers in a new
pure helper, vehicle/drivingaid.{h,cpp} (in CORE_SOURCES, unit tested).
- EIM vehicles: the brakes line gets " ED brake: N%" while the ED braking
demand (-eimic_real) is at least 1%, except where the integrated universal
controller already shows it as the brake number (eu07/maszyna#558).
- SplitEDPneumaticBrake (Vectron): the ED lever off zero shows in the
throttle line as the negative step the cab's joint controller shows.
- The local brake setting ("+N") shows only when the cab has a localbrake:
lever or a jointctrl: whose braking range is the local brake, or when the
local brake is applied. The Elf cabs have neither (eu07/maszyna#555).
Vehicles without an EIM controller and with a local brake control show what
they did. The existing msgids stay; two new ones show in English until the
game data's lang/*.po (SVN) have them: "Brakes: %5.1f%c%s" (pl "Hamulce:
%5.1f%c%s") and " ED brake: %d%%%%" (pl " Hamowanie ED: %d%%%%").
Adds the Vectron (vectron_v1/wariant_7w) to the real definitions of the
unit tests.
The Linux job never installed libcurl's headers, so find_package(CURL QUIET)
missed it and the game was built without EU07_WITH_CURL: the editor showed
"no http client in this build" instead of the orthophoto, the terrain model
and the topo map. bundle_runtime_libs.cmake copies libcurl and its
dependencies next to the game with the other bundled libraries.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(editor): the orthophoto shown one of three ways, chosen in one place, and laid on the terrain without flicker
The settings of the orthophoto had two checkboxes ("Fit to terrain", "Covered by
objects and terrain") and three heights greyed out by turns, and the user couldn't
tell what they did. They're one choice now, each way told under it:
- over the view: drawn over everything, see-through, to compare with the map
- on the terrain, in the scene: tracks and models cover it, lit, the mouse
places objects on it
- a flat sheet in the scene: for a scenery with no terrain yet
The lift is shown only where it matters (on the terrain, in the scene), the
height is named for what it is in each way ("where there's no ground"), and the
ways in the scene are greyed out with the Better Renderer, which doesn't show
them.
On the terrain in the scene the photos are a copy of the ground's triangles 5 cm
up, which the depth buffer lost further away: they flickered with the terrain
textures. Their shapes are decals now, drawn with a polygon offset towards the
camera (the depth is reversed, so a positive one) in every pass but the shadows.
The translations hold the strings of the terrain of the download area as well.
* fix(editor): the terrain made from the NMT under one rule, also around the camera within the download area
The download area didn't bring the terrain: the NMT squares in it were fetched
only once the model had been placed (its panel opened) and the scenery had
terrain open, and nothing told why. They're fetched from the area as it is now,
in PUWG 1992 already.
Where a chunk is made from the model where there's no terrain, the rule is one
for the track laid, the area and the buttons of the panel (nmt_chunk_offset):
beside terrain made from the model it goes on at its height over the model,
otherwise (terrain made by hand, or none) at the offset of the scenery; no chunk
is left out for what lies beside it. Before, the terrain under the track laid
needed terrain in the scenery and a chunk of it beside, gave up chunks for the
session otherwise, and the model was placed only by its panel.
The terrain of the area: "The terrain of the scenery around the camera" (on by
default, kept with the editor) makes the chunks missing in the area in a square
of 9 x 9 around the camera, the nearest first, as the camera goes. Light: a chunk
at most every 0.1 s and three times as long as it took left to the editor, after
the work with the model the user asked for; the step of the terrain history the
editor keeps open is closed around each chunk, as for the terrain grown while
laying. Not the whole area at once: the chunks made wait in memory to be saved.
The log tells what holds it.
The download of the area gives way to the squares asked for: a square of the
area being downloaded is broken off as one is asked for (the terrain under the
track laid) and taken up again later.
The map no longer covers the area with green over the tiles in the cache, only
the failed ones are red.
* fix(editor): the terrain under the tracks follows them again, a brush stroke keeps its undo, the area terrain timed
From the review of the terrain made from the NMT under one rule:
- The terrain drawn to the tracks place by place (under the tracks) took the
height of the chunk beside it, carrying one offset along a run of chunks,
metres off the tracks: nmt_chunk_offset gives the offsets of the tracks there
again. The height the track laid goes on at (state.ahead) comes from the
terrain grown under it only, not from the chunks of the buttons.
- A chunk of the area made during a stroke of the terrain brush closed the
stroke's step of the history, and its undo lost the part brushed before: the
area terrain waits for the stroke to end.
- In a scenery with no name yet the terrain under the track laid was asked for
and dropped every half a second, the log filled: nothing is asked for there.
The log tells how long the chunks of the square around the camera took, and the
self-test sets the area terrain on or off for its run (nmtsettings area 0|1).
Measured on lukow.scn: 1.3-1.5 ms a chunk, 2.2 ms the longest; the longest frame
17 ms against 10 ms without it, none over 33 ms.
* fix(editor): the selftest turns the area terrain on or off for its run only, the setting kept
---------
Co-authored-by: maj00r <maj00r@host>
Six slow cases, each a mission of a scenery of the game with every train driven by AI:
- wrzosy_pxe336080_couples (#524): the locomotive, given the orders the player's hands stand
for, couples to the rake in the Wolica depot and takes it out. Passes.
- baltyk_skm1_roj55324_shunting_signal, baltyk_skm1_roj55321_departure (#525): the unit on the
siding gets its shunting signal once the shunter beside it has moved, the one in the platform
leaves on time. Pass, with 4 and 3 seeds.
- l053_poranek_tme222158_debica (#421): xfail, the train is never let into Debica: the AI of
another locomotive passes the shunting signal Tm4 at stop and the station waits for it for good.
- l053_poranek_tme222158_debica_et21 (#421, with the ET21 of the report): xfail, the ET21 stops
past the end of the overhead wire at Debica Towarowa and its driver never restarts it.
- l053_poludnie_roj32134_debica (#506): both trains of the mission run and end at Debica. Passes.
A case can now run one of the base scenery's own missions among its traffic:
- vehicle: the train under test is a vehicle of the base scenery (with strip_trainsets false),
the fragment becomes optional,
- replace: literal replacements in the base scenery, e.g. another locomotive on a mission,
- physicslog false: no physicslogs and no black box, for a scenery with dozens of AI trains;
the case then has the result of the test mode and the log checks only,
- on such a case the runner doesn't wait for physicslog rows nor give up on a bad vehicle of the
scenery, and removes the physicslogs the other trains wrote; with file.binary.terrain no in
ini it leaves no geometry cache behind,
- slow: skipped by the default sweep, run by name or with --slow,
- xfail: a known, reported failure is XFAIL and keeps the run green, a pass is XPASS and fails it,
- --seed: the seed of the simulator's random numbers for a run, for bugs that show up sometimes.
The couples check takes vehicle names in any case (the simulator reads them in lower case), and
the physicslog is no longer read four times a second once it has rows.
Conflict in McZapkie/Mover.cpp, MotorBlowersCheck(): the blower's power source stays in
MotorBlowerPowerIsAvailable(), which for a blower on the main circuit now asks
MainCircuitPowered() instead of Mains (PantRequiresMain, #272), so the line contactors
interlock sees it too. MotorConnectorsCheck() merged by itself: master's undervoltage
relay in connectorsoff, and LineContactorsInterlockReleased() on the return.
The lines run of the files besides the physics, from the Coverage run of #325, what of the parser, the helpers and the PLC stays untested and what nothing in the game calls, and the behaviour the new tests recorded which may deserve a look.
Programs of ladder logic made up for the tests: loading, the operations, timers and counters of scripting/ladderlogic.cpp. The game doesn't load a program into the controller yet.
The texts, numbers, random numbers, file names and times of utilities.cpp and utilities.h as they behave now. The table of Bezogonkow() is checked as the build has it: one byte for its plus-minus sign with MSVC, two with GCC and Clang, which give other letters.
The tokens, comments, quotes, parameters and include directives of cParser, its numbers and its place in the text, as they behave now, with the files of the tests made in a folder of the build (scratch.h). The helpers of utilities.h which read from a parser are here too.