mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-20 18:35:00 +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:
@@ -158,8 +158,12 @@ void store::record(std::string const &Vehicle, reading const &Odometer) {
|
||||
m_modified = true;
|
||||
}
|
||||
|
||||
bool kept(bool const Drivercab, reading const &Odometer) {
|
||||
return Drivercab || Odometer.shown || Odometer.source == origin::counter;
|
||||
}
|
||||
|
||||
void record(store &States, std::string const &Vehicle, bool const Drivercab, reading const &Odometer) {
|
||||
if (false == Drivercab)
|
||||
if (false == kept(Drivercab, Odometer))
|
||||
return;
|
||||
States.record(Vehicle, Odometer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user