19#ifndef HEADER_REWINDER_HPP
20#define HEADER_REWINDER_HPP
30enum RewinderName :
char
32 RN_ITEM_MANAGER = 0x01,
40 RN_PHYSICAL_OBJ = 0x09
43class Rewinder :
public std::enable_shared_from_this<Rewinder>
106 virtual std::function<void()> getLocalStateRestoreFunction()
109 const std::string& getUniqueIdentity()
const
117 template<
typename T> std::shared_ptr<T> getShared()
118 {
return std::dynamic_pointer_cast<T>(shared_from_this()); }
Describes a chain of 8-bit unsigned integers.
Definition: network_string.hpp:53
Definition: rewinder.hpp:44
virtual void saveTransform()=0
Called before a rewind.
virtual void undoState(BareNetworkString *buffer)=0
Undo the effects of the given state, but do not rewind to that state (which is done by rewindTo).
virtual BareNetworkString * saveState(std::vector< std::string > *ru)=0
Provides a copy of the state of the object in one memory buffer.
virtual void reset()
Nothing to do here.
Definition: rewinder.hpp:104
bool rewinderAdd()
Add this object to the list of all rewindable objects in the rewind manager.
Definition: rewinder.cpp:27
virtual void rewindToEvent(BareNetworkString *buffer)=0
Called when an event needs to be replayed.
virtual void undoEvent(BareNetworkString *buffer)=0
Called when an event needs to be undone.
std::string m_unique_identity
Currently it has 2 usages:
Definition: rewinder.hpp:57
virtual void computeError()=0
Called when a rewind is finished, and is used to compute the error caused by the rewind (which is the...
virtual void restoreState(BareNetworkString *buffer, int count)=0
Called when a state needs to be replayed.