mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-11-09 13:13:11 +00:00
Add a function to query a global object, including JS classes, from C++
The latter are not properties of the global object but stored within the global lexical environment. This is not currently needed, but will be useful for future diffs. Update Vector2D/3D querying. Taken from D2746 This was SVN commit r24406.
This commit is contained in:
1 parent
25b8cfc6b8
commit
e22a915351
3 files changed
+41
-2
No files matched your search
@@ -160,7 +160,7 @@ template<> void ScriptInterface::ToJSVal<CFixedVector3D>(const ScriptRequest& rq
|
||||
{
|
||||
JS::RootedObject global(rq.cx, rq.glob);
|
||||
JS::RootedValue valueVector3D(rq.cx);
|
||||
if (!JS_GetProperty(rq.cx, global, "Vector3D", &valueVector3D))
|
||||
if (!ScriptInterface::GetGlobalProperty(rq, "Vector3D", &valueVector3D))
|
||||
FAIL_VOID("Failed to get Vector3D constructor");
|
||||
|
||||
JS::RootedValueArray<3> args(rq.cx);
|
||||
@@ -196,7 +196,7 @@ template<> void ScriptInterface::ToJSVal<CFixedVector2D>(const ScriptRequest& rq
|
||||
{
|
||||
JS::RootedObject global(rq.cx, rq.glob);
|
||||
JS::RootedValue valueVector2D(rq.cx);
|
||||
if (!JS_GetProperty(rq.cx, global, "Vector2D", &valueVector2D))
|
||||
if (!ScriptInterface::GetGlobalProperty(rq, "Vector2D", &valueVector2D))
|
||||
FAIL_VOID("Failed to get Vector2D constructor");
|
||||
|
||||
JS::RootedValueArray<2> args(rq.cx);
|
||||
|
||||
Reference in new issue
Block a user