SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
RewindInfo Class Referenceabstract

Used to store rewind information for a given time for all rewind instances. More...

#include <rewind_info.hpp>

Inheritance diagram for RewindInfo:
Inheritance graph
[legend]

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.
 
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 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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ RewindInfo()

RewindInfo::RewindInfo ( int  ticks,
bool  is_confirmed 
)

Constructor for a state: it only takes the size, and allocates a buffer for all state info.

Parameters
sizeNecessary buffer size for a state.

Member Function Documentation

◆ isEvent()

virtual bool RewindInfo::isEvent ( ) const
inlinevirtual

If this RewindInfo is an event.

Subclasses will overwrite this.

Reimplemented in RewindInfoEvent, and RewindInfoEventFunction.

◆ isState()

virtual bool RewindInfo::isState ( ) const
inlinevirtual

If this RewindInfo is an event.

Subclasses will overwrite this.

Reimplemented in RewindInfoState.

◆ replay()

virtual void RewindInfo::replay ( )
pure virtual

This is called while going forwards in time again to reach current time.

Implemented in RewindInfoState, RewindInfoEvent, and RewindInfoEventFunction.

◆ restore()

virtual void RewindInfo::restore ( )
pure virtual

This is called to restore a state before replaying the events.

Implemented in RewindInfoState, RewindInfoEvent, and RewindInfoEventFunction.

◆ setTicks()

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.

◆ undo()

virtual void RewindInfo::undo ( )
pure virtual

Called when going back in time to undo any rewind information.

Implemented in RewindInfoState, RewindInfoEvent, and RewindInfoEventFunction.

Member Data Documentation

◆ m_is_confirmed

bool RewindInfo::m_is_confirmed
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.


The documentation for this class was generated from the following files: