18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-20 15:04:58 +01:00

fix(blackbox): the tapes go on after the editor, with the physics logs off

The tapes of the user's vehicles were written by update() after the check for the writer of the
recording, which close() drops on entering the editor (F11). With "physicslog no", the speed recorder's
tape ended at F11 while the drivers' own logs of "physicslog yes" went on.

The tapes are files of their own: they are kept from the moment the recording was to be made, the file
made or not, closed or not, until the simulator closes, after the gap of the time in the editor.
Only the recording itself stops at F11, as before.

Reported in the review of #385.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maj00r
2026-11-16 12:47:22 +01:00
parent 99b93abd64
commit 5498995672
3 changed files with 16 additions and 9 deletions

View File

@@ -238,22 +238,26 @@ void blackbox_recorder::update(double const Deltatime) {
// "blackbox yes" or "no" of eu07.ini decides by itself, with no entry it goes with the physics logs
if (false == Global.BlackBox.value_or(WriteLogFlag || WriteTrainLogFlag) || Global.editor_session)
return;
m_taping = true;
open();
}
if (m_writer == nullptr)
if (false == m_taping)
return;
std::scoped_lock lock{m_mutex};
m_time += Deltatime;
if (m_time >= m_cabdue) {
write_cab();
m_cabdue = std::max(m_cabdue + cabinterval, m_time);
}
// with the physics logs on, each driver writes its own all the time
// with the physics logs on, each driver writes its own all the time. the tapes are files of their own: they go on
// after the recording ends in the editor, and with a recording which couldn't be made
if (false == WriteLogFlag && m_time >= m_tapedue) {
keep_tape_line();
m_tapedue = std::max(m_tapedue + tapeinterval, m_time);
}
if (m_writer == nullptr)
return;
if (m_time >= m_cabdue) {
write_cab();
m_cabdue = std::max(m_cabdue + cabinterval, m_time);
}
if (m_time >= m_cameradue) {
write_camera();
m_cameradue = std::max(m_cameradue + camerainterval, m_time);