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

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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  MPPlayer
 
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 unsigned long NextLogCycle
 Replay log file. 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

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
static void ApplyReplaySettings ( )
static

Applies settings the game used at the start of the replay

static int CclLog ( lua_State *  l)
static

Parse log

static int CclReplayLog ( lua_State *  l)
static

Parse replay-log

void CleanReplayLog ( )

Clean replay.

Clean replay log

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
static void DeleteReplay ( FullReplay replay)
static

Free a replay from memory

Parameters
replayPointer to the replay to be freed
static void DoNextReplay ( )
static

Do next replay

void EndReplayLog ( )

End logging.

End logging

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

Check if we're replaying a game

int LoadReplay ( const std::string &  name)

Load replay.

Load a log file to replay a game

Parameters
namename of file to load.
void MultiPlayerReplayEachCycle ( )

Replay user commands from log each cycle, multiplayer games.

Replay user commands from log each cycle, multiplayer games

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

Register ccl functions related to network.

Register Ccl functions with lua

static void ReplayEachCycle ( )
static

Replay user commands from log each cycle

static void SaveFullLog ( CFile file)
static

Output the FullReplay list to file

Parameters
fileThe file to output to
int SaveReplay ( const std::string &  filename)

Save the replay

Parameters
filenameName of the file to save to
Returns
0 for success, -1 for failure
void SaveReplayList ( CFile file)

Save the replay list to file.

Save generated replay

Parameters
filefile to save to.
void SinglePlayerReplayEachCycle ( )

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

Replay user commands from log each cycle, single player games

void StartMap ( const std::string &  filename,
bool  clean 
)
static FullReplay* StartReplay ( )
static

Allocate & fill a new FullReplay structure, from GameSettings.

Returns
A new FullReplay structure
void StartReplay ( const std::string &  filename,
bool  reveal 
)

Variable Documentation

bool CommandLogDisabled
FullReplay* CurrentReplay
static

Initialize replay.

bool DisabledLog
static

Replay game type.

int InitReplay
static

Next log cycle number.

CFile* LogFile
static

Disabled log for replay.

unsigned long NextLogCycle
static

Replay log file.

ReplayType ReplayGameType

True if command log is off.

True, if command log is off.

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.