aboutsummaryrefslogtreecommitdiff
path: root/Museum.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Museum.cpp')
-rw-r--r--Museum.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/Museum.cpp b/Museum.cpp
index 0003162..df9144a 100644
--- a/Museum.cpp
+++ b/Museum.cpp
@@ -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++;
}
}