____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       A futuristic real-time strategy game.
          This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project. Distributed under the "GNU General Public License"

replay.cpp File Reference

Replay game. More...

#include <time.h>
#include "stratagus.h"
#include "replay.h"
#include "version.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"

Go to the source code of this file.

Classes

class  LogEntry
class  MPPlayer
class  FullReplay

Functions

static void AppendLog (LogEntry *log, CFile *dest)
static FullReplayStartReplay (void)
static void ApplyReplaySettings (void)
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)
 < Log commands into file
static int CclLog (lua_State *l)
static int CclReplayLog (lua_State *l)
bool IsReplayGame ()
void SaveReplayList (CFile *file)
 Register ccl functions related to network.
int LoadReplay (const std::string &name)
 End logging.
void EndReplayLog (void)
 Clean replay.
void CleanReplayLog (void)
 Save the replay list to file.
static void DoNextReplay (void)
static void ReplayEachCycle (void)
void SinglePlayerReplayEachCycle ()
 Replay user commands from log each cycle, multiplayer games.
void MultiPlayerReplayEachCycle ()
 Load replay.
void ReplayCclRegister (void)

Variables

bool CommandLogDisabled
 True if command log is off.
ReplayType ReplayGameType
 Replay game type.
static bool DisabledLog
 Disabled log for replay.
static CFileLogFile
 Replay log file.
static unsigned long NextLogCycle
 Next log cycle number.
static int InitReplay
 Initialize replay.
static FullReplayCurrentReplay
static LogEntryReplayStep


Detailed Description

Replay game.

Definition in file replay.cpp.


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

Definition at line 364 of file replay.cpp.

References FullReplay::Commands, CFile::flush(), LogEntry::Next, and PrintLogCommand().

Referenced by CommandLog().

static void ApplyReplaySettings ( void   )  [static]

static int CclLog ( lua_State *  l  )  [static]

static int CclReplayLog ( lua_State *  l  )  [static]

void CleanReplayLog ( void   ) 

Save the replay list to file.

Clean replay log

Definition at line 734 of file replay.cpp.

References CommandLogDisabled, DeleteReplay(), DisabledLog, GameObserve, NetPlayers, ReplayGameType, and ReplayNone.

Referenced by CleanGame(), CleanModules(), and LoadReplay().

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

static void DeleteReplay ( FullReplay replay  )  [static]

Free a replay from memory

Parameters:
replay Pointer to the replay to be freed

Definition at line 264 of file replay.cpp.

References FullReplay::Commands, and LogEntry::Next.

Referenced by CleanReplayLog(), and EndReplayLog().

static void DoNextReplay ( void   )  [static]

void EndReplayLog ( void   ) 

Clean replay.

End logging

Definition at line 717 of file replay.cpp.

References CFile::close(), and DeleteReplay().

Referenced by CleanGame(), CleanModules(), and GameMainLoop().

bool IsReplayGame (  ) 

Check if we're replaying a game

Definition at line 676 of file replay.cpp.

References ReplayGameType, and ReplayNone.

Referenced by tolua_stratagus_IsReplayGame00().

int LoadReplay ( const std::string &  name  ) 

End logging.

Load a log file to replay a game

Parameters:
name name of file to load.

Definition at line 696 of file replay.cpp.

References CleanReplayLog(), CommandLogDisabled, DisabledLog, GameObserve, InitReplay, LuaLoadFile(), NextLogCycle, ReplayGameType, and ReplaySinglePlayer.

Referenced by StartReplay().

void MultiPlayerReplayEachCycle (  ) 

Load replay.

Replay user commands from log each cycle, multiplayer games

Definition at line 929 of file replay.cpp.

References ReplayEachCycle(), ReplayGameType, and ReplayMultiPlayer.

Referenced by GameMainLoop().

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

void ReplayCclRegister ( void   ) 

Register Ccl functions with lua

Definition at line 939 of file replay.cpp.

References CclLog(), CclReplayLog(), and Lua.

Referenced by InitCcl().

static void ReplayEachCycle ( void   )  [static]

static void SaveFullLog ( CFile dest  )  [static]

void SaveReplayList ( CFile file  ) 

Register ccl functions related to network.

Save generated replay

Parameters:
file file to save to.

Definition at line 686 of file replay.cpp.

References SaveFullLog().

Referenced by SaveGame().

void SinglePlayerReplayEachCycle (  ) 

Replay user commands from log each cycle, multiplayer games.

Replay user commands from log each cycle, single player games

Definition at line 919 of file replay.cpp.

References ReplayEachCycle(), ReplayGameType, and ReplaySinglePlayer.

Referenced by GameMainLoop().

static FullReplay* StartReplay ( void   )  [static]


Variable Documentation

True if command log is off.

True, if command log is off.

Definition at line 142 of file replay.cpp.

Referenced by CclReplayLog(), CleanReplayLog(), CommandLog(), EditorMainLoop(), LoadGame(), LoadReplay(), and main().

Definition at line 148 of file replay.cpp.

bool DisabledLog [static]

Disabled log for replay.

Definition at line 144 of file replay.cpp.

Referenced by CleanReplayLog(), and LoadReplay().

int InitReplay [static]

Initialize replay.

Definition at line 147 of file replay.cpp.

Referenced by LoadReplay(), and ReplayEachCycle().

CFile* LogFile [static]

Replay log file.

Definition at line 145 of file replay.cpp.

unsigned long NextLogCycle [static]

Next log cycle number.

Definition at line 146 of file replay.cpp.

Referenced by DoNextReplay(), LoadReplay(), and ReplayEachCycle().

LogEntry* ReplayStep [static]

Definition at line 149 of file replay.cpp.


Generated on Sat Feb 21 00:28:18 2009 for Bos Wars by  doxygen 1.5.6