SuperTuxKart
|
A class that stores a game state and can rewind it. More...
#include <rewind_info.hpp>
Public Member Functions | |
RewindInfoState (int ticks, int start_offset, std::vector< std::string > &rewinder_using, std::vector< uint8_t > &buffer) | |
RewindInfoState (int ticks, BareNetworkString *buffer, bool is_confirmed) | |
Constructor used only in unit testing (without list of rewinder using). | |
virtual void | restore () |
Rewinds to this state. | |
BareNetworkString * | getBuffer () const |
Returns a pointer to the state buffer. | |
virtual bool | isState () const |
If this RewindInfo is an event. | |
virtual void | undo () |
Called when going back in time to undo any rewind information. | |
virtual void | replay () |
Called when rewinding from a past state to 'now'. | |
Public Member Functions inherited from RewindInfo | |
RewindInfo (int ticks, bool is_confirmed) | |
Constructor for a state: it only takes the size, and allocates a buffer for all state info. | |
void | setTicks (int ticks) |
Adjusts the time of this RewindInfo. | |
virtual void | undo ()=0 |
Called when going back in time to undo any rewind information. | |
virtual void | restore ()=0 |
This is called to restore a state before replaying the events. | |
virtual void | replay ()=0 |
This is called while going forwards in time again to reach current time. | |
int | getTicks () const |
Returns the time at which this RewindInfo was saved. | |
void | setConfirmed (bool b) |
Sets if this RewindInfo is confirmed or not. | |
bool | isConfirmed () const |
Returns if this RewindInfo is confirmed. | |
virtual bool | isEvent () const |
If this RewindInfo is an event. | |
virtual bool | isState () const |
If this RewindInfo is an event. | |
Private Attributes | |
std::vector< std::string > | m_rewinder_using |
int | m_start_offset |
BareNetworkString * | m_buffer |
Pointer to the buffer which stores all states. | |
A class that stores a game state and can rewind it.
|
inlinevirtual |
|
inlinevirtual |
Called when rewinding from a past state to 'now'.
This should never be called for a state (a state calles restore()).
Implements RewindInfo.
|
virtual |
Rewinds to this state.
This is called while going forwards in time again to reach current time. It will call rewindToState(). if the state is a confirmed state.
Implements RewindInfo.
|
inlinevirtual |
Called when going back in time to undo any rewind information.
It calls undoState in the rewinder.
Implements RewindInfo.