mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 01:29:50 +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:
+8
-8
@@ -218,12 +218,12 @@ void CGame::RegisterInit(const JS::HandleValue attribs, const std::string& saved
|
||||
m_Simulation2->SetInitAttributes(attribs);
|
||||
|
||||
std::string mapType;
|
||||
scriptInterface.GetProperty(attribs, "mapType", mapType);
|
||||
Script::GetProperty(rq, attribs, "mapType", mapType);
|
||||
|
||||
float speed;
|
||||
if (scriptInterface.HasProperty(attribs, "gameSpeed"))
|
||||
if (Script::HasProperty(rq, attribs, "gameSpeed"))
|
||||
{
|
||||
if (scriptInterface.GetProperty(attribs, "gameSpeed", speed))
|
||||
if (Script::GetProperty(rq, attribs, "gameSpeed", speed))
|
||||
SetSimRate(speed);
|
||||
else
|
||||
LOGERROR("GameSpeed could not be parsed.");
|
||||
@@ -247,8 +247,8 @@ void CGame::RegisterInit(const JS::HandleValue attribs, const std::string& saved
|
||||
std::wstring scriptFile;
|
||||
JS::RootedValue settings(rq.cx);
|
||||
|
||||
scriptInterface.GetProperty(attribs, "script", scriptFile);
|
||||
scriptInterface.GetProperty(attribs, "settings", &settings);
|
||||
Script::GetProperty(rq, attribs, "script", scriptFile);
|
||||
Script::GetProperty(rq, attribs, "settings", &settings);
|
||||
|
||||
m_World->RegisterInitRMS(scriptFile, *scriptInterface.GetContext(), settings, m_PlayerID);
|
||||
}
|
||||
@@ -256,8 +256,8 @@ void CGame::RegisterInit(const JS::HandleValue attribs, const std::string& saved
|
||||
{
|
||||
std::wstring mapFile;
|
||||
JS::RootedValue settings(rq.cx);
|
||||
scriptInterface.GetProperty(attribs, "map", mapFile);
|
||||
scriptInterface.GetProperty(attribs, "settings", &settings);
|
||||
Script::GetProperty(rq, attribs, "map", mapFile);
|
||||
Script::GetProperty(rq, attribs, "settings", &settings);
|
||||
|
||||
m_World->RegisterInit(mapFile, *scriptInterface.GetContext(), settings, m_PlayerID);
|
||||
}
|
||||
@@ -333,7 +333,7 @@ PSRETURN CGame::ReallyStartGame()
|
||||
ScriptRequest rq(scriptInterface);
|
||||
|
||||
JS::RootedValue global(rq.cx, rq.globalValue());
|
||||
if (scriptInterface->HasProperty(global, "reallyStartGame"))
|
||||
if (Script::HasProperty(rq, global, "reallyStartGame"))
|
||||
ScriptFunction::CallVoid(rq, global, "reallyStartGame");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user