18#ifndef INCLUDED_REPLAY
19#define INCLUDED_REPLAY
44 virtual void StartGame(JS::MutableHandleValue attribs) = 0;
49 virtual void Turn(
u32 n,
u32 turnLength, std::vector<SimulationCommand>& commands) = 0;
54 virtual void Hash(
const std::string& hash,
bool quick) = 0;
90 virtual void StartGame(JS::MutableHandleValue attribs);
91 virtual void Turn(
u32 n,
u32 turnLength, std::vector<SimulationCommand>& commands);
92 virtual void Hash(
const std::string& hash,
bool quick);
112 void Replay(
const bool serializationtest,
const int rejointestturn,
const bool ooslog,
const bool testHashFull,
const bool testHashQuick);
116 void TestHash(
const std::string& hashType,
const std::string& replayHash,
const bool testHashFull,
const bool testHashQuick);
Implementation of IReplayLogger that simply throws away all data.
Definition: Replay.h:71
virtual void Hash(const std::string &hash, bool quick)
Optional hash of simulation state (for sync checking).
Definition: Replay.h:75
virtual void StartGame(JS::MutableHandleValue attribs)
Started the game with the given game attributes.
Definition: Replay.h:73
virtual OsPath GetDirectory() const
Remember the directory containing the commands.txt file, so that we can save additional files to it.
Definition: Replay.h:77
virtual void SaveMetadata(const CSimulation2 &simulation)
Saves metadata.json containing part of the simulation state used for the summary screen.
Definition: Replay.h:76
virtual void Turn(u32 n, u32 turnLength, std::vector< SimulationCommand > &commands)
Run the given turn with the given collection of player commands.
Definition: Replay.h:74
Implementation of IReplayLogger that saves data to a file in the logs directory.
Definition: Replay.h:84
virtual void SaveMetadata(const CSimulation2 &simulation)
Saves metadata.json containing part of the simulation state used for the summary screen.
Definition: Replay.cpp:112
std::ostream * m_Stream
Definition: Replay.h:98
OsPath m_Directory
Definition: Replay.h:99
NONCOPYABLE(CReplayLogger)
const ScriptInterface & m_ScriptInterface
Definition: Replay.h:97
virtual void Hash(const std::string &hash, bool quick)
Optional hash of simulation state (for sync checking).
Definition: Replay.cpp:104
virtual void Turn(u32 n, u32 turnLength, std::vector< SimulationCommand > &commands)
Run the given turn with the given collection of player commands.
Definition: Replay.cpp:91
~CReplayLogger()
Definition: Replay.cpp:66
CReplayLogger(const ScriptInterface &scriptInterface)
Definition: Replay.cpp:61
virtual void StartGame(JS::MutableHandleValue attribs)
Started the game with the given game attributes.
Definition: Replay.cpp:71
virtual OsPath GetDirectory() const
Remember the directory containing the commands.txt file, so that we can save additional files to it.
Definition: Replay.cpp:143
Replay log replayer.
Definition: Replay.h:106
void Load(const OsPath &path)
Definition: Replay.cpp:160
void Replay(const bool serializationtest, const int rejointestturn, const bool ooslog, const bool testHashFull, const bool testHashQuick)
Definition: Replay.cpp:190
~CReplayPlayer()
Definition: Replay.cpp:155
std::istream * m_Stream
Definition: Replay.h:115
void TestHash(const std::string &hashType, const std::string &replayHash, const bool testHashFull, const bool testHashQuick)
Definition: Replay.cpp:334
CReplayPlayer()
Definition: Replay.cpp:150
Public API for simulation system.
Definition: Simulation2.h:47
Replay log recorder interface.
Definition: Replay.h:36
IReplayLogger()
Definition: Replay.h:38
virtual void StartGame(JS::MutableHandleValue attribs)=0
Started the game with the given game attributes.
virtual OsPath GetDirectory() const =0
Remember the directory containing the commands.txt file, so that we can save additional files to it.
virtual void Hash(const std::string &hash, bool quick)=0
Optional hash of simulation state (for sync checking).
virtual void Turn(u32 n, u32 turnLength, std::vector< SimulationCommand > &commands)=0
Run the given turn with the given collection of player commands.
virtual void SaveMetadata(const CSimulation2 &simulation)=0
Saves metadata.json containing part of the simulation state used for the summary screen.
virtual ~IReplayLogger()
Definition: Replay.h:39
Abstraction around a SpiderMonkey JS::Realm.
Definition: ScriptInterface.h:72
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning.
Definition: code_annotation.h:40
Path OsPath
Definition: os_path.h:31
Simulation command, typically received over the network in multiplayer games.
Definition: SimulationCommand.h:28
uint32_t u32
Definition: types.h:39