18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-02 23:35:28 +01:00
Commit Graph

3734 Commits

Author SHA1 Message Date
jerrrrycho 4e0c2f71bb feat(ui): names and texts of the data shown with their letters
MaSzyna-EU07/maszyna#94. What the panels took the marks off, they show as written, in utf-8:

- timetable panel: the relation, the train, the station rows (the column cut and filled by characters, a
  letter being more than one byte now)
- transcripts of the sounds and the assignment of a trainset, which lost their polish letters when read
- debug panel (event of the current signal, scan table) and the editor panels (names of nodes, layers,
  events, tracks and include files), which went through Bezogonkow()

Bezogonkow() and win1250_to_ascii() are left where the ascii form is what is wanted: file names, the python
dictionary, the multiplayer packets, the search key of the editor's station list.
build-feat-polish-characters-in-names
2026-11-18 23:50:07 +01:00
jerrrrycho 022e59fde3 feat(timetable): station names keep their polish letters, a W4 finds its station by one key
MaSzyna-EU07/maszyna#94. The timetable reader and the W4 event (putvalues PassengerStopPoint:<station>) threw
the polish letters of a name away as they read it. Now:

- the reader keeps the name as the file spells it in TMTableEntry::StationLabel and
  timetable_data::RelationLabel1/2 (TTrainParameters::RelationLabel1/2), for showing; StationName and
  Relation1/2 hold the ascii form as before, byte for byte, so the announcement files, the destination
  boards, the memory cells written by WhoIs events, the python dictionary, the log and the black box get
  what they always got
- the W4 event keeps its text as the scenery spells it (a scenery saved by the editor no longer loses the
  letters of its W4 events); the black box map still gets the ascii form
- world/stationnames.h has the one place which tells whether a W4 is for a station:
  timetable::stop_point_is_for(), used by TController::TableUpdateStopPoint() and
  TTrainParameters::RewindTimeTable(). It compares keys (ascii form, lower case, spaces as underscores), so
  the timetable and the W4 may each spell the station with or without the letters
- TTrainParameters::relation_caption() / station_caption() and TController::NextStop() give the names for
  the player: with the letters, in utf-8

The folding stays in the matching because the game data needs it: in 36 scenario x station pairs of the
Steam install (6 of the SVN) the timetable and the W4 spell the station differently (BALTYK_GLOWNY in
capitals against Baltyk_Glowny, Rzepedz with one of its two marks, Lupkow without them), and no
announcement file has a letter outside of ascii in its name.

Every W4 which matched a station still does. New matches, none of them in the game data: a memory cell
text spelled with polish letters, a space where the timetable has an underscore, a name longer than the 32
characters (sizeof(std::string)) the old comparison took. A memory cell text with a # part is still
compared whole.

win1250_to_ascii() builds its map once: the comparison runs it for every stop point a driver scans.
2026-11-18 23:50:07 +01:00
jerrrrycho c0a0a4204e feat(utilities): a text of the data files as utf-8 for the user interface
data_text_to_utf8() turns a text read from a data file into utf-8: one which already is valid utf-8 stays,
any other is read as windows-1250, the whole code page (win1250_to_utf8() knows the polish letters only, and
utf8_to_win1250() counts on that, so the two stay as they are). A windows-1250 text which is valid utf-8 by
chance (two capital letters with marks in a row) is told by what it would decode to.

data_name_to_utf8() is the same for a name shown in one line: control characters and, when asked,
underscores become spaces, as Bezogonkow() has them, but the letters keep their marks.

utf8_length() and utf8_fit() count, cut and fill by characters, for the columns of a fixed width.

