SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | List of all members
DummyRewinder Class Reference

A dummy Rewinder and EventRewinder class for unit testing and handle undo destruction of projectiles. More...

#include <dummy_rewinder.hpp>

Inheritance diagram for DummyRewinder:
Inheritance graph
[legend]

Public Member Functions

BareNetworkStringsaveState (std::vector< std::string > *ru)
 Provides a copy of the state of the object in one memory buffer.
 
virtual void undoEvent (BareNetworkString *s)
 Called when an event needs to be undone.
 
virtual void rewindToEvent (BareNetworkString *s)
 Called when an event needs to be replayed.
 
virtual void restoreState (BareNetworkString *s, int count)
 Called when a state needs to be replayed.
 
virtual void undoState (BareNetworkString *s)
 Undo the effects of the given state, but do not rewind to that state (which is done by rewindTo).
 
virtual void undo (BareNetworkString *s)
 Called when an event needs to be undone.
 
virtual void rewind (BareNetworkString *s)
 Called when an event needs to be replayed.
 
virtual void saveTransform ()
 Called before a rewind.
 
virtual void computeError ()
 Called when a rewind is finished, and is used to compute the error caused by the rewind (which is then visually smoothed over time).
 
- Public Member Functions inherited from Rewinder
 Rewinder (const std::string &ui="")
 
virtual void saveTransform ()=0
 Called before a rewind.
 
virtual void computeError ()=0
 Called when a rewind is finished, and is used to compute the error caused by the rewind (which is then visually smoothed over time).
 
virtual BareNetworkStringsaveState (std::vector< std::string > *ru)=0
 Provides a copy of the state of the object in one memory buffer.
 
virtual void undoEvent (BareNetworkString *buffer)=0
 Called when an event needs to be undone.
 
virtual void rewindToEvent (BareNetworkString *buffer)=0
 Called when an event needs to be replayed.
 
virtual void restoreState (BareNetworkString *buffer, int count)=0
 Called when a state needs to be replayed.
 
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 void reset ()
 Nothing to do here.
 
virtual std::function< void()> getLocalStateRestoreFunction ()
 
const std::string & getUniqueIdentity () const
 
bool rewinderAdd ()
 Add this object to the list of all rewindable objects in the rewind manager.
 
template<typename T >
std::shared_ptr< T > getShared ()
 
- Public Member Functions inherited from EventRewinder
 EventRewinder ()
 Constructor.
 
virtual ~EventRewinder ()
 Destructor.
 
virtual void undo (BareNetworkString *buffer)=0
 Called when an event needs to be undone.
 
virtual void rewind (BareNetworkString *buffer)=0
 Called when an event needs to be replayed.
 

Additional Inherited Members

- Protected Member Functions inherited from Rewinder
void setUniqueIdentity (const std::string &uid)
 

Detailed Description

A dummy Rewinder and EventRewinder class for unit testing and handle undo destruction of projectiles.

Member Function Documentation

◆ computeError()

virtual void DummyRewinder::computeError ( )
inlinevirtual

Called when a rewind is finished, and is used to compute the error caused by the rewind (which is then visually smoothed over time).

Implements Rewinder.

◆ restoreState()

virtual void DummyRewinder::restoreState ( BareNetworkString buffer,
int  count 
)
inlinevirtual

Called when a state needs to be replayed.

This is called during rewind, i.e. when going forward in time again, and only for confirmed states.

Implements Rewinder.

◆ rewind()

virtual void DummyRewinder::rewind ( BareNetworkString buffer)
inlinevirtual

Called when an event needs to be replayed.

This is called during rewind, i.e. when going forward in time again.

Implements EventRewinder.

◆ rewindToEvent()

virtual void DummyRewinder::rewindToEvent ( BareNetworkString buffer)
inlinevirtual

Called when an event needs to be replayed.

This is called during rewind, i.e. when going forward in time again.

Implements Rewinder.

◆ saveState()

BareNetworkString * DummyRewinder::saveState ( std::vector< std::string > *  ru)
inlinevirtual

Provides a copy of the state of the object in one memory buffer.

The memory is managed by the RewindManager.

Parameters
[out]ruThe unique identity of rewinder writing to.
Returns
The address of the memory buffer with the state.

Implements Rewinder.

◆ saveTransform()

virtual void DummyRewinder::saveTransform ( )
inlinevirtual

Called before a rewind.

Is used to save the previous position of an object before a rewind, so that the error due to a rewind can be computed.

Implements Rewinder.

◆ undo()

virtual void DummyRewinder::undo ( BareNetworkString buffer)
inlinevirtual

Called when an event needs to be undone.

This is called while going backwards for rewinding - all stored events will get an 'undo' call.

Implements EventRewinder.

◆ undoEvent()

virtual void DummyRewinder::undoEvent ( BareNetworkString buffer)
inlinevirtual

Called when an event needs to be undone.

This is called while going backwards for rewinding - all stored events will get an 'undo' call.

Implements Rewinder.

◆ undoState()

virtual void DummyRewinder::undoState ( BareNetworkString buffer)
inlinevirtual

Undo the effects of the given state, but do not rewind to that state (which is done by rewindTo).

This is called while going backwards for rewinding - all stored events will get an 'undo' call.

Implements Rewinder.


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