Modified SHScriptEngine's serialization functions to take in EntityID instead of SHEntity

This commit is contained in:
Kah Wei 2022-10-18 17:25:45 +08:00
parent 86f4125100
commit a221cfc1cd
2 changed files with 6 additions and 6 deletions

View File

@ -115,7 +115,7 @@ namespace SHADE
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* Script Serialisation Functions */ /* Script Serialisation Functions */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
std::string SHScriptEngine::SerialiseScripts(const SHEntity& entity) const std::string SHScriptEngine::SerialiseScripts(EntityID entity) const
{ {
// Create buffer needed to store serialised script data // Create buffer needed to store serialised script data
constexpr int BUFFER_SIZE = 10240; constexpr int BUFFER_SIZE = 10240;
@ -124,7 +124,7 @@ namespace SHADE
// Attempt to serialise the script // Attempt to serialise the script
std::string result; std::string result;
if (csScriptsSerialise(entity.GetEID(), buffer.get(), BUFFER_SIZE)) if (csScriptsSerialise(entity, buffer.get(), BUFFER_SIZE))
{ {
result = std::string(buffer.get()); result = std::string(buffer.get());
} }
@ -140,9 +140,9 @@ namespace SHADE
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
/* Script Serialisation Functions */ /* Script Serialisation Functions */
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
void SHScriptEngine::DeserialiseScript(const SHEntity& entity, const std::string& yaml) const void SHScriptEngine::DeserialiseScript(EntityID entity, const std::string& yaml) const
{ {
csScriptDeserialise(entity.GetEID(), yaml.c_str()); csScriptDeserialise(entity, yaml.c_str());
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/

View File

@ -148,7 +148,7 @@ namespace SHADE
/// <returns> /// <returns>
/// String that represents the set of scripts attached to the specified Entity. /// String that represents the set of scripts attached to the specified Entity.
/// </returns> /// </returns>
std::string SerialiseScripts(const SHEntity& entity) const; std::string SerialiseScripts(EntityID entity) const;
/// <summary> /// <summary>
/// Loads the specified JSON string and creates a Script for the specified Entity /// Loads the specified JSON string and creates a Script for the specified Entity
/// based on the specified JSON string. /// based on the specified JSON string.
@ -157,7 +157,7 @@ namespace SHADE
/// <param name="yaml"> /// <param name="yaml">
/// The YAML string that represents the Script to load into the Entity. /// The YAML string that represents the Script to load into the Entity.
/// </param> /// </param>
void DeserialiseScript(const SHEntity& entity, const std::string& yaml) const; void DeserialiseScript(EntityID entity, const std::string& yaml) const;
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* Script Editor Functions */ /* Script Editor Functions */