18#ifndef INCLUDED_REPLAY
19#define INCLUDED_REPLAY
25#include <js/RootingAPI.h>
26#include <js/TypeDecls.h>
32namespace Script {
class Interface; }
48 virtual void StartGame(JS::MutableHandleValue attribs) = 0;
53 virtual void Turn(std::uint32_t n, std::uint32_t turnLength, std::vector<SimulationCommand>& commands) = 0;
58 virtual void Hash(
const std::string& hash,
bool quick) = 0;
78 virtual void Turn(std::uint32_t , std::uint32_t , std::vector<SimulationCommand>&)
80 virtual void Hash(
const std::string& ,
bool ) { }
95 virtual void StartGame(JS::MutableHandleValue attribs);
96 virtual void Turn(std::uint32_t n, std::uint32_t turnLength, std::vector<SimulationCommand>& commands);
97 virtual void Hash(
const std::string& hash,
bool quick);
117 void Replay(
const int serializationtestturn,
const int rejointestturn,
const bool ooslog,
118 const bool testHashFull,
const bool testHashQuick);
122 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:75
virtual void Hash(const std::string &, bool)
Optional hash of simulation state (for sync checking).
Definition: Replay.h:80
virtual void Turn(std::uint32_t, std::uint32_t, std::vector< SimulationCommand > &)
Run the given turn with the given collection of player commands.
Definition: Replay.h:78
virtual OsPath GetDirectory() const
Remember the directory containing the commands.txt file, so that we can save additional files to it.
Definition: Replay.h:82
virtual void StartGame(JS::MutableHandleValue)
Started the game with the given game attributes.
Definition: Replay.h:77
virtual void SaveMetadata(const CSimulation2 &)
Saves metadata.json containing part of the simulation state used for the summary screen.
Definition: Replay.h:81
Implementation of IReplayLogger that saves data to a file in the logs directory.
Definition: Replay.h:89
virtual void SaveMetadata(const CSimulation2 &simulation)
Saves metadata.json containing part of the simulation state used for the summary screen.
Definition: Replay.cpp:116
std::ostream * m_Stream
Definition: Replay.h:103
OsPath m_Directory
Definition: Replay.h:104
NONCOPYABLE(CReplayLogger)
virtual void Hash(const std::string &hash, bool quick)
Optional hash of simulation state (for sync checking).
Definition: Replay.cpp:108
CReplayLogger(const Script::Interface &scriptInterface)
Definition: Replay.cpp:65
~CReplayLogger()
Definition: Replay.cpp:70
virtual void Turn(std::uint32_t n, std::uint32_t turnLength, std::vector< SimulationCommand > &commands)
Run the given turn with the given collection of player commands.
Definition: Replay.cpp:95
const Script::Interface & m_ScriptInterface
Definition: Replay.h:102
virtual void StartGame(JS::MutableHandleValue attribs)
Started the game with the given game attributes.
Definition: Replay.cpp:75
virtual OsPath GetDirectory() const
Remember the directory containing the commands.txt file, so that we can save additional files to it.
Definition: Replay.cpp:147
Replay log replayer.
Definition: Replay.h:111
void Load(const OsPath &path)
Definition: Replay.cpp:164
void Replay(const int serializationtestturn, const int rejointestturn, const bool ooslog, const bool testHashFull, const bool testHashQuick)
Definition: Replay.cpp:197
~CReplayPlayer()
Definition: Replay.cpp:159
std::istream * m_Stream
Definition: Replay.h:121
void TestHash(const std::string &hashType, const std::string &replayHash, const bool testHashFull, const bool testHashQuick)
Definition: Replay.cpp:349
CReplayPlayer()
Definition: Replay.cpp:154
Public API for simulation system.
Definition: Simulation2.h:57
Replay log recorder interface.
Definition: Replay.h:40
IReplayLogger()
Definition: Replay.h:42
virtual void Turn(std::uint32_t n, std::uint32_t turnLength, std::vector< SimulationCommand > &commands)=0
Run the given turn with the given collection of player commands.
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 SaveMetadata(const CSimulation2 &simulation)=0
Saves metadata.json containing part of the simulation state used for the summary screen.
virtual ~IReplayLogger()
Definition: Replay.h:43
Definition: Interface.h:93
Abstraction around a SpiderMonkey JSContext.
Definition: DapInterface.h:32
Path OsPath
Definition: os_path.h:37
Simulation command, typically received over the network in multiplayer games.
Definition: SimulationCommand.h:39