_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

Classes
replay.cpp File Reference
#include "stratagus.h"
#include "replay.h"
#include "actions.h"
#include "commands.h"
#include "game.h"
#include "interface.h"
#include "iocompat.h"
#include "iolib.h"
#include "map.h"
#include "netconnect.h"
#include "network.h"
#include "parameters.h"
#include "player.h"
#include "script.h"
#include "settings.h"
#include "sound.h"
#include "translate.h"
#include "unit.h"
#include "unit_manager.h"
#include "unittype.h"
#include "version.h"
#include <sstream>
#include <time.h>

Classes

class  LogEntry
 
class  FullReplay
 

replay.cpp - Replay game.

bool CommandLogDisabled
 
ReplayType ReplayGameType
 True if command log is off. More...
 
static bool DisabledLog
 Replay game type. More...
 
static CFileLogFile
 Disabled log for replay. More...
 
static std::string LastLogFileName
 Replay log file. More...
 
static unsigned long NextLogCycle
 Last log file name. More...
 
static int InitReplay
 Next log cycle number. More...
 
static FullReplayCurrentReplay
 Initialize replay. More...
 
static LogEntryReplayStep
 
void ExpandPath (std::string &newpath, const std::string &path)
 
void StartMap (const std::string &filename, bool clean)
 
static FullReplayStartReplay ()
 
static void ApplyReplaySettings ()
 
static void DeleteReplay (FullReplay *replay)
 
static void PrintLogCommand (const LogEntry &log, CFile &file)
 
static void SaveFullLog (CFile &file)
 
static void AppendLog (LogEntry *log, CFile &file)
 
void CommandLog (const char *action, const CUnit *unit, int flush, int x, int y, const CUnit *dest, const char *value, int num)
 Replay game type. More...
 
static int CclLog (lua_State *l)
 
static int CclReplayLog (lua_State *l)
 
bool IsReplayGame ()
 
void SaveReplayList (CFile &file)
 Save the replay list to file. More...
 
int LoadReplay (const std::string &name)
 Load replay. More...
 
void EndReplayLog ()
 End logging. More...
 
void CleanReplayLog ()
 Clean replay. More...
 
static void DoNextReplay ()
 
static void ReplayEachCycle ()
 
void SinglePlayerReplayEachCycle ()
 Replay user commands from log each cycle, single player games. More...
 
void MultiPlayerReplayEachCycle ()
 Replay user commands from log each cycle, multiplayer games. More...
 
int SaveReplay (const std::string &filename)
 
void StartReplay (const std::string &filename, bool reveal)
 
void ReplayCclRegister ()
 Register ccl functions related to network. More...
 

Function Documentation

◆ AppendLog()

static void AppendLog ( LogEntry log,
CFile file 
)
static

Append the LogEntry structure at the end of currentLog, and to LogFile

Parameters
logPointer the replay log entry to be added
destThe file to output to

◆ ApplyReplaySettings()

static void ApplyReplaySettings ( )
static

Applies settings the game used at the start of the replay

◆ CclLog()

static int CclLog ( lua_State *  l)
static

Parse log

◆ CclReplayLog()

static int CclReplayLog ( lua_State *  l)
static

Parse replay-log

◆ CleanReplayLog()

void CleanReplayLog ( )

Clean replay.

Clean replay log

◆ CommandLog()

void CommandLog ( const char *  action,
const CUnit unit,
int  flush,
int  x,
int  y,
const CUnit dest,
const char *  value,
int  num 
)

Replay game type.

Log commands into file.

This could later be used to recover, crashed games.

Parameters
actionCommand name (move,attack,...).
unitUnit that receive the command.
flushAppend command or flush old commands.
xoptional X map position.
yoptional y map position.
destoptional destination unit.
valueoptional command argument (unit-type,...).
numoptional number argument

◆ DeleteReplay()

static void DeleteReplay ( FullReplay replay)
static

Free a replay from memory

Parameters
replayPointer to the replay to be freed

◆ DoNextReplay()

static void DoNextReplay ( )
static

Do next replay

◆ EndReplayLog()

void EndReplayLog ( )

End logging.

End logging

◆ ExpandPath()

void ExpandPath ( std::string &  newpath,
const std::string &  path 
)

◆ IsReplayGame()

bool IsReplayGame ( )

Check if we're replaying a game

◆ LoadReplay()

int LoadReplay ( const std::string &  name)

Load replay.

Load a log file to replay a game

Parameters
namename of file to load.

◆ MultiPlayerReplayEachCycle()

void MultiPlayerReplayEachCycle ( )

Replay user commands from log each cycle, multiplayer games.

Replay user commands from log each cycle, multiplayer games

◆ PrintLogCommand()

static void PrintLogCommand ( const LogEntry log,
CFile file 
)
static

◆ ReplayCclRegister()

void ReplayCclRegister ( )

Register ccl functions related to network.

Register Ccl functions with lua

◆ ReplayEachCycle()

static void ReplayEachCycle ( )
static

Replay user commands from log each cycle

◆ SaveFullLog()

static void SaveFullLog ( CFile file)
static

Output the FullReplay list to file

Parameters
fileThe file to output to

◆ SaveReplay()

int SaveReplay ( const std::string &  filename)

Save the replay

Parameters
filenameName of the file to save to
Returns
0 for success, -1 for failure

◆ SaveReplayList()

void SaveReplayList ( CFile file)

Save the replay list to file.

Save generated replay

Parameters
filefile to save to.

◆ SinglePlayerReplayEachCycle()

void SinglePlayerReplayEachCycle ( )

Replay user commands from log each cycle, single player games.

Replay user commands from log each cycle, single player games

◆ StartMap()

void StartMap ( const std::string &  filename,
bool  clean 
)

◆ StartReplay() [1/2]

static FullReplay* StartReplay ( )
static

Allocate & fill a new FullReplay structure, from GameSettings.

Returns
A new FullReplay structure

◆ StartReplay() [2/2]

void StartReplay ( const std::string &  filename,
bool  reveal 
)

Variable Documentation

◆ CommandLogDisabled

bool CommandLogDisabled

◆ CurrentReplay

FullReplay* CurrentReplay
static

Initialize replay.

◆ DisabledLog

bool DisabledLog
static

Replay game type.

◆ InitReplay

int InitReplay
static

Next log cycle number.

◆ LastLogFileName

std::string LastLogFileName
static

Replay log file.

◆ LogFile

CFile* LogFile
static

Disabled log for replay.

◆ NextLogCycle

unsigned long NextLogCycle
static

Last log file name.

◆ ReplayGameType

ReplayType ReplayGameType

True if command log is off.

True, if command log is off.

◆ ReplayStep

LogEntry* ReplayStep
static
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.