18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-03 08:55:22 +01:00

feat(simulation): snapshot of time, weather, cells, switches and events (L1)

--snapshot-at <seconds> <file> writes a snapshot when the simulation has run
that long, --load-snapshot <file> puts one over the scenery once it has loaded,
before the first frame. This layer keeps the clock and the simulation timer,
the weather with the wind, the random engine, the memory cells, the switches,
the tracks an event can change and the ones made on the run, the traction
power sources, the event queue, the timers of the launchers and the lamps of
the signals.

While a snapshot is put back the event manager is suspended, so nothing in the
scenery reacts to it. Existing classes only get accessors for what was private
(the fraction of the second, launcher timers, the speed limit of a track, the
wind, the state of a power source, the event queue). Without the switches
nothing changes.
This commit is contained in:
jerrrrycho
2026-11-19 06:49:15 +01:00
parent d757866e37
commit 2953bedafa
17 changed files with 1014 additions and 1 deletions
+17
View File
@@ -226,6 +226,23 @@ world_environment::update_moon() {
m_moon.update( true );
}
std::array<float, 8>
world_environment::wind_state() const {
return { m_wind.azimuth, m_wind.azimuth_change, m_wind.velocity, m_wind.velocity_change, m_wind.change_time, m_wind.vector.x, m_wind.vector.y, m_wind.vector.z };
}
void
world_environment::wind_state( std::array<float, 8> const &State ) {
m_wind.azimuth = State[ 0 ];
m_wind.azimuth_change = State[ 1 ];
m_wind.velocity = State[ 2 ];
m_wind.velocity_change = State[ 3 ];
m_wind.change_time = State[ 4 ];
m_wind.vector = { State[ 5 ], State[ 6 ], State[ 7 ] };
}
void
world_environment::update_wind() {