Pyrogenesis  trunk
Functions | Variables
VisualReplay.cpp File Reference
#include "precompiled.h"
#include "VisualReplay.h"
#include "graphics/GameView.h"
#include "gui/GUIManager.h"
#include "lib/allocators/shared_ptr.h"
#include "lib/external_libraries/libsdl.h"
#include "lib/utf8.h"
#include "network/NetClient.h"
#include "network/NetServer.h"
#include "ps/CLogger.h"
#include "ps/Filesystem.h"
#include "ps/Game.h"
#include "ps/GameSetup/Paths.h"
#include "ps/Mod.h"
#include "ps/Pyrogenesis.h"
#include "ps/Replay.h"
#include "ps/Util.h"
#include "scriptinterface/ScriptInterface.h"
Include dependency graph for VisualReplay.cpp:

Functions

int goBackToLineBeginning (std::istream *replayStream, const CStr &fileName, const u64 &fileSize)
 Move the cursor backwards until a newline was read or the beginning of the file was found. More...
 
int getReplayDuration (std::istream *replayStream, const CStr &fileName, const u64 &fileSize)
 Compute game duration in seconds. More...
 

Variables

const u8 minimumReplayDuration = 3
 Filter too short replays (value in seconds). More...
 

Function Documentation

int getReplayDuration ( std::istream *  replayStream,
const CStr &  fileName,
const u64 fileSize 
)
inline

Compute game duration in seconds.

Assume constant turn length. Find the last line that starts with "turn" by reading the file backwards.

Returns
seconds or -1 on error
int goBackToLineBeginning ( std::istream *  replayStream,
const CStr &  fileName,
const u64 fileSize 
)
inline

Move the cursor backwards until a newline was read or the beginning of the file was found.

Either way the cursor points to the beginning of a newline.

Returns
The current cursor position or -1 on error.

Variable Documentation

const u8 minimumReplayDuration = 3

Filter too short replays (value in seconds).