Pyrogenesis  trunk
Functions | Variables
VisualReplay.cpp File Reference
#include "precompiled.h"
#include "VisualReplay.h"
#include "graphics/GameView.h"
#include "lib/timer.h"
#include "lib/utf8.h"
#include "lib/allocators/shared_ptr.h"
#include "lib/file/file_system.h"
#include "lib/external_libraries/libsdl.h"
#include "network/NetClient.h"
#include "network/NetServer.h"
#include "ps/CLogger.h"
#include "ps/Filesystem.h"
#include "ps/Game.h"
#include "ps/GameSetup/CmdLineArgs.h"
#include "ps/GameSetup/Paths.h"
#include "ps/Mod.h"
#include "ps/Pyrogenesis.h"
#include "ps/Replay.h"
#include "ps/Util.h"
#include "scriptinterface/JSON.h"
#include <fstream>
Include dependency graph for VisualReplay.cpp:

Functions

off_t goBackToLineBeginning (std::istream *replayStream, const OsPath &fileName, off_t 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 OsPath &fileName, off_t fileSize)
 Compute game duration in seconds. More...
 

Variables

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

Function Documentation

◆ getReplayDuration()

int getReplayDuration ( std::istream *  replayStream,
const OsPath fileName,
off_t  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

◆ goBackToLineBeginning()

off_t goBackToLineBeginning ( std::istream *  replayStream,
const OsPath fileName,
off_t  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

◆ minimumReplayDuration

const u8 minimumReplayDuration = 3

Filter too short replays (value in seconds).