Nothing uses them yet (MaSzyna-EU07/maszyna#94).
2026-11-18 23:50:07 +01:00
jerrrrycho 9f77bd688b fix(utilities): Bezogonkow() takes the marks off the same letters in every build
The table of Bezogonkow() had the plus-minus sign of 0xB1 written as the character, in a source kept in
utf-8. GCC and Clang (and MSVC with /utf-8) made two bytes of it, so every entry from 0xB2 on was off by
one: the polish letters came out as "ALELDNSZZ,le,dnszl", and with them the file names of the destination
boards and the names of the stations the python screens get. The entry is the byte now.

Nothing changes for a build which made one byte of the sign (MSVC on a machine with a central or western
european code page). The test checks the one table in place of whichever the build had.
2026-11-18 23:50:06 +01:00
maj00r dd73386126 Merge pull request #358 from MaSzyna-EU07/fix/scenery-lua-sandbox
fix(scripting): sandbox the scenery Lua scripts like the Lua screens
2026-11-18 01:23:51 +01:00
maj00r 23494ed200 Merge pull request #339 from MaSzyna-EU07/fix/ai-connect-releases-hand-brake
AI: release the hand brake when the first order is Connect
2026-11-18 01:20:53 +01:00
maj00r edf7935a1a Merge pull request #377 from MaSzyna-EU07/feat/derailment-overspeed-criteria
feat(physics): derailment from overspeed by physical criteria (overturning, flange climbing)
2026-11-18 01:20:39 +01:00
maj00r 555bf7bafc Merge pull request #359 from MaSzyna-EU07/feat/drivingaid-ed-braking
feat(ui): driving aid shows the ED braking and leaves out a local brake the cab has no control of
2026-11-18 01:20:12 +01:00
maj00r f2b95c7841 Merge pull request #402 from MaSzyna-EU07/feat/camera-orbit-and-shunting-views
feat: orbit, shunting, coupling and trackside views of the train (GE#551)
2026-11-18 01:19:58 +01:00
maj00r 056d7dab1c Merge pull request #394 from MaSzyna-EU07/feat/diesel-electric-dynamic-brake
feat: dynamic brake of the diesel-electric vehicles, opt-in per .fiz (#82)
2026-11-18 01:19:45 +01:00
maj00r 68245f4fae Merge pull request #397 from MaSzyna-EU07/feat/doors-animation-per-door
feat: own kind of animation for a door wing in the .mmd (#70, point 1)
2026-11-18 01:19:30 +01:00
maj00r dd919cc179 Merge pull request #398 from MaSzyna-EU07/feat/timetable-ai-flags
feat: timetable flags for the AI driver: central doors, doorstep, conductor, brake test (#95)
2026-11-18 01:19:16 +01:00
maj00r 0fdb4c78c8 Merge pull request #387 from MaSzyna-EU07/fix/brake-pipe-coupler-substep
fix(brakes): exchange the brake pipe air between vehicles after all of them stepped, in sub-steps
2026-11-18 01:19:01 +01:00
jerrrrycho f90005e649 fix(physics): a legacy derailment makes no crash inside its own train
With physics.collisions new and the legacy derailment (the default
physics.derailment monitor), a vehicle derailed the old way manufactured
collisions with the vehicles coupled to it:

- Derail() cuts its speed by 35 % in one step; the coupled vehicles kept
  theirs and ran into it at a third of the speed of the train
  (moczniki_eu06_eu07, tomaszewo_raj49843). The vehicles coupled to it
  now get the same change of velocity.
- crush_hit() took it as an immovable wall and its motion ignored every
  force (decelerating at g, then stuck by resistances x1e20), so the
  train behind it stopped against it at once and crushed by the energy
  of the whole train (l053-sluzba-2-night: 0.3 m on both ends at 8 km/h).
  It is now a wall only to vehicles not coupled to it; it keeps the
  legacy deceleration of g as a friction of its weight, and the forces
  of its train act on it, so the train pushes it on and it holds the
  train back. Alone it stops as before.
- Vehicles of the pile-up found inside each other kept what their
  springs took in pressed past the stop as buffer energy, which let a
  later small closing velocity crush them; a pair parting at the start of
  the step and knocked back in during it was crushed with the springs
  added to its closing velocity (l053_calkowo-sluzba-tlk-1,
  linia61_osobowy3: crush at -7.1 km/h). The contact found inside each
  other takes in nothing until the buffers part, and a pair parting at
  the start of the step is left to the legacy collision.

The monitor test of a locomotive into a wagon at 60 km/h now counts one
hit: the second one was the locomotive resting on the legacy wall,
parting at the start of the step, at 0.3 km/h.
build-feat-derailment-overspeed-criteria
2026-11-17 17:36:15 +01:00
jerrrrycho 0bd805fb19 docs: scenario README, a Connect first order releases the hand brake now build-fix-ai-connect-releases-hand-brake 2026-11-17 13:01:32 +01:00
jerrrrycho e41e6de29b Merge remote-tracking branch 'origin/staging' into feat/drivingaid-ed-braking
# Conflicts:
#	tests/unit/data/fiz/README.md
build-feat-drivingaid-ed-braking
2026-11-17 10:50:47 +01:00
jerrrrycho 4994349039 Merge remote-tracking branch 'origin/staging' into fix/ai-connect-releases-hand-brake
# Conflicts:
#	tests/scenarios/README.md
2026-11-17 10:50:43 +01:00
jerrrrycho aa2200418a fix(doors): an animdoor entry without its } leaves the rest of the .mmd to be read
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.
build-feat-doors-animation-per-door
2026-11-17 10:06:41 +01:00
jerrrrycho 68c704e513 fix(config): a scenery switches a script runtime off as before, only switching it on is refused
keep() put python.enabled, luascreens.enabled, wasm.enabled and lua.fulllibraries back in either
direction, so a scenery with config python.enabled no endconfig, which the release honoured, was
overridden and got an error in the log. They are put back now only when the scenery turned them
on; switched off they stay so, silently.
build-fix-scenery-lua-sandbox
2026-11-17 10:00:49 +01:00
jerrrrycho edc961486f fix(physics): the diesel-electric dynamic brake lets the vehicle come to rest without a fade
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.
build-feat-diesel-electric-dynamic-brake
2026-11-17 09:52:07 +01:00
jerrrrycho 0645096e13 feat(physics): ship with physics.derailment monitor as the default
144 tracks in 12 of the bundled scenarios have a speed limit above the overturning speed of the
reference vehicles, so the criteria as the default would change how they play. Until those limits
are corrected in the pctga data, the default (and a name not known) is monitor: the legacy draw
decides, and the log tells where new would derail a vehicle. new stays opt-in.
2026-11-17 09:33:02 +01:00
jerrrrycho ebe0a42be7 fix(camera): the trackside view sets the train's way again when the vehicle picked changes
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.
build-feat-camera-orbit-and-shunting-views
2026-11-17 09:17:19 +01:00
jerrrrycho 66b8a67361 fix(timetable): read the table from its start, bound the station index both ways
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.
build-feat-timetable-ai-flags
2026-11-17 08:54:50 +01:00
maj00r bad94c96b5 Merge pull request #391 from MaSzyna-EU07/feat/split-cruise-control-and-shunting
feat: the cruise control apart from the field shunting (#69)
2026-11-17 03:13:43 +01:00
maj00r 2a22e4df1e Merge pull request #388 from MaSzyna-EU07/fix/feed-pipe-coupler-substep
fix(brakes): exchange the main reservoir pipe air between vehicles after all of them stepped, in sub-steps
build-fix-brake-pipe-coupler-substep
2026-11-17 03:13:17 +01:00
maj00r a7b28cc1b8 Merge pull request #401 from MaSzyna-EU07/feat/universal-smooth-drag
feat: drag universal cab controls to any position with the mouse, opt-in per .mmd entry (#62)
2026-11-17 03:10:08 +01:00
maj00r e1380e9b99 Merge pull request #365 from MaSzyna-EU07/refactor/sonar-localtime-goto
refactor: reentrant localtime and no goto in the cross switch lookup (Sonar S1912, S1909)
2026-11-17 03:06:03 +01:00
maj00r 2ba7bddfa3 Merge pull request #379 from MaSzyna-EU07/feat/collision-crush-override
feat(physics): collisions crush the vehicle ends, override and push vehicles off the track
2026-11-17 03:05:56 +01:00
maj00r 332abc74df Merge pull request #337 from MaSzyna-EU07/test/scenario-cases-ge-reports
Scenario cases for the mission reports eu07/maszyna#421, #506, #524, #525
2026-11-17 03:05:35 +01:00
maj00r bb6d0520f6 Merge pull request #378 from MaSzyna-EU07/feat/track-buckling
feat(track): welded track buckles in the heat, drawn, followed by the axles and fed to the derailment criteria
2026-11-17 03:05:22 +01:00
jerrrrycho 795883335d feat: orbit, shunting, coupling and trackside views of the train (eu07/maszyna#551)
[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).
2026-11-17 02:30:55 +01:00
jerrrrycho 81bae7cdd4 feat: drag universal cab controls to any position with the mouse (#62)
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.
build-feat-universal-smooth-drag
2026-11-17 01:42:49 +01:00
jerrrrycho a3df3a07c8 test: count the shunting seconds in a function of its own, not a lambda holding the vehicle build-feat-split-cruise-control-and-shunting 2026-11-17 00:48:28 +01:00
jerrrrycho aa84e41f09 feat: timetable service flags for the AI driver (eu07/maszyna#95)
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.
2026-11-17 00:17:22 +01:00
jerrrrycho 8d2d9badb5 feat: own kind of animation for a door wing in the .mmd (eu07/maszyna#70)
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.
2026-11-16 23:36:26 +01:00
jerrrrycho 88383c0903 feat: dynamic brake of the diesel-electric vehicles (#82)
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).
2026-11-16 22:45:06 +01:00
jerrrrycho 611dc365eb test: Sonar on the cruise control test: no empty statements, the lambda's captures named 2026-11-16 22:37:04 +01:00
jerrrrycho dda38b6c0d feat: the cruise control apart from the field shunting (eu07/maszyna#69)
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.
2026-11-16 21:38:18 +01:00
jerrrrycho c8f52c8b03 test: Sonar on the main reservoir pipe test: an integer step counter, const references, one declaration a line build-fix-feed-pipe-coupler-substep 2026-11-16 20:22:53 +01:00
jerrrrycho 8a185ee980 fix: exchange the main reservoir pipe air between vehicles after all of them stepped, in sub-steps
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.
2026-11-16 18:03:03 +01:00
jerrrrycho c0bcdc23c7 fix: Sonar on the brake pipe sub-steps: no shadowed enumerator, const test helper, template callback 2026-11-16 17:35:42 +01:00
jerrrrycho 6ee2cc8eb8 fix: exchange the brake pipe air between vehicles after all of them stepped, in sub-steps
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.
2026-11-16 13:24:06 +01:00
jerrrrycho 3ae8d4e72e fix(scripting): typed scenery handles, sandbox keys from eu07.ini only, GCC 13 build
- the scenery API (eu07.events) hands out a full userdata of its own locked
  metatable for each kind of object (event, track, isolated, vehicle,
  memcell), checked with luaL_checkudata: a handle of another kind, a light
  userdata or any other value is a Lua error, not an object taken for
  another. nil stays "no object". one object has one handle while the
  script holds it, so handles compare and key tables as before. event
  handlers get their handles built inside lua_cpcall, and nil for no
  activator
- memcell_values keeps its text as a std::string: the text of a number was
  read from a stack slot popped before use
- newproxy is gone from the sandboxed libraries
- a config block of a scenery no longer changes what only eu07.ini sets
  (lua.fulllibraries, execonexit, extcam.cmd/rec, screenshotsdir,
  network.server/client, zmq.address, motiontelemetry, uart, feedbackmode,
  feedbackport, python/luascreens/wasm.enabled): kept before its keys are
  read, put back before FinalizeConfig(), each attempt logged
- open_file_library() iterates luaL_Reg instead of a std::pair GCC 13
  deduces as a pair of an array and a function
2026-11-16 08:54:00 +01:00
jerrrrycho d9c72e3d7c fix(physics): a repaired vehicle has its crushed ends rebuilt and its collision derailment cleared
Neither resetconsist nor the repair of a coupler cleared what a collision left: the crush of the ends (which keeps
shifting the stop of the buffers in CouplerForce() and in the pair input of the coupler physics, so the next hit of
the repaired consist started past it and sooner over the override threshold), the energy of the contact, the hit of
the step and the reports of the log; nor the reason of a derailment in a collision and the state of the push off.

repair_damage() rebuilds both ends of the vehicle, rerail() clears CollisionDerail and the push off monitor along with
the state of the criteria of derailment (so SetDamage taking dtrain_out off does as well), and the repair of a coupler
rebuilds its end, the crush past the draw gear having torn it off.
build-feat-collision-crush-override
2026-11-16 07:56:12 +01:00
jerrrrycho c774a1ff1c fix(physics): a pushed wheel climbs the rail over the distance it rolls, not over a time at a stand
check_pushed_off() counted the time Y/Q of the leading wheel stayed over the climbing limit, at any speed: a locomotive
at its starting effort pressing a braked rake pushed the empty wagon in front of it off the rails in five steps of
0.01 s without it moving, and an 80 t locomotive running onto a free empty 3WL at 9 km/h pushed it off with the
half-sine of its buffer springs (565 kN for some 0.06 s, over the climbing limit past about 400 kN in a curve of
150 m).

Nadal's limit is that of a wheel rolling under its angle of attack: the creep of the flange contact turns the friction
upwards, helping the flange up. A wheel that doesn't roll has the friction against the lift, and with a flange of 70
degrees and a friction over 1 / tan 70 = 0.36 no lateral force gets it up. So the flange now climbs over the distance
the wheels roll with Y/Q over the limit without a break, the 2 m window of the criteria of derailment (the window of
EN 14363; the climb distance criteria replaced the 50 ms of AAR Chapter XI for the same reason). A hit counts the
distance rolled over the time its peak lasted. A push which takes the whole load off the leading wheels lifts them off
the rail, rolling or not: that, held for 0.05 s, still derails the vehicle by the time.

collision::pushed_forces() gives Y and Q of the wheel (pushed_ratio() their ratio), pushed_monitor counts the climb
over the distance and the lift over the time. Tests: both cases of the review stay on the rails (the ST44 pressing at
386 kN, Y/Q 1.29 in a yard curve of 120 m, the 3WL moving 0.11 m; the EU07 at 9 km/h, 565 kN, Y/Q 1.68 for 8 steps), a
heavy train propelling an empty 3WL into a braked rake in a curve of 150 m still pushes it off as it slides on.
2026-11-16 07:56:12 +01:00
jerrrrycho 0b60032642 Merge remote-tracking branch 'origin/feat/derailment-overspeed-criteria' into feat/track-buckling build-feat-track-buckling 2026-11-16 07:44:58 +01:00
jerrrrycho f372539ea9 Merge remote-tracking branch 'origin/feat/derailment-overspeed-criteria' into feat/collision-crush-override 2026-11-16 07:44:57 +01:00
jerrrrycho 3df78e137a fix(physics): trackcheck tells a curve without a speed limit apart from the defects
A track without a speed limit of its own was checked at a default 125 km/h and counted as overturning or a tight curve
too fast at the default speed: in Tomaszewo 154 such lines, all of them curves with no limit, the tram tracks of the
town (29 to 31 m) among them. A curve without a speed limit is no defect: the drivers go by the signals and the
timetable there. It now gets a note of its own, "no speed limit set (not a defect): the curve takes at most X km/h,
the overturning speed of EU07", only where that is under the top speed of the EU07, and the summary counts these
curves apart from the suspicious tracks, with the slowest speed among them. The tight curve too fast needs a speed
limit too. Tram tracks have no category of their own (a tram is a vehicle of the trains' category, on their tracks),
so they are checked alike.
2026-11-16 07:44:32 +01:00
jerrrrycho 0e41d27032 fix(physics): a repaired vehicle is back on the rails, the state of the criteria of derailment cleared
resetconsist (Stop and repair consist of the debug panel and of the vehicle window) cleared the damage flags, but kept
Derailed, the stretches of the criteria, the distance gathered for them and the report of the monitor. A vehicle once
derailed by the criteria and repaired then slid on with their friction after a derailment of the legacy kind, instead
of stopping dead, and the friction of the ballast kept holding it whenever it stood.

TMoverParameters::rerail() puts a vehicle back on the rails: dtrain_out off, Derailed none, the criteria from scratch,
the monitor free to report the track again, a rail vehicle back on the axis of the track. repair_damage() does what
resetconsist did to the damage (the flags, the engine damage, the wheel flats, the alarm chain) and rerails it;
resetconsist and the road vehicles coming back from the pool of a road point use it. SetDamage taking dtrain_out off
rerails the vehicle as well. A vehicle put on a track anew (consistteleport) starts the stretches of the criteria
over, they were gathered on the track it left.
2026-11-16 07:44:31 +01:00
jerrrrycho cff1232cce refactor: the dates of the scenery wizard and of the editor's backups through std::format, ranges all_of (Sonar S6229, S6197) build-refactor-sonar-localtime-goto 2026-11-16 07:25:04 +01:00