From 5d5e271edbba3cf60e78840af730d38c38cc91c3 Mon Sep 17 00:00:00 2001 From: Hirek193 Date: Sun, 29 Nov 2026 18:32:22 +0100 Subject: [PATCH] Create vehicle-architecture.md --- docs/vehicle-architecture.md | 450 +++++++++++++++++++++++++++++++++++ 1 file changed, 450 insertions(+) create mode 100644 docs/vehicle-architecture.md diff --git a/docs/vehicle-architecture.md b/docs/vehicle-architecture.md new file mode 100644 index 000000000..ed70c2f5e --- /dev/null +++ b/docs/vehicle-architecture.md @@ -0,0 +1,450 @@ +# The vehicle: physics, driving and dependencies + +How, after the refactorings of `cleanup/mover` (as of 2026-11-29, at `969864f2`), the physics of a vehicle (`physics/`), +the vehicle in the scenery (`vehicle/`, `vehicle/dynamic/`), the AI driver (`vehicle/ai/`) and the player's cab +(`vehicle/cab/`) work together, and which files outside these folders use them. The rules this split follows are in +`AGENTS.md` ("Naming and the vehicle code"); this is a picture of what came of them. + +The diagrams are Mermaid (GitHub and most editors draw them). + +## 1. Layers + +```mermaid +flowchart TB + subgraph outside["The rest of the simulator"] + app["application/
drivermode, UI panels, editor"] + input["input/
command_relay, mouse, keyboard"] + world["world/
Track, TrkFoll, Event, MemCell"] + sim["simulation/
state_manager, serializer, blackbox"] + script["scripting/
lua, PyInt, Python screens"] + render["rendering/, audio/, scene/"] + end + + subgraph veh["vehicle/ (the vehicle in the scenery)"] + cab["vehicle/cab/
TTrain: the player's cab"] + ai["vehicle/ai/
TController: the driver"] + dyn["vehicle/dynamic/
TDynamicObject, vehicle_table"] + helpers["vehicle/*.h, *.cpp
small modules without the scene
(brakesetting, handover, horn, ...)"] + end + + subgraph phys["physics/ (the physics of the vehicle)"] + pv["physics::Vehicle
vehicle.h + components/*.cpp"] + comp["components
components/*.h"] + models["standalone models
brakes, friction, oerlikonest,
couplerphysics, collision,
derailment, consistbraking"] + vocab["vocabulary
vehicletypes.h, vehiclecommand.h"] + end + + app --> cab + app --> dyn + input -->|user_command| cab + sim --> dyn + world --> dyn + world --> ai + script --> ai + render --> dyn + + cab --> ai + cab --> dyn + ai --> dyn + dyn --> ai + cab --> pv + ai --> pv + dyn --> pv + helpers --> pv + + pv --> comp + pv --> models + comp --> vocab + pv --> vocab +``` + +An arrow means "knows / calls". The rule: `physics/` doesn't know the scene, `vehicle/` knows the physics, and the rest of +the simulator reads a vehicle through `TDynamicObject` (its dimensions, speed, cab, lights), not through +`physics/vehicle.h`. The exceptions to the rule that are still left are in section 7. + +## 2. The objects at run time + +```mermaid +classDiagram + direction LR + class vehicle_table { + simulation::Vehicles + update(dt, iterations) + update_brake_pipes() + update_coupler_physics() + } + class train_table { + simulation::Trains + update(dt) / updateAsync(dt) + } + class TDynamicObject { + physics : physics::Vehicle* + Mechanik : TController* + ctOwner : TController* + Axle0, Axle1 : TTrackFollower + Update() UpdateForce() FastUpdate() + Prev() Next() + } + class TController { + pVehicle : TDynamicObject* + mvControlling : physics::Vehicle* + occupied : physics::Vehicle* + sSpeedTable : TSpeedPos[] + Update(dt) + PutCommand() + } + class TTrain { + DynamicObject : TDynamicObject* + controlled, occupied : physics::Vehicle* + secondUnit, thirdUnit + m_commandhandlers + Update(dt) + } + class Vehicle["physics::Vehicle"] { + Couplers : ByEnd~TCoupling~ + Neighbours + ComputeTotalForce() + FastComputeMovement() + ComputeMovement() + RunCommand() SendCtrlToNext() + } + + vehicle_table "1" o-- "*" TDynamicObject + train_table "1" o-- "*" TTrain + TDynamicObject "1" *-- "1" Vehicle : creates (lifecycle.cpp) + TDynamicObject "1" *-- "0..1" TController : Mechanik (lifecycle.cpp) + TDynamicObject --> TController : ctOwner (runs the consist) + TController --> TDynamicObject : pVehicle, pVehicles + TController --> Vehicle : mvControlling, occupied + TTrain --> TDynamicObject : DynamicObject + TTrain --> Vehicle : controlled, occupied + Vehicle --> Vehicle : Couplers.Connected +``` + +- `TDynamicObject` creates its `physics::Vehicle` (`vehicle/dynamic/lifecycle.cpp`) and, when it is manned, its + `TController` (`Mechanik`). `ctOwner` points at the driver who runs the whole consist. +- A `TTrain` exists for the vehicles the player can get into (`simulation::Trains`; `simulation::Train` is the one the + player is in). It doesn't own its vehicle, it only points at it; when the player changes vehicles (`MoveToVehicle()`, + F5) it moves its pointers. +- `TController` works for the AI and for the player alike (`AIControllFlag()`): with the player it still keeps the speed + table, the hints and the black box, it only leaves the controls alone. +- The vehicles of a consist are linked in the physics (`physics::Vehicle::Couplers[].Connected`) and in the scene + (`TDynamicObject::Prev()` / `Next()`). + +## 3. A frame of the simulation + +```mermaid +sequenceDiagram + autonumber + participant DM as driver_mode::update
(application/drivermode.cpp) + participant SM as state_manager::update
(simulation/simulation.cpp) + participant VT as vehicle_table::update
(vehicle/dynamic/vehicletable.cpp) + participant DO as TDynamicObject + participant PV as physics::Vehicle + participant AI as TController + participant TR as TTrain::Update
(vehicle/cab/update.cpp) + + DM->>SM: update(dt, iterations) + SM->>SM: animations, power grid, road junctions + SM->>VT: update(dt, iterations) + VT->>DO: update_traction() (overhead voltage), update_neighbours() + VT->>VT: update_coupler_physics() + loop iterations - 1 steps (optionally on threads) + VT->>DO: UpdateForce(dt) + DO->>PV: ComputeTotalForce(dt) + VT->>DO: FastUpdate(dt) + DO->>PV: FastComputeMovement(dt) + VT->>VT: update_brake_pipes(dt) + end + VT->>DO: UpdateForce(dt) + VT->>DO: Update(dt, dt1) (the full step) + DO->>DO: updateTrackParameters, updateCouplingState, updateTractionVoltage + DO->>AI: updateDriver: Mechanik->Update(dt1) + AI->>PV: operations (IncMainCtrl, BrakeLevelSet, MainSwitch, ...) + DO->>PV: ConsistBrakeBlending.Update(vehicles of the consist) + DO->>PV: ComputeMovement(dt, dt1, track, overhead line) + DO->>DO: animations, pantographs, wipers, mirrors, load + VT->>VT: update_brake_pipes(dt) + SM->>SM: TTrack::update_buckling + DM->>TR: simulation::Trains.update(dt) + TR->>TR: simulation::Commands.pop() -> OnCommand_*() + TR->>PV: operations from the player's cab + TR->>TR: UpdateCab: gauges, buttons, sounds, screens + DM->>DM: Events.update, Lights.update, process_commands +``` + +Inside `physics::Vehicle` the step goes like this (`physics/components/body.cpp`): + +- `ComputeTotalForce()`: the tractive force (`TractionForce()`, `traction.cpp`, through `Drive()` for the kind of engine), + the braking (`BrakeForce()`, `FrictionForce()`), adhesion and slipping, the forces in the couplers. +- `FastComputeMovement()` / `ComputeMovement()`: the movement along the track, derailment (`check_derailment()`), + collisions (`CollisionDetect()`), the odometer, and in their shared part `compute_movement_()`: the internal commands + (`RunInternalCommand()`), the circuits (`MainsCheck`, `PantographsCheck`, `ConverterCheck`, `CompressorCheck`, + `LowVoltagePowerCheck`, `HeatingCheck`, `LightsCheck`, ...), the air (`UpdatePipePressure`, `UpdateBrakePressure`, + `air.UpdatePressure`), the engine (`UpdateEngine`), the doors, the PLC (`m_plc`). + +## 4. Commands: who changes the state of a vehicle + +```mermaid +flowchart LR + subgraph sources["Sources"] + kb["keyboard / mouse / UART / ZMQ
input/"] + events["scenery events, MemCell
world/Event.cpp, MemCell.cpp"] + lua["Lua
scripting/lua.cpp"] + scn["loading the scenery
simulationstateserializer.cpp"] + end + + relay["command_relay
simulation::Commands"] + train["TTrain::Update
m_commandhandlers
(cab/commandtable.cpp)
OnCommand_* in cab/*commands.cpp"] + ctrl["TController
PutCommand(), Update()
(ai/orders.cpp, ai/*.cpp)"] + pv["physics::Vehicle
public operations"] + next["neighbouring vehicles
RunCommand()"] + + kb -->|user_command| relay --> train + train -->|"Set..., Inc..., Switch..."| pv + train -->|"AI on/off, direction, doors of the consist"| ctrl + events -->|"PutCommand, as text"| ctrl + events -->|"PutCommand: load and the like"| pv + lua --> ctrl + lua --> pv + scn -->|"first orders"| ctrl + ctrl -->|"the same operations as the cab"| pv + pv -->|"SendCtrlToNext: VehicleCommand"| next +``` + +- The vehicles of a consist pass `VehicleCommand`s (`physics/vehiclecommand.h`) to each other through their couplings + (`SendCtrlToNext()` → `RunCommand()` of the neighbour, carried out in `RunInternalCommand()` in a later step). The text + names of the commands only matter where a command comes as text (events, Lua) or is shown (the log, the AI). +- Outside `physics/` the state of a `physics::Vehicle` changes only through its operations (`SetMainCtrlPos()`, + `SetLitLights()`, `UnloadStep()`, ...), never by writing its fields. The exception is the definition of the vehicle, + which the scenery and the `.mmd` adjust as it loads. +- The cab and the events read `TController` through its queries; only the debug, timetable, scenario and driving aid + panels (`application/driveruipanels.cpp`) are its friends. + +## 5. Inside `physics/` + +```mermaid +flowchart TB + subgraph vehicle_h["physics/vehicle.h: class physics::Vehicle"] + direction TB + def["the definition from the .fiz
(fizparser.cpp, fizsections.cpp, setup.cpp)"] + state["state and steps
body, traction, controllers, electrics,
pneumatics, diesel, doors, couplers,
collisions, commands, cab, securitysystem"] + end + + subgraph components["physics/components/*.h: the parts of the vehicle"] + mc["maincircuit.h
LineBreaker, LineContactors,
ProtectionRelays, PowerConverter"] + lv["lowvoltage.h
LowVoltageSupply, TrainHeating"] + pa["pantographs.h
PantographCircuit, PantographAir"] + as["airsupply.h
AirCompressor, AirSupply, TrainPipe"] + br["braking.h
Braking: blending, holding,
spring brake, ED"] + de["dieselengine.h
DieselEngine, TorqueConverter,
Retarder, EngineHeat"] + im["inductionmotor.h
InductionMotor (inverters)"] + dv["devices.h
pumps, fans, valves,
doors, genset, pantograph"] + dr["drive.h
TractionDrive: one class
for each EngineType"] + end + + subgraph models["standalone models (without physics::Vehicle)"] + brakes["brakes.h
TReservoir, TBrake and the distributors
(TWest, TESt*, TLSt, TEStED, TKE, ...),
the driver's brake valves"] + oer["oerlikonest.h
TNESt3"] + fr["friction.h
brake block materials"] + cp["couplerphysics.h
coupler_physics::"] + col["collision.h
collision::"] + der["derailment.h
derailment::"] + cb["consistbraking.h
ConsistBrakeBlending"] + end + + vocab["vehicletypes.h, vehiclecommand.h"] + + vehicle_h --> components + vehicle_h --> brakes + vehicle_h --> cp + vehicle_h --> col + vehicle_h --> der + oer --> brakes + brakes --> fr + col --> cp + col --> der + cb -.->|"works on the vehicles of a consist"| vehicle_h + components --> vocab + vehicle_h --> vocab +``` + +The pattern of a component (from `maincircuit.h`, `lowvoltage.h`, `pantographs.h`, `airsupply.h`): + +```mermaid +flowchart LR + fiz[".fiz"] -->|"written by the parser and the setup"| config["config (public)
the definition, only read afterwards"] + veh["physics::Vehicle
decides WHEN the part acts"] -->|"plain values
ConverterSupply, CompressorInputs, ..."| update["Update() / Close() /
ResetGround() / Switch()"] + update --> privstate["private state"] + privstate -->|"queries: IsClosed(), ..."| veh + update -->|"what the step reports
CompressorStep, ..."| veh + tests["tests/unit"] -->|"...ForTest()"| privstate +``` + +| Field of `physics::Vehicle` | Type | File | +|---|---|---| +| `lowVoltage`, `trainHeating` | `LowVoltageSupply`, `TrainHeating` | `components/lowvoltage.h` | +| `lineBreaker`, `lineContactors`, `protection`, `converter` | `LineBreaker`, `LineContactors`, `ProtectionRelays`, `PowerConverter` | `components/maincircuit.h` | +| `pantographs`, `pantographCircuit`, `pantographAir` | `ByEnd`, `PantographCircuit`, `PantographAir` | `components/devices.h`, `components/pantographs.h` | +| `air`, `brakePipe`, `mainPipe` | `AirSupply`, `TrainPipe` | `components/airsupply.h` | +| `brakes` | `Braking` (the distributor `TBrake`, the driver's valves `TDriverHandle`) | `components/braking.h`, `brakes.h` | +| `diesel`, `torqueConverter`, `retarder` | `DieselEngine`, `TorqueConverter`, `Retarder` | `components/dieselengine.h` | +| `inductionMotor` | `InductionMotor` | `components/inductionmotor.h` | +| `Drive()` | `TractionDrive const &` (`DriveOf(EngineType)`) | `components/drive.h` | +| `SecuritySystem` | `TSecuritySystem` | `vehicle.h`, `components/securitysystem.cpp` | +| `Couplers`, `Neighbours` | `ByEnd`, `ByEnd` | `vehicle.h`, `couplerphysics.h` | +| `Doors`, `Genset` | `door_data`, `genset_device` | `components/devices.h` | +| `OffTrack`, `Odometer`, `m_plc` | `derail_motion::body`, `odometer::reading`, `plc::basic_controller` | `vehicle/derailmotion.h`, `vehicle/odometerreading.h`, `scripting/ladderlogic.h` | + +The files `physics/components/*.cpp` are the parts of the one class `physics::Vehicle`, cut by subsystem; the helpers +they share are in `components/internal.h`, which only they include. + +| File | What it computes | +|---|---| +| `body.cpp` | construction, the forces on the body, the movement along the track, adhesion, sand, the step (`ComputeTotalForce`, `ComputeMovement`) | +| `traction.cpp` | the traction motors and their forces for each kind of drive, the relays, the fuses, the dynamic brake | +| `controllers.cpp` | the master and the secondary controllers, the camshaft, the integrated controller, the speed control | +| `electrics.cpp` | the batteries, the main switch, the pantographs, the converter, heating, lights, the genset | +| `pneumatics.cpp` | the brake controls, the pipes, the valves, the compressor, the spring brake | +| `diesel.cpp` | the revolutions of the diesel engine, the gearbox, the clutch, the hydraulic transmission, its heat, the pumps | +| `drive.cpp` | the `TractionDrive` classes, one for each `EngineType` | +| `couplers.cpp` | coupling, the forces in the couplers, automatic coupling | +| `collisions.cpp` | collisions, crush, derailment and putting back on the rails | +| `commands.cpp` | the `VehicleCommand`s between vehicles (`RunCommand`, `RunInternalCommand`, `SendCtrlToNext`) | +| `cab.cpp` | activating the cab, the direction, the horns, the pullee mode | +| `doors.cpp` | the doors and the exchange of the load | +| `securitysystem.cpp` | vigilance, cab signalling, radio-stop | +| `fizparser.cpp`, `fizsections.cpp` | reading the `.fiz` | +| `setup.cpp` | setting the vehicle up after loading: the checks, the valves, the pipes | + +## 6. `vehicle/`: the scene, the AI and the cab + +```mermaid +flowchart TB + subgraph dynamic["vehicle/dynamic/ (TDynamicObject, vehicle_table)"] + dlife["lifecycle.cpp, mmd.cpp, load.cpp
creation, the .mmd, the load"] + dupd["update.cpp, movement.cpp, vehicletable.cpp
the step of a vehicle and of the whole table"] + dcons["consist.cpp, couplers.cpp, neighbours.cpp
the consist, the couplers, the neighbours"] + dvis["visual.cpp, animations.cpp, lights.cpp,
sounds.cpp, destinations.cpp, offtrack.cpp"] + end + + subgraph aidir["vehicle/ai/ (TController, Driver.h)"] + adrv["driver.cpp, orders.cpp
construction, Update, orders"] + aroute["routescan.cpp, speedtable.cpp, speedpos.cpp,
obstacles.cpp, situation.cpp
the speed table, the signals, the obstacles"] + acontrol["speed.cpp, force.cpp, controls.cpp,
engine.cpp, doors.cpp, consist.cpp
target speed, controllers, brakes, doors, consist"] + alog["physicslog.cpp"] + end + + subgraph cabdir["vehicle/cab/ (TTrain, Train.h)"] + ctrain["train.cpp, setup.cpp, cab.cpp
the player's train, gauges, buttons"] + cupd["update.cpp, sounds.cpp, screens.cpp
the step of the cab, sounds, Python screens"] + ccmd["commandtable.cpp + *commands.cpp
handling user_command"] + end + + subgraph small["vehicle/*.h, *.cpp: modules testable without the scene"] + sai["for the AI: brakesetting, brakecharge, brakereleaser,
brakingcurve, uphillstart, aipower, aiwire,
signalpassing, timetableservice, handover,
driverorders, fieldshunting"] + scab["for the cab: horn, linebreaker, holdcoillever,
enginestart, mainctrlact, compartmentlightsswitch,
gaugescale, gaugewrap, gaugepositions,
gaugeduplicates, universaldrag, drivingaid"] + sdyn["for the vehicle in the scene: derailmotion, doorwings,
mirrors, lightsprogrammer, pulleemode, smoke,
odometer, driverfigure, cameraviews"] + sother["crew, crewchange, blackbox,
Camera, Gauge, Button, AirCoupler"] + end + + dynamic --> aidir + aidir --> dynamic + cabdir --> dynamic + cabdir --> aidir + aidir --> sai + cabdir --> scab + dynamic --> sdyn +``` + +- `Driver.h` (`TController`) includes `DynObj.h`; `Train.h` (`TTrain`) includes `DynObj.h` and `Driver.h`. The files of + `vehicle/ai/`, `vehicle/cab/` and `vehicle/dynamic/` each share one `internal.h` with their list of includes. +- The AI looks for a `TTrain` in two places only, through `simulation::Trains.find()`: when it changes cabs + (`ai/consist.cpp`), and for the pantographs and lights of the player's train (`ai/situation.cpp`). +- The cab uses `TController` to take over and hand back the controls (`TakeControl`, `AIControllFlag`), to change the + direction, for the doors of the consist (`ConsistDoors*`) and to check the consist (`CheckVehicles`). +- The modules of `vehicle/*.h` are mostly plain functions or small structures on plain values, tested in `tests/unit` + without the scene. Some of them include `physics/vehicle.h` (`lightsprogrammer.h` and `mainctrlact.h` in the header; + `brakesetting.cpp`, `drivingaid.cpp`, `enginestart.cpp`, `handover.cpp`, `crew.cpp`, `smoke.cpp` and + `timetableservice.cpp` in the implementation). + +## 7. Include dependencies + +```mermaid +flowchart LR + classDef up stroke:#d33,stroke-width:2px,color:#d33 + + vt["physics/vehicletypes.h"] --> vc["physics/vehiclecommand.h"] + vt --> es["utilities/enumset.h"] + vh["physics/vehicle.h"] --> vt + vh --> comps["physics/components/*.h"] + vh --> bh["physics/brakes.h"] --> fh["physics/friction.h"] + vh --> colh["physics/collision.h"] --> cph["physics/couplerphysics.h"] + colh --> dh["physics/derailment.h"] + vh --> ll["scripting/ladderlogic.h"]:::up + vh --> dm["vehicle/derailmotion.h"]:::up + vh --> odo["vehicle/odometerreading.h"]:::up + + ccpp["physics/components/*.cpp"] --> vh + ccpp --> dynh["vehicle/DynObj.h"]:::up + ccpp --> simh["simulation/simulation.h"]:::up + ccpp --> fsh["vehicle/fieldshunting.h"]:::up + ccpp --> glob["utilities/Globals.h"] + + dynobj["vehicle/DynObj.h"] --> vt + dynobj --> dh + dynobj --> cbh["physics/consistbraking.h"] + dynobj --> dm2["vehicle/derailmotion.h"] + dynobj --> trk["world/TrkFoll.h"] + driver["vehicle/Driver.h"] --> dynobj + driver --> vt + train["vehicle/Train.h"] --> dynobj + train --> driver + classes["utilities/Classes.h
declares physics::Vehicle,
TDynamicObject, TController, TTrain"] +``` + +In red is what goes "up", against the layers of section 1. As it stands: + +- `physics/vehicle.h` includes three headers from outside `physics/`, but all of them are data without the scene: + `vehicle/derailmotion.h` (the movement of a vehicle off the track, the field `OffTrack`), `vehicle/odometerreading.h` + (the field `Odometer`) and `scripting/ladderlogic.h` (the PLC, the field `m_plc`). The natural place for the first two is + `physics/`. +- `physics/components/*.cpp` share a block of includes with `vehicle/DynObj.h` and `simulation/simulation.h`. They don't + use `TDynamicObject` (it appears only in comments); of `simulation/` they take only `simulation::Weights` (the unit + weights of the loads, `body.cpp`). `vehicle/fieldshunting.h` (a plain function) is used by `controllers.cpp` and + `diesel.cpp`. These are candidates for a cleanup: drop `DynObj.h` from the block, move `fieldshunting.h` to `physics/`, + and hand the physics the `Weights` as a value. +- The physics reads settings from `Global` (`utilities/Globals.h`): `collisions`, `derailment`, `crash_damage`, + `coupler_physics*`, `physics_sleepheld`, `physics_pipewake`, `AirTemperature`; and `fizparser.cpp` sets + `Global.iPause` while it loads. + +## 8. Other files that use the vehicle + +| File | Through | What for | +|---|---|---| +| `utilities/Classes.h` | declarations | `physics::Vehicle`, `TDynamicObject`, `TController`, `TTrain` for the headers that only point at them | +| `application/drivermode.cpp` | `Train.h`, `DynObj.h`, `Driver.h` | the frame loop, getting in, changing vehicles, the camera | +| `application/driveruipanels.cpp`, `consistviews.cpp`, `driverhints.cpp` | `Driver.h` (friend), `physics/vehicle.h` | the debug, timetable, scenario and driving aid panels, the hints | +| `application/editormode*.cpp` | `DynObj.h` | the editor and its self-tests | +| `input/command.cpp`, `drivermouseinput.cpp`, `zmq_input.cpp` | `Train.h` | `user_command`s for the cab, mapping clicks to the controls of the cab | +| `input/messaging.cpp`, `utilities/uart.cpp`, `utilities/motiontelemetry.cpp` | `physics/vehicle.h`, `Train.h` | the state of the vehicle for external programs, desks, motion platforms | +| `simulation/simulation.cpp` | `vehicle_table`, `train_table` | `state_manager::update()`, `process_commands()` | +| `simulation/simulationstateserializer.cpp` | `DynObj.h`, `Driver.h` | loading the vehicles and consists of the `.scn`, the first orders | +| `simulation/blackboxrecorder.cpp` | `physics/vehicle.h`, `Driver.h`, `Train.h` | recording the session (`vehicle/blackbox.h` is the format) | +| `simulation/simulationtest.cpp` | `DynObj.h` | the test mode (`--test`) | +| `world/TrkFoll.cpp` | `DynObj.h`, `Driver.h` | the axles of a vehicle on the track, the events it runs over | +| `world/Track.cpp`, `TrackBuckle.cpp` | `DynObj.h`, `physics/vehicle.h` | the vehicles on a track, derailing on buckled track | +| `world/Event.cpp`, `world/MemCell.cpp` | `PutCommand()` | the commands of the scenery for the driver and the vehicle | +| `world/station.cpp`, `RoadPoint.cpp`, `Road.cpp`, `deer.cpp` | `DynObj.h` | the exchange of passengers, road traffic, animals | +| `scripting/lua.cpp` | `Driver.h`, `physics/vehicle.h` | `PutCommand()` from Lua | +| `scripting/PyInt.cpp`, `pythonscreenviewer`, `vehicle/cab/screens.cpp` | `Train.h` | the Python screens of the cab (the state dictionaries) | +| `audio/sound.cpp`, `audio/audiorenderer.cpp` | `DynObj.h`, `Train.h` | the sounds of the vehicle and the cab | +| `rendering/common/*`, `rendering/opengl46/*`, `rendering/vulkan14/*`, `rendering/particles.cpp`, `lightarray.cpp` | `DynObj.h`, `Train.h` | drawing the vehicles, the cab, the lights, the smoke | +| `scene/scene.cpp`, `widgets/map*.cpp`, `widgets/vehicle*.cpp`, `widgets/trainingcard.cpp` | `DynObj.h`, `Driver.h` | the scenery, the map, the vehicle lists, the training card | +| `utilities/Globals.cpp` | | the `eu07.ini` settings the physics and the AI read | +| `tests/unit/*` | `physics/vehicle.h`, `physics/brakes.h`, `DynObj.h` | the tests: `vehicle.h` / `consist.h` (a vehicle and a consist without the scenery, stepped as `vehicle_table::update()` does), `golden.*` (against a recorded run), `fiz.*` (`.fiz` definitions in a test), `scenario.*` | + +`physics/vehicletypes.h` (the vocabulary: ends, sides, couplings, lights, types of drive and brake) and +`physics/vehiclecommand.h` (`VehicleCommand`) are what the rest of the simulator should include when it needs only these +names; outside `physics/` and `vehicle/`, `application/consistviews.h`, `application/driveruipanels.h` and +`rendering/common/scenewalk.h` do so today.