diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-25 17:26:20 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-25 17:26:20 +0200 |
commit | b31d7a677481b4a09168c43d203bfd6d7badf577 (patch) | |
tree | 13550fa7f33d21aea8a7b03981707db2c08fc9a2 /Museum.h | |
parent | c9f5ac8722190efeb58fda1eec9e6160d5204127 (diff) |
implement mementos snapshots
Diffstat (limited to 'Museum.h')
-rw-r--r-- | Museum.h | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -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 &); }; |