diff options
Diffstat (limited to 'Museum.cpp')
-rw-r--r-- | Museum.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -20,14 +20,30 @@ void Museum::update() { this->canvas.update(); } +void Museum::time_jump(long offset) { + if (offset >= 0) { + this->jump = offset; + return; + } + + +} + void Museum::work() { while (this->working) { - if (this->paused) continue; // wait if paused + // immediately process forward jumps, even if paused + if (this->jump > 0) { + while (--this->jump > 0) + this->update(); + } + + // wait with regular update if paused + if (this->paused) continue; + // regular update auto next = chrono::steady_clock::now() + this->tick_interval; this->update(); this_thread::sleep_until(next); - this->tick++; } } |