mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-13 20:55:00 +00:00
Split off Object-related functions from ScriptInterface
Follows 34b1920e7b.
This splits off the object-related functions, such as
[Set/Get/Has]Property, CreateObject, CreateArray, FreezeObject.
It also puts the definitions in the header itself, which might end up
with faster code here & there, though perhaps slower compilation time
(somewhat doubtful since we already included most things anyways).
Differential Revision: https://code.wildfiregames.com/D3956
This was SVN commit r25430.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "ScriptComponent.h"
|
||||
|
||||
#include "scriptinterface/FunctionWrapper.h"
|
||||
#include "scriptinterface/Object.h"
|
||||
#include "simulation2/serialization/ISerializer.h"
|
||||
#include "simulation2/serialization/IDeserializer.h"
|
||||
|
||||
@@ -31,8 +32,8 @@ CComponentTypeScript::CComponentTypeScript(const ScriptInterface& scriptInterfac
|
||||
void CComponentTypeScript::Init(const CParamNode& paramNode, entity_id_t ent)
|
||||
{
|
||||
ScriptRequest rq(m_ScriptInterface);
|
||||
m_ScriptInterface.SetProperty(m_Instance, "entity", (int)ent, true, false);
|
||||
m_ScriptInterface.SetProperty(m_Instance, "template", paramNode, true, false);
|
||||
Script::SetProperty(rq, m_Instance, "entity", (int)ent, true, false);
|
||||
Script::SetProperty(rq, m_Instance, "template", paramNode, true, false);
|
||||
ScriptFunction::CallVoid(rq, m_Instance, "Init");
|
||||
}
|
||||
|
||||
@@ -65,8 +66,8 @@ void CComponentTypeScript::Deserialize(const CParamNode& paramNode, IDeserialize
|
||||
{
|
||||
ScriptRequest rq(m_ScriptInterface);
|
||||
|
||||
m_ScriptInterface.SetProperty(m_Instance, "entity", (int)ent, true, false);
|
||||
m_ScriptInterface.SetProperty(m_Instance, "template", paramNode, true, false);
|
||||
Script::SetProperty(rq, m_Instance, "entity", (int)ent, true, false);
|
||||
Script::SetProperty(rq, m_Instance, "template", paramNode, true, false);
|
||||
|
||||
deserialize.ScriptObjectAssign("comp", m_Instance);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user