mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-20 05:44:59 +01:00
fix(physicslog): failed logs kept within 64 MB in all, cut outside the lock, never written twice; the writer knows itself when stopped
The lines kept while files can't be written are cut to their share of 64 MB before the lock the simulation waits on. A log written in part is cut back to its length, so the next try doesn't write its start twice. A stop from the writer itself is told by its id even after another thread took it to join, and the watchdog's flush waits at most its time, the writing on a thread of its own.
This commit is contained in:
@@ -421,9 +421,8 @@ void blackbox_recorder::write_cab() {
|
||||
// of the wheels as they turn, which the speedometer shows: apart from that of the vehicle when they slip or skid.
|
||||
// those of the powered vehicle, as the speedometer has it (TTrain::DynamicSet), which in a unit driven from an
|
||||
// unpowered car is another one, maybe facing the other way: signed as the occupied one's speed
|
||||
auto *powered{train->Dynamic()->FindPowered()};
|
||||
if (powered == nullptr)
|
||||
powered = train->Dynamic();
|
||||
// the vehicle itself, if none in the unit is powered
|
||||
auto const *powered{train->Dynamic()->FindPowered()};
|
||||
auto const facing{powered->DirectionGet() * vehicle->DirectionGet()};
|
||||
sample.wheel_speed_kmh = static_cast<float>(facing * M_PI * powered->MoverParameters->WheelDiameter * powered->MoverParameters->nrot * 3.6);
|
||||
sample.acceleration = static_cast<float>(controlling->AccS);
|
||||
|
||||
Reference in New Issue
Block a user