Pyrogenesis  trunk
Functions
VisualReplay Namespace Reference

Contains functions for visually replaying past games. More...

Functions

OsPath GetDirectoryName ()
 Returns the path to the sim-log directory (that contains the directories with the replay files. More...
 
void StartVisualReplay (const CStrW &directory)
 Replays the commands.txt file in the given subdirectory visually. More...
 
JS::Value GetReplays (ScriptInterface &scriptInterface)
 Get a list of replays to display in the GUI. More...
 
JS::Value LoadReplayData (ScriptInterface &scriptInterface, OsPath &directory)
 Parses a commands.txt file and extracts metadata. More...
 
bool DeleteReplay (const CStrW &replayFile)
 Permanently deletes the visual replay (including the parent directory) More...
 
JS::Value GetReplayAttributes (ScriptInterface::CxPrivate *pCxPrivate, const CStrW &directoryName)
 Returns the parsed header of the replay file (commands.txt). More...
 
bool HasReplayMetadata (const CStrW &directoryName)
 Returns whether or not the metadata / summary screen data has been saved properly when the game ended. More...
 
JS::Value GetReplayMetadata (ScriptInterface::CxPrivate *pCxPrivate, const CStrW &directoryName)
 Returns the metadata of a replay. More...
 
void SaveReplayMetadata (ScriptInterface *scriptInterface)
 Saves the metadata from the session to metadata.json. More...
 

Detailed Description

Contains functions for visually replaying past games.

Function Documentation

bool VisualReplay::DeleteReplay ( const CStrW &  replayFile)

Permanently deletes the visual replay (including the parent directory)

Parameters
replayFilepath to commands.txt, whose parent directory will be deleted
Returns
true if deletion was successful, false on error
OsPath VisualReplay::GetDirectoryName ( )

Returns the path to the sim-log directory (that contains the directories with the replay files.

Parameters
scriptInterfacethe ScriptInterface in which to create the return data.
Returns
OsPath the absolute file path
JS::Value VisualReplay::GetReplayAttributes ( ScriptInterface::CxPrivate pCxPrivate,
const CStrW &  directoryName 
)

Returns the parsed header of the replay file (commands.txt).

JS::Value VisualReplay::GetReplayMetadata ( ScriptInterface::CxPrivate pCxPrivate,
const CStrW &  directoryName 
)

Returns the metadata of a replay.

JS::Value VisualReplay::GetReplays ( ScriptInterface scriptInterface)

Get a list of replays to display in the GUI.

Load all replays found in the directory.

Parameters
scriptInterfacethe ScriptInterface in which to create the return data.
Returns
array of objects containing replay data

Since files are spread across the harddisk, loading hundreds of them can consume a lot of time.

bool VisualReplay::HasReplayMetadata ( const CStrW &  directoryName)

Returns whether or not the metadata / summary screen data has been saved properly when the game ended.

JS::Value VisualReplay::LoadReplayData ( ScriptInterface scriptInterface,
OsPath directory 
)

Parses a commands.txt file and extracts metadata.

Works similarly to CGame::LoadReplayData().

void VisualReplay::SaveReplayMetadata ( ScriptInterface scriptInterface)

Saves the metadata from the session to metadata.json.

void VisualReplay::StartVisualReplay ( const CStrW &  directory)

Replays the commands.txt file in the given subdirectory visually.