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

feat(blackbox): the black box on its own, writing the tapes of the user's vehicles at the end

"blackbox yes" in eu07.ini records the black box with the physics logs on or off, "blackbox no" never;
with no entry it goes with "physicslog yes" as before. With the physics logs off, the recorder keeps the
line of the physics log of the driver the user is with, every 0.05 s, and writes it to
physicslog/<vehicle>.dat when the recording closes: the speed recorder's tape of the vehicles the user
was in, without every vehicle keeping a log open and written twenty times a second.

The line and the header of the log are made by one function of the driver, which its own log writes
too, and the file is opened the same way, so the two are the same to the byte: the readers of these
logs (the old Hasler tape viewer, the starter) read them as before.
This commit is contained in:
maj00r
2026-11-14 00:04:55 +01:00
parent 0488519f39
commit 5ca2f7e38f
7 changed files with 126 additions and 54 deletions

View File

@@ -15,6 +15,7 @@ http://mozilla.org/MPL/2.0/.
#include <chrono>
#include <cstdint>
#include <fstream>
#include <map>
#include <memory>
#include <mutex>
#include <string>
@@ -86,6 +87,10 @@ private:
void write_map();
static std::vector<std::pair<glm::dvec3, float>> stop_point_headings();
void write_cab();
// with the physics logs off, the line of the log of the driver the user is with, kept for the end
void keep_tape_line();
// the kept lines, each driver's to its log, physicslog/<vehicle>.dat, as the physics logs would have it
void write_tapes();
// the clock, the user's vehicle, the vehicles, the switches and the signals
void look_around(bool Keyframe);
void look_at_vehicles(bool Keyframe);
@@ -109,6 +114,9 @@ private:
bool m_started{false}; // tried to start, made or not
double m_time{0.0};
double m_cabdue{0.0};
double m_tapedue{0.0};
// the lines of the physics log by the name of its file, of the times the user was with its driver
std::map<std::string, std::string> m_tapes;
double m_lookdue{0.0};
double m_keyframedue{0.0};
std::unordered_map<TDynamicObject const *, vehicle_entry> m_vehicles;