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

21 Commits

Author SHA1 Message Date
maj00r
b251b6fe42 feat(blackbox): a black box of the session: the run, the cab, the signals and the stations to a file (#322)
* feat(blackbox): a recorder of the run, the cab, the signals and the stations to a file

With the physics logs on (and the new eu07.ini setting blackbox, on by
default), the simulator writes a black box of the session to
physicslog/*.blackbox: the scenery map (tracks, signals, W4 stop points
with their heading, W6 horn points), the timetables of the user's train,
and at 10 Hz the cab of the vehicle the user sits in (speed, controllers,
brakes, pressures, lights with the pattern the run asks for, the movement
kind), the AI's reference for the same place (target speed, next limit,
braking distance), the consist, the cameras and the vehicles around.
Changes go in as they happen: switches, signal aspects, commands,
signals passed with their aspect, stations stopped at, passed or missed,
horn requests, the autopilot switched on or off, couplings and vehicles
removed.

The driving aid's next speed limit moved from the UI panel to
TController::next_speed_limit(), so the panel and the recorder read the
same. The format is described in blackbox_doc.md; the writer and the
reader of the records have unit tests.

* fix(blackbox): the aspect a signal had when passed, the lamps the ends have, vehicles taken off

- A passed signal is written with the aspect the train had of it, kept in
  the speed table, not the one its memory cell shows when the pass is
  noticed: by then the train itself on the track behind has often set
  it to stop, and most passes were written as at stop.
- The cab record gains the lamps the vehicles at the head and the tail
  have at their outer ends (136 bytes), so a reader can check the light
  pattern against them as the driver does (no upper headlight, the
  auxiliary lamps, the rear-end signals only).
- A vehicle taken off the scenery and still pointed at by a coupler or
  the camera gets no new number; the camera lets go of it.
- The timetable written before a station goes under the vehicle the
  user is in now, not the one of the last look.
- The file buffer is given once the file is open: MSVC passed over one
  given before.
- The doc tells the AI fields before the consist is started and when
  entering a vehicle is a driver change.

* fix(blackbox): the stop of an automatic block signal passed is written as a stop

The speed table keeps the stop of an automatic block signal (SetVelocity 0 x) as the speed allowed after it, with spStopOnSBL; a pass of it was written as that speed with no flag. It is written as 0 with the flag of an automatic block stop again.

* feat(blackbox): the doors, the brakes of the whole train, a diesel's engine and the rest of the cab

The cab record grows from 136 to 190 bytes, so that a reader can check
everything the driver did:

- the doors: the permits on each side, the departure signal, the steps,
  the door lock and whether the doors are locked;
- the brakes: the equalizing reservoir of the driver's valve, the main
  reservoir pipe, the highest brake cylinder pressure of the train, the
  hand brake, the releaser, the setting (G/P/R/Mg) and the mode
  (PS/PN/EP/MED);
- what drives the vehicle (electric, induction, diesel, diesel-electric,
  steam, none), its power, a diesel's oil pressure, water, oil and engine
  temperatures, overheating, fuel and oil pumps, clutch and torque
  converter, the motor fans;
- the cruise control and its speed, the integrated driving handle of a
  unit, the radio channel, the horn's tones.

New device bits use the upper half of the 32-bit field; the new fields
come at the end of the record, so older readers still read it.

* fix(blackbox): the driver's valve field is what its gauge shows, the radio channel has no none

Handle->GetCP() is the equalizing reservoir of most valves but the time reservoir of the FV4a, empty but after an overcharge: the field is named and documented as what the valve shows. With no driver the radio channel reads as the first one, not 0.

---------

Co-authored-by: maj00r <maj00r@host>
2026-11-11 04:30:52 +01:00
aba8687678 feat(ui): repair the broken coupler next to the camera from the driving aid 2026-11-11 02:52:00 +01:00
jerrrrycho
441caeed64 refactor(simulation): tidy the test mode code
The test manager is reached through simulation::test() instead of a global,
the result cell is owned by a unique_ptr until the memory table takes it, the
cell value is compared with a margin, strings are built with std::format and
the --test settings moved to apply_test_mode_settings(). The driver's signal
check is folded into UpdateSpeedPosition(), which updates a speed table entry
and reports a signal at stop the head of the train just passed. The test.*
keys are listed with the other settings at the start of the log.
2026-11-07 17:12:11 +01:00
jerrrrycho
02e29f6971 feat(simulation): test mode, --test runs a scenery unattended and exits with the result (eu07/maszyna#541)
eu07 --test -s <scenery> [--test-timeout <s>] runs the scenery in ghostview with
the null renderer (models loaded, no textures), a hidden window, no sound,
network or python, and in fixed steps of 0.03 s of simulation time per frame
(three 10 ms physics steps) as fast as it can. Without -seed it uses a fixed
seed, so two runs give byte-identical physicslogs.

The scenery reports its result to the __test.result memory cell, which the
simulator always creates: value 1 passes once every vehicle has stood still for
1 s, value 0 fails at once. The run ends with exit code
  0 pass, 1 fail,
  2 a train passed a signal at stop (SetVelocity 0 0, as seen in its driver's
    speed table; SetVelocity 0 x on automatic block doesn't count),
  3 timeout (test.timeout, default 3600 s of simulation time),
  4 standstill (every vehicle still for test.standstill s, default 300, with no
    result; a pass with test.pass_on_standstill yes),
  5 error (no -s, the scenery didn't load or has no vehicles, an exception).
The test.* keys go in the scenery's config block; test.fail_if_stop_overran no
only logs a signal passed at danger. Outside the test mode a signal passed at
danger is logged.

The null renderer gets a ui backend which draws nothing, hands out the null
texture and material instead of throwing, and ends the ui frame. A GL context
is still made for the hidden window, without asking for a version, as parts
of the ui create textures with gl calls of their own. No crash dialog or
message box in test mode; the window code no longer needs a monitor.
2026-11-07 16:20:42 +01:00
maj00r
e230d7b902 fix: a deleted model is no longer the picked node, an orthophoto tile isn't swept as a grey stub, the ED brake arrays freed
Deleting a model in the editor left the renderer holding it as the picked node, the next pick used freed memory: the renderer forgets it now (Forget_Node). A texture filled straight from memory (internalsrc:) can't be read again, released by the garbage sweep it came back grey; it stays now, and the units bound with the old name are rebound. The arrays of the ED brake force sharing are vectors, they leaked once per update. The scene hierarchy and the editor menu items go through the translation. Python caches ignored.
2026-11-03 21:45:58 +01:00
917c8f7285 Merge branch 'master' into feat/modern-editor 2026-10-08 17:44:58 +02:00
maj00r
978b99b7e5 feat(scenery): models laid along curves (sweep nodes), bent to follow the paths or repeated along them, loaded and saved with the scenery; trainsets put on a path while the simulation runs; trainset turned around by reversed after its header: the first vehicle stays at the offset and leads towards point 1, the rest stands behind it; launcher keeps reversed trainsets and can turn one around; memory cells saved with the new name of the path they name; events tell their targets and the events of a multiple event; renderer tells whether the cursor is over a surface; vehicle placed in the editor entered when the driving goes on 2026-10-06 22:19:32 +02:00
c4a22eabd5 feat(editor): nodes placed with the brush and the area fill go without names; name of a model instance set in the node properties and written to its definition on save; redo of a deletion finds nodes which have no name 2026-10-06 21:58:57 +02:00
jerrrrycho
79bd0c8e91 fix(sonar): addressing reliability/security issues (#202) 2026-10-04 20:00:13 +02:00
27a94509c4 feat(roads): right of way and lane turns at junctions, road weights, kerbs, medians and forking roads, banks to the ground, roundabouts, pedestrian crossings, spawn sets by count; fix(editor): model skin export, placement on the ground under the orthophoto 2026-10-04 01:55:35 +02:00
3ce9102da0 feat(roads): level crossings, spawn and removal points for road vehicles, deleting points of a road 2026-10-04 00:31:44 +02:00
daeed40f15 feat(roads): junctions, height above the ground and rounded profile following the terrain 2026-10-03 20:28:37 +02:00
2f417fddcc feat(roads): road node with generated lanes, surface and markings 2026-10-03 17:35:08 +02:00
ced26d171f feat(editor): edit parameters of a placed include 2026-10-03 00:37:17 +02:00
968594c3e9 feat(editor): include database, placing .inc templates from the node bank 2026-10-02 23:57:35 +02:00
3199f3796e feat(editor): layers window, scenery save and include descriptions 2026-10-02 22:40:52 +02:00
73f2f68aa0 feat(editor): edit session (-edit) and scenery layers 2026-10-02 21:29:18 +02:00
jerrrrycho
d85096f64d reformat: remove redundant parentheses 2026-06-30 21:19:46 +02:00
docentYT
d1f16411a1 Replace clamp with std::clamp 2026-05-01 22:14:29 +02:00
copilot-swe-agent[bot]
7e49aa8740 Rewrite #includes to use explicit subdirectory paths
Co-authored-by: Hirek193 <23196899+Hirek193@users.noreply.github.com>
2026-03-14 19:16:48 +00:00
copilot-swe-agent[bot]
0531086bb9 Reorganize source files into logical subdirectories
Co-authored-by: Hirek193 <23196899+Hirek193@users.noreply.github.com>
2026-03-14 19:01:57 +00:00