diff options
Diffstat (limited to 'src/crepe')
-rw-r--r-- | src/crepe/Component.cpp | 3 | ||||
-rw-r--r-- | src/crepe/api/Script.cpp | 21 | ||||
-rw-r--r-- | src/crepe/api/Script.h | 18 | ||||
-rw-r--r-- | src/crepe/manager/ReplayManager.h | 5 | ||||
-rw-r--r-- | src/crepe/system/ReplaySystem.h | 2 |
5 files changed, 46 insertions, 3 deletions
diff --git a/src/crepe/Component.cpp b/src/crepe/Component.cpp index 8086492..1aed507 100644 --- a/src/crepe/Component.cpp +++ b/src/crepe/Component.cpp @@ -5,7 +5,8 @@ using namespace std; Component::Component(game_object_id_t id) : game_object_id(id) {} -Component & Component::operator=(const Component &) { +Component & Component::operator=(const Component & other) { + this->active = other.active; return *this; } diff --git a/src/crepe/api/Script.cpp b/src/crepe/api/Script.cpp index 753a9e3..8b95cc9 100644 --- a/src/crepe/api/Script.cpp +++ b/src/crepe/api/Script.cpp @@ -25,3 +25,24 @@ void Script::set_next_scene(const string & name) { } SaveManager & Script::get_save_manager() const { return this->mediator->save_manager; } + +void Script::replay::record_start() { + ReplayManager & mgr = this->mediator->replay_manager; + return mgr.record_start(); +} + +recording_t Script::replay::record_end() { + ReplayManager & mgr = this->mediator->replay_manager; + return mgr.record_end(); +} + +void Script::replay::play(recording_t recording) { + ReplayManager & mgr = this->mediator->replay_manager; + return mgr.play(recording); +} + +void Script::replay::release(recording_t recording) { + ReplayManager & mgr = this->mediator->replay_manager; + return mgr.release(recording); +} + diff --git a/src/crepe/api/Script.h b/src/crepe/api/Script.h index 668e5d1..c797db0 100644 --- a/src/crepe/api/Script.h +++ b/src/crepe/api/Script.h @@ -2,6 +2,7 @@ #include <vector> +#include "../manager/ReplayManager.h" #include "../manager/EventManager.h" #include "../manager/Mediator.h" #include "../system/CollisionSystem.h" @@ -135,6 +136,23 @@ protected: //! Retrieve SaveManager reference SaveManager & get_save_manager() const; + //! Replay management functions + struct replay { // NOLINT + //! \copydoc ReplayManager::record_start + void record_start(); + //! \copydoc ReplayManager::record_end + recording_t record_end(); + //! \copydoc ReplayManager::play + void play(recording_t); + //! \copydoc ReplayManager::release + void release(recording_t); + + private: + OptionalRef<Mediator> & mediator; + replay(OptionalRef<Mediator> & mediator) : mediator(mediator) {} + friend class Script; + } replay{mediator}; + //! \} private: diff --git a/src/crepe/manager/ReplayManager.h b/src/crepe/manager/ReplayManager.h index 5794761..7be18f3 100644 --- a/src/crepe/manager/ReplayManager.h +++ b/src/crepe/manager/ReplayManager.h @@ -12,7 +12,12 @@ class ReplaySystem; typedef size_t recording_t; +/** + * \brief Replay manager + * + */ class ReplayManager : public Manager { + // TODO: Delete recordings at end of scene public: ReplayManager(Mediator & mediator); diff --git a/src/crepe/system/ReplaySystem.h b/src/crepe/system/ReplaySystem.h index 6f6fce4..919c554 100644 --- a/src/crepe/system/ReplaySystem.h +++ b/src/crepe/system/ReplaySystem.h @@ -15,8 +15,6 @@ public: private: ReplayManager::State last_state = ReplayManager::IDLE; - void update_recording(); - void update_playing(); struct Snapshot { ComponentManager::Snapshot components; |