SuperTuxKart
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ReplayPlay Class Reference
Inheritance diagram for ReplayPlay:
Inheritance graph
[legend]

Classes

class  ReplayData
 

Public Types

enum  SortOrder {
  SO_DEFAULT , SO_TRACK = SO_DEFAULT , SO_REV , SO_KART_NUM ,
  SO_DIFF , SO_LAPS , SO_TIME , SO_USER ,
  SO_VERSION
}
 Order of sort for ReplayData.
 

Public Member Functions

void reset ()
 Resets all ghost karts back to start position.
 
void load ()
 
void loadFile (bool second_replay)
 
void loadAllReplayFile ()
 
void sortReplay (bool reverse)
 
void setReplayFile (unsigned int n)
 
void setSecondReplayFile (unsigned int n, bool second_replay_enabled)
 
void setReplayFileByUID (uint64_t uid)
 call getReplayIdByUID and set the current replay file to the first one with a matching UID.
 
unsigned int getReplayIdByUID (uint64_t uid)
 Search among replay file and return the first index with a matching UID.
 
bool addReplayFile (const std::string &fn, bool custom_replay=false, int call_index=0)
 
const ReplayDatagetReplayData (unsigned int n) const
 
const ReplayDatagetCurrentReplayData () const
 
const unsigned int getNumReplayFile () const
 
std::shared_ptr< GhostKartgetGhostKart (int n)
 
const unsigned int getNumGhostKart () const
 
const std::string & getGhostKartName (unsigned int n) const
 
virtual const std::string & getReplayFilename (int replay_file_number=1) const
 Returns the filename that was opened.
 
unsigned int getCurrentReplayFileIndex () const
 
unsigned int getSecondReplayFileIndex () const
 
bool isSecondReplayEnabled () const
 

Static Public Member Functions

static void setSortOrder (SortOrder so)
 
static void create ()
 Creates a new instance of the replay object.
 
static ReplayPlayget ()
 Returns the instance of the replay object.
 
static void destroy ()
 Delete the instance of the replay object.
 

Private Member Functions

 ReplayPlay ()
 Initialises the Replay engine.
 
 ~ReplayPlay ()
 Frees all stored data.
 
void readKartData (FILE *fd, char *next_line, bool second_replay)
 Reads all data from a replay file for a specific kart.
 

Private Attributes

unsigned int m_current_replay_file
 
unsigned int m_second_replay_file
 
bool m_second_replay_enabled
 
std::vector< ReplayDatam_replay_file_list
 
std::vector< std::shared_ptr< GhostKart > > m_ghost_karts
 All ghost karts.
 

Static Private Attributes

static ReplayPlaym_replay_play = NULL
 
static SortOrder m_sort_order = ReplayPlay::SO_DEFAULT
 

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.
 
virtual const std::string & getReplayFilename (int replay_file_number=1) const =0
 Returns the filename that was opened.
 
unsigned int getCurrentReplayVersion () const
 Returns the version number of the replay file recorderd by this executable.
 
unsigned int getMinSupportedReplayVersion () const
 This is used to check that a loaded replay file can still be understood by this executable.
 

Member Function Documentation

◆ getReplayFilename()

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

Returns the filename that was opened.

Implements ReplayBase.

◆ getReplayIdByUID()

unsigned int ReplayPlay::getReplayIdByUID ( uint64_t  uid)

Search among replay file and return the first index with a matching UID.

Parameters
uidThe UID to match

◆ readKartData()

void ReplayPlay::readKartData ( FILE *  fd,
char *  next_line,
bool  second_replay 
)
private

Reads all data from a replay file for a specific kart.

Parameters
fdThe file descriptor from which to read.

◆ setReplayFileByUID()

void ReplayPlay::setReplayFileByUID ( uint64_t  uid)

call getReplayIdByUID and set the current replay file to the first one with a matching UID.

Parameters
uidThe UID to match

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