HasDriverCab() decides by the BrakeHandle, which the DL2 draisine doesn't
have: its cab counter (distcounter: with offset 85) was never saved and
started from the .mmd offset each session. A vehicle is now also recorded
when a cab showed its odometer in the session (reading::shown: TTrain loaded
a cab model of it for a player, or bound a cab's counter to it) or when a
cab's counter seeded its state (origin::counter). The counter-seeded state is
saved as a known one, so the next session starts from it and keeps counting
whenever the counter is bound again.
the renderers of the units (elf_v1, impuls_v1) keep the unit's state, their cars are named after the unit and the
letter of the car (EN76-022a .. EN76-022d), so they drop the last character. the koliber screens of scripts/ keep
theirs in scripts/kilometry by the whole name, which wasn't read
every vehicle which ran got a line in the store, the wagons of the AI's trains in every scenario too. the store
records a vehicle with a driver's brake valve (BrakeHandle in the .fiz), which can show its odometer; the locomotives
and units the AI runs before a player's cab loads them still get in with their replaceable made up states. the
states already in the file stay as they are
the autotests (--test, Global.test.enabled) run the vehicles of the player's game: their odometers count from the
legacy or made up states in a store of their own, and nothing is written to eu07_odometers.txt
- each process writes its own <file>.<pid>.tmp and renames it in place; before writing it re-reads the file and
merges it per vehicle (a known state beats a made up one, else the larger one, never the sum)
- a state counted from a made up one is saved as ~<km> and the .mmd counter offset still replaces it later
- a vehicle removed from the scenery has its odometer recorded right away
Sonar (S5443) flags the shared temporary directory; the tests now use one
in their working directory. Also makes the scratch directory non-copyable
and spells out the optional checks Sonar asked about.
Every vehicle gets an odometer (TMoverParameters::Odometer) counting along
with the per-session DistCounter, starting from its state saved in
eu07_odometers.txt in the user's settings directory, else from the file a
python screen kept it in (kilometry/<name>_przebieg.txt), else from a state
made up from the vehicle name. The store is saved every minute of
simulation time and on closing.
The cab's distcounter: gauge shows the odometer; its .mmd offset seeds a
vehicle with no known state. Python screens get it as
state["odometer_total"]; state["odometer"] stays the session distance the
logbook and mirror scripts count differences of.