18 #ifndef INCLUDED_SIMULATION2 19 #define INCLUDED_SIMULATION2 28 #include <unordered_map> 153 void ResetState(
bool skipScriptedComponents =
false,
bool skipAI =
false);
170 void Update(
int turnLength);
171 void Update(
int turnLength,
const std::vector<SimulationCommand>& commands);
172 void Interpolate(
float simFrameLength,
float frameOffset,
float realFrameLength);
209 std::vector<std::pair<entity_id_t, IComponent*> >;
212 std::unordered_map<entity_id_t, IComponent*>;
283 #endif // INCLUDED_SIMULATION2 Definition: IComponent.h:32
JS::Value GetInitAttributes()
Get the data passed to SetInitAttributes.
Definition: Simulation2.cpp:804
IComponent * QueryInterface(entity_id_t ent, int iid) const
Definition: Simulation2.cpp:696
std::unordered_map< entity_id_t, IComponent * > InterfaceListUnordered
Definition: Simulation2.h:212
bool DeserializeState(std::istream &stream)
Definition: Simulation2.cpp:894
void ActivateRejoinTest(int turn)
Activate the rejoin-test feature for turn.
Definition: Simulation2.cpp:900
float GetLastFrameOffset() const
Returns the last frame offset passed to Interpolate(), i.e.
Definition: Simulation2.cpp:774
entity_id_t AddLocalEntity(const std::wstring &templateName)
Definition: Simulation2.cpp:681
void Interpolate(float simFrameLength, float frameOffset, float realFrameLength)
Definition: Simulation2.cpp:761
void ResetState(bool skipScriptedComponents=false, bool skipAI=false)
Initialise (or re-initialise) the complete simulation state.
Definition: Simulation2.cpp:873
const CSimContext & GetSimContext() const
Definition: Simulation2.cpp:721
void BroadcastMessage(const CMessage &msg) const
Definition: Simulation2.cpp:706
std::string GenerateSchema()
Definition: Simulation2.cpp:908
CSimulation2(CUnitManager *unitManager, std::shared_ptr< ScriptContext > cx, CTerrain *terrain)
Definition: Simulation2.cpp:638
void RenderSubmit(SceneCollector &collector, const CFrustum &frustum, bool culling)
Definition: Simulation2.cpp:766
Abstraction around a SpiderMonkey JSContext.
Definition: ScriptContext.h:40
std::vector< std::string > GetVictoryConditiondData()
Get victory condition data.
Definition: Simulation2.cpp:948
const InterfaceListUnordered & GetEntitiesWithInterfaceUnordered(int iid)
Returns a list of components implementing the given interface, and their associated entities...
Definition: Simulation2.cpp:716
Contains pointers to various 'global' objects that are needed by the simulation code, to allow easy access without using real (evil) global variables.
Definition: SimContext.h:32
std::vector< std::string > GetRMSData()
Get random map script data.
Definition: Simulation2.cpp:943
bool LoadDefaultScripts()
Call LoadScripts for each of the game's standard simulation script paths.
Definition: Simulation2.cpp:784
std::string GetMapSettingsString()
Get the current map settings as a UTF-8 JSON string.
Definition: Simulation2.cpp:827
~CSimulation2()
Definition: Simulation2.cpp:643
void Update(int turnLength)
Definition: Simulation2.cpp:750
Status ReloadChangedFile(const VfsPath &path)
Reload any scripts that were loaded from the given filename.
Definition: Simulation2.cpp:868
void PreInitGame()
Replace/destroy some entities (e.g.
Definition: Simulation2.cpp:731
Public API for simulation system.
Definition: Simulation2.h:46
This interface accepts renderable objects.
Definition: Scene.h:89
void InitGame()
Initialise a new game, based on some script data.
Definition: Simulation2.cpp:738
void SetMapSettings(const std::string &settings)
Set the initial map settings (as a UTF-8-encoded JSON string), which will be used to set up the simul...
Definition: Simulation2.cpp:814
NONCOPYABLE(CSimulation2)
CSimulation2Impl * m
Definition: Simulation2.h:280
Definition: Simulation2.cpp:54
Config::Value_type Value
Definition: json_spirit_value.h:182
std::string GetPlayerDefaults()
Get player default data.
Definition: Simulation2.cpp:973
ScriptInterface & GetScriptInterface() const
Definition: Simulation2.cpp:726
bool LoadScripts(const VfsPath &path)
Load all scripts in the specified directory (non-recursively), so they can register new component typ...
Definition: Simulation2.cpp:779
Definition: UnitManager.h:35
bool ComputeStateHash(std::string &outHash, bool quick)
Definition: Simulation2.cpp:878
i64 Status
Error handling system.
Definition: status.h:169
std::string GetAIData()
Get AI data.
Definition: Simulation2.cpp:983
std::vector< std::pair< entity_id_t, IComponent * > > InterfaceList
Definition: Simulation2.h:209
bool SerializeState(std::ostream &stream)
Definition: Simulation2.cpp:889
void LoadMapSettings()
Loads the map settings script (called after map is loaded)
Definition: Simulation2.cpp:844
std::string GetMapSizes()
Get map sizes data.
Definition: Simulation2.cpp:978
InterfaceList GetEntitiesWithInterface(int iid)
Returns a list of components implementing the given interface, and their associated entities...
Definition: Simulation2.cpp:711
void FlushDestroyedEntities()
Does the actual destruction of entities from DestroyEntity.
Definition: Simulation2.cpp:691
entity_id_t AddEntity(const std::wstring &templateName)
Construct a new entity and add it to the world.
Definition: Simulation2.cpp:671
void DestroyEntity(entity_id_t ent)
Destroys the specified entity, once FlushDestroyedEntities is called.
Definition: Simulation2.cpp:686
void SetInitAttributes(JS::HandleValue settings)
Set the attributes identifying the scenario/RMS used to initialise this simulation.
Definition: Simulation2.cpp:799
void EnableOOSLog()
Definition: Simulation2.cpp:660
Abstraction around a SpiderMonkey JS::Realm.
Definition: ScriptInterface.h:71
void PostMessage(entity_id_t ent, const CMessage &msg) const
Definition: Simulation2.cpp:701
int ProgressiveLoad()
RegMemFun incremental loader function.
Definition: Simulation2.cpp:863
void SetStartupScript(const std::string &script)
Set a startup script, which will get executed before the first turn.
Definition: Simulation2.cpp:789
u32 entity_id_t
Entity ID type.
Definition: Entity.h:23
void EnableRejoinTest(int rejoinTestTurn)
Definition: Simulation2.cpp:655
const std::string & GetStartupScript()
Get the current startup script.
Definition: Simulation2.cpp:794
void EnableSerializationTest()
Definition: Simulation2.cpp:650
bool DumpDebugState(std::ostream &stream)
Definition: Simulation2.cpp:883
void GetMapSettings(JS::MutableHandleValue ret)
Get the current map settings.
Definition: Simulation2.cpp:832
void LoadPlayerSettings(bool newPlayers)
Loads the player settings script (called before map is loaded)
Definition: Simulation2.cpp:837