18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-22 02:05:01 +01:00

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.
This commit is contained in:
jerrrrycho
2026-11-11 08:27:33 +01:00
parent 9a873b2e18
commit 5a45446b4a
5 changed files with 109 additions and 6 deletions

View File

@@ -27,6 +27,9 @@ struct reading {
double start{0.0}; // the state at the start of the session, km
origin source{origin::guessed};
double guess{0.0}; // the made up state a guessed one counts from, km
// a cab shows the state in this session: a cab of the vehicle was loaded for a player (its python screens can
// show it), or a cab's counter was bound to it. such a vehicle has a cab, whatever its type tells
bool shown{false};
// sets the state the vehicle starts the session with
void begin(double Km, origin Source);