|
SuperTuxKart
|
Used to store rewind information for a given time for all rewind instances. More...
#include <rewind_info.hpp>

Public Member Functions | |
| RewindInfo (int ticks, bool is_confirmed) | |
| Constructor for a state: it only takes the size, and allocates a buffer for all state info. More... | |
| void | setTicks (int ticks) |
| Adjusts the time of this RewindInfo. More... | |
| 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. More... | |
| virtual bool | isState () const |
| If this RewindInfo is an event. More... | |
Private Member Functions | |
| LEAK_CHECK () | |
Private Attributes | |
| int | m_ticks |
| Time when this RewindInfo was taken. | |
| bool | m_is_confirmed |
| A confirmed event is one that was sent from the server. More... | |
Used to store rewind information for a given time for all rewind instances.
Rewind information can either be a state (for example a kart would have position, rotation, linear and angular velocity, ... as state), or an event (for a kart that would be pressing or releasing of a key). State changes and events can be delivered in different frequencies, and might be released (to save memory) differently: A state can be reproduced from a previous state by replaying the simulation taking all events into account.
| RewindInfo::RewindInfo | ( | int | ticks, |
| bool | is_confirmed | ||
| ) |
Constructor for a state: it only takes the size, and allocates a buffer for all state info.
| size | Necessary buffer size for a state. |
|
inlinevirtual |
If this RewindInfo is an event.
Subclasses will overwrite this.
Reimplemented in RewindInfoEventFunction, and RewindInfoEvent.
|
inlinevirtual |
| void RewindInfo::setTicks | ( | int | ticks | ) |
Adjusts the time of this RewindInfo.
This is only called on the server in case that an event is received in the past - in this case the server needs to avoid a Rewind by moving this event forward to the current time.
|
private |
A confirmed event is one that was sent from the server.
When rewinding we have to start with a confirmed state for each object.