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

8 Commits

Author SHA1 Message Date
jerrrrycho
5a45446b4a fix: record the odometer of a vehicle whose cab shows it, also without a driver's brake valve
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.
2026-11-11 08:27:33 +01:00
jerrrrycho
b256c3efa9 refactor: MOVER.h includes the odometer's plain data only
odometer::reading moves to vehicle/odometerreading.h, the store with its files stays in vehicle/odometer.h, so the
physics header doesn't pull in the filesystem and the streams
2026-11-09 16:31:43 +01:00
jerrrrycho
8029740770 fix: read the odometer files of the koliber screens too, say why the unit renderers' drop a letter
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
2026-11-09 16:27:45 +01:00
jerrrrycho
ee42a80188 docs: the odometer store is keyed by the vehicle's name in the scenario 2026-11-09 16:12:44 +01:00
jerrrrycho
acf0716a9c fix: keep the odometers of the vehicles with a driver's cab only
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
2026-11-09 16:12:13 +01:00
jerrrrycho
729f15e878 fix: a test run neither reads nor saves the player's odometer store
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
2026-11-09 16:01:16 +01:00
jerrrrycho
a3ad30b72b fix: the odometer store merges the file other simulations saved, keeps a made up state replaceable by the cab's counter
- 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
2026-11-08 18:18:35 +01:00
jerrrrycho
6dc42e976f feat: keep the vehicle odometers between the sessions (#72)
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.
2026-11-07 22:08:42 +01:00