aboutsummaryrefslogtreecommitdiff
path: root/Museum.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-25 17:26:20 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-25 17:26:20 +0200
commitb31d7a677481b4a09168c43d203bfd6d7badf577 (patch)
tree13550fa7f33d21aea8a7b03981707db2c08fc9a2 /Museum.h
parentc9f5ac8722190efeb58fda1eec9e6160d5204127 (diff)
implement mementos snapshots
Diffstat (limited to 'Museum.h')
-rw-r--r--Museum.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/Museum.h b/Museum.h
index 27e7915..bc5b590 100644
--- a/Museum.h
+++ b/Museum.h
@@ -2,6 +2,7 @@
#include <thread>
#include <chrono>
+#include <stack>
#include "People.h"
#include "Canvas.h"
@@ -28,7 +29,7 @@ public:
void skip_backward();
private:
- unsigned long jump = 0;
+ int jump = 0;
private:
bool working = true;
@@ -37,7 +38,16 @@ private:
private:
unsigned long long tick = 0;
- static constexpr unsigned snapshot_ticks = 50;
static constexpr std::chrono::milliseconds tick_interval = 15ms;
+
+private:
+ static constexpr unsigned snapshot_ticks = 50;
+ struct Snapshot {
+ unsigned long long tick;
+ Memories memories;
+ };
+ std::stack<Snapshot, std::vector<Snapshot>> history;
+ Snapshot save_snapshot();
+ void restore_snapshot(const Snapshot &);
};