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

src/game/replay.cpp File Reference

#include <time.h>
#include "stratagus.h"
#include "replay.h"
#include "iolib.h"
#include "iocompat.h"
#include "script.h"
#include "unittype.h"
#include "unit_manager.h"
#include "settings.h"
#include "commands.h"
#include "player.h"
#include "map.h"
#include "netconnect.h"
#include "network.h"
#include "interface.h"
#include "actions.h"

Classes

class  LogEntry
class  MPPlayer
class  FullReplay

replay.cpp - Replay game.

bool CommandLogDisabled
ReplayType ReplayGameType
 True if command log is off.
static bool DisabledLog
 Replay game type.
static CFileLogFile
 Disabled log for replay.
static unsigned long NextLogCycle
 Replay log file.
static int InitReplay
 Next log cycle number.
static FullReplayCurrentReplay
 Initialize replay.
static LogEntryReplayStep
static void AppendLog (LogEntry *log, CFile *dest)
static FullReplayStartReplay ()
static void ApplyReplaySettings ()
static void DeleteReplay (FullReplay *replay)
static void PrintLogCommand (LogEntry *log, CFile *dest)
static void SaveFullLog (CFile *dest)
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.
static int CclLog (lua_State *l)
static int CclReplayLog (lua_State *l)
bool IsReplayGame ()
void SaveReplayList (CFile *file)
 Save the replay list to file.
int LoadReplay (const std::string &name)
 Load replay.
void EndReplayLog ()
 End logging.
void CleanReplayLog ()
 Clean replay.
static void DoNextReplay ()
static void ReplayEachCycle ()
void SinglePlayerReplayEachCycle ()
 Replay user commands from log each cycle, single player games.
void MultiPlayerReplayEachCycle ()
 Replay user commands from log each cycle, multiplayer games.
void ReplayCclRegister ()
 Register ccl functions related to network.

Function Documentation

static void AppendLog ( LogEntry log,
CFile dest 
) [static]

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

Parameters:
log Pointer the replay log entry to be added
dest The 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:
action Command name (move,attack,...).
unit Unit that receive the command.
flush Append command or flush old commands.
x optional X map position.
y optional y map position.
dest optional destination unit.
value optional command argument (unit-type,...).
num optional number argument

static void DeleteReplay ( FullReplay replay  )  [static]

Free a replay from memory

Parameters:
replay Pointer to the replay to be freed

static void DoNextReplay (  )  [static]

Do next replay

void EndReplayLog (  ) 

End logging.

End logging

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:
name name 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 ( LogEntry log,
CFile dest 
) [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 dest  )  [static]

Output the FullReplay list to dest file

Parameters:
dest The file to output to

void SaveReplayList ( CFile file  ) 

Save the replay list to file.

Save generated replay

Parameters:
file file 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

static FullReplay* StartReplay (  )  [static]

Allocate & fill a new FullReplay structure, from GameSettings.

Returns:
A new FullReplay structure


Variable Documentation

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.

True if command log is off.

True, if command log is off.

LogEntry* ReplayStep [static]

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