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.
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.
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 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 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.
Coming down where there's no terrain and finding itself under the ground of the next chunk, the ray gives up and the depth
read back says where the ground is. In the top view it starts 10 km behind the plane of the camera, as far as the view sees,
so the ground higher than the camera is met too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDcMn1Q7wdYkbxDUWscNHZ
The terrain tools (the outlines of Fill, water and chunks, the target height, the brushes) and the area fill took their point
from the depth read back under the cursor. That depth is a frame late, so the point was off while the camera or the cursor
moved, and it stops at whatever is drawn over the ground (models, the 3D grass), at a grazing angle metres away from where
the ground is. Now the ray through the cursor as it is in this frame is followed to the terrain (terrain_streamer::raycast);
the depth read back is used only where the ray meets no terrain. The brush circle is drawn where the stroke will land.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDcMn1Q7wdYkbxDUWscNHZ
View > Cursor drawn into the picture (streams): the system pointer is hidden and ImGui draws its own into the frame, so it shows
in a capture of the window (Discord, OBS, the capture of the system), which leaves the system pointer out. Off by default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DDcMn1Q7wdYkbxDUWscNHZ
Review of #272. The closed line breaker used to mean there's traction
voltage, the undervoltage trip opening it without one. With
PantRequiresMain=Yes it closes on the battery and holds without voltage,
so everything that took Mains for "the main circuit is live" ran with the
pantographs down, lowered for a section, or under a dead catenary.
- MainCircuitPowered(): the line breaker closed, and on a vehicle with
PantRequiresMain and current collectors also the voltage at least MinV
(what the undervoltage trip takes). For every other vehicle it is Mains.
It feeds the converter (and through it the 110 V and a compressor on
it), a compressor on the main circuit, the heating from the main
circuit, the motor blowers, the blowers of the starting resistors, the
current of the series motors and the induction motor drive.
- The undervoltage relay of such a vehicle opens the line contactors, as
the line breaker opening did elsewhere: the camshaft goes back to zero
and the motors get no current, also not the generator current a closed
circuit without voltage gave. The relay picks up again with the voltage
back and the master controller at zero or the first position, so the
start begins anew instead of the camshaft running back up to the
position left on the controller.
Vehicles without the key are unchanged: the golden traces recorded before
the change compare exactly.