mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-03 10:05:23 +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:
@@ -193,6 +193,13 @@ void scenario_time::set_time(int yearday, int minute) {
|
||||
m_time.wMinute = minute % 60;
|
||||
}
|
||||
|
||||
void scenario_time::restore( SYSTEMTIME const &Time, double const Milliseconds ) {
|
||||
m_time = Time;
|
||||
m_milliseconds = Milliseconds;
|
||||
m_time.wMilliseconds = static_cast<uint16_t>( std::floor( m_milliseconds ) );
|
||||
m_yearday = year_day( m_time.wDay, m_time.wMonth, m_time.wYear );
|
||||
}
|
||||
|
||||
// calculates day of week for provided date
|
||||
int
|
||||
scenario_time::day_of_week( int const Day, int const Month, int const Year ) const {
|
||||
|
||||
Reference in New Issue
Block a user