SuperTuxKart
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ReplayRecorder Class Reference
Inheritance diagram for ReplayRecorder:
Inheritance graph
[legend]

Public Member Functions

void init ()
 Initialise the replay recorder. More...
 
void reset ()
 Reset the replay recorder. More...
 
void save ()
 Saves the replay data stored in the internal data structures.
 
void update (int ticks)
 Saves the current replay data. More...
 
const uint64_t getLastUID ()
 
virtual const std::string & getReplayFilename (int replay_file_number=1) const
 Returns the filename that was opened. More...
 

Static Public Member Functions

static int enumToCode (Attachment::AttachmentType type)
 Functions to encode and decode attahcments and item types, so that the stored value is independent from internal representation and resilient to such changes. More...
 
static int enumToCode (PowerupManager::PowerupType type)
 
static Attachment::AttachmentType codeToEnumAttach (int code)
 
static PowerupManager::PowerupType codeToEnumItem (int code)
 
static void create ()
 Creates a new instance of the replay object. More...
 
static ReplayRecorderget ()
 Returns the instance of the replay object. More...
 
static void destroy ()
 Delete the instance of the replay object. More...
 

Private Member Functions

uint64_t computeUID (float min_time)
 Compute the replay's UID ; partly based on race data ; partly randomly.
 
 ReplayRecorder ()
 Initialises the Replay engine.
 
 ~ReplayRecorder ()
 Frees all stored data. More...
 

Private Attributes

std::string m_filename
 
std::vector< std::vector< TransformEvent > > m_transform_events
 A separate vector of Replay Events for all transforms. More...
 
std::vector< std::vector< PhysicInfo > > m_physic_info
 A separate vector of Replay Events for all physic info. More...
 
std::vector< std::vector< BonusInfo > > m_bonus_info
 A separate vector of Replay Events for all item/nitro info. More...
 
std::vector< std::vector< KartReplayEvent > > m_kart_replay_event
 A separate vector of Replay Events for all other events. More...
 
std::vector< float > m_last_saved_time
 Time at which a transform was saved for the last time. More...
 
std::vector< unsigned int > m_count_transforms
 Counts the number of transform events for each kart. More...
 
bool m_complete_replay
 
bool m_incorrect_replay
 
unsigned int m_max_frames
 
float m_previous_steer = 0.0f
 
const float DISTANCE_FAST_UPDATES = 10.0f
 
const float DISTANCE_MAX_UPDATES = 1.0f
 
uint64_t m_last_uid
 

Static Private Attributes

static ReplayRecorderm_replay_recorder = NULL
 Static pointer to the one instance of the replay object. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ReplayBase
FILE * openReplayFile (bool writeable, bool full_path=false, int replay_file_number=1)
 Opens a replay file which is determined by sub classes. More...
 
unsigned int getCurrentReplayVersion () const
 Returns the version number of the replay file recorderd by this executable. More...
 
unsigned int getMinSupportedReplayVersion () const
 This is used to check that a loaded replay file can still be understood by this executable. More...
 

Constructor & Destructor Documentation

◆ ~ReplayRecorder()

ReplayRecorder::~ReplayRecorder ( )
private

Frees all stored data.

Member Function Documentation

◆ create()

static void ReplayRecorder::create ( )
inlinestatic

Creates a new instance of the replay object.

◆ destroy()

static void ReplayRecorder::destroy ( )
inlinestatic

Delete the instance of the replay object.

◆ enumToCode()

int ReplayRecorder::enumToCode ( Attachment::AttachmentType  type)
static

Functions to encode and decode attahcments and item types, so that the stored value is independent from internal representation and resilient to such changes.

◆ get()

static ReplayRecorder* ReplayRecorder::get ( )
inlinestatic

Returns the instance of the replay object.

Returns NULL if no recorder is available, i.e. recording can be disabled.

◆ getReplayFilename()

virtual const std::string& ReplayRecorder::getReplayFilename ( int  replay_file_number = 1) const
inlinevirtual

Returns the filename that was opened.

Implements ReplayBase.

◆ init()

void ReplayRecorder::init ( )

Initialise the replay recorder.

It especially allocates memory to store the replay data.

◆ reset()

void ReplayRecorder::reset ( )

Reset the replay recorder.

◆ update()

void ReplayRecorder::update ( int  ticks)

Saves the current replay data.

Parameters
ticksNumber of physics time steps - should be 1.

Member Data Documentation

◆ m_bonus_info

std::vector< std::vector<BonusInfo> > ReplayRecorder::m_bonus_info
private

A separate vector of Replay Events for all item/nitro info.

◆ m_count_transforms

std::vector<unsigned int> ReplayRecorder::m_count_transforms
private

Counts the number of transform events for each kart.

◆ m_kart_replay_event

std::vector< std::vector<KartReplayEvent> > ReplayRecorder::m_kart_replay_event
private

A separate vector of Replay Events for all other events.

◆ m_last_saved_time

std::vector<float> ReplayRecorder::m_last_saved_time
private

Time at which a transform was saved for the last time.

◆ m_physic_info

std::vector< std::vector<PhysicInfo> > ReplayRecorder::m_physic_info
private

A separate vector of Replay Events for all physic info.

◆ m_replay_recorder

ReplayRecorder * ReplayRecorder::m_replay_recorder = NULL
staticprivate

Static pointer to the one instance of the replay object.

◆ m_transform_events

std::vector< std::vector<TransformEvent> > ReplayRecorder::m_transform_events
private

A separate vector of Replay Events for all transforms.


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