SuperTuxKart
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
History Class Reference

Classes

struct  InputEvent
 

Public Member Functions

 History ()
 Initialises the history object and sets the mode to none.
 
void initRecording ()
 Initialise the history for a new recording.
 
void Save ()
 Saves the history stored in the internal data structures into a file called history.dat.
 
void Load ()
 Loads a history from history.dat in the current directory.
 
void updateReplay (int world_ticks)
 Sets the kart position and controls to the recorded history value.
 
void addEvent (int kart_id, PlayerAction pa, int value)
 Stores an input event (e.g.
 
const std::string & getKartIdent (unsigned int n)
 Returns the identifier of the n-th kart.
 
bool replayHistory () const
 Returns if a history is replayed, i.e.
 
void setReplayHistory (bool b)
 Set if replay is enabled or not.
 

Static Public Attributes

static bool m_online_history_replay = false
 

Private Member Functions

void allocateMemory (int size=-1)
 Allocates memory for the history.
 

Private Attributes

bool m_replay_history
 True if a history should be replayed,.
 
unsigned int m_event_index
 Points to the last used input event index.
 
std::vector< std::string > m_kart_ident
 The identities of the karts to use.
 
std::vector< InputEventm_all_input_events
 All input events.
 

Member Function Documentation

◆ addEvent()

void History::addEvent ( int  kart_id,
PlayerAction  pa,
int  value 
)

Stores an input event (e.g.

acceleration or steering event) into the history data for physics replay.

Parameters
kart_idThe kart index which triggered the event.
paThe action.
valueValue of the action (0=release, 32768 = pressed), in between in case of analog devices.

◆ allocateMemory()

void History::allocateMemory ( int  size = -1)
private

Allocates memory for the history.

This is used when recording as well as when replaying (since in replay the data is read into memory first).

Parameters
number_of_framesMaximum number of frames to store.

◆ initRecording()

void History::initRecording ( )

Initialise the history for a new recording.

It especially allocates memory to store the history.

◆ replayHistory()

bool History::replayHistory ( ) const
inline

Returns if a history is replayed, i.e.

the history mode is not none.

◆ updateReplay()

void History::updateReplay ( int  world_ticks)

Sets the kart position and controls to the recorded history value.

Parameters
world_ticksWOrld time in ticks.
ticksNumber of time steps.

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