Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/simulation2/scripting/MessageTypeConversions.cpp
/* Copyright (C) 2019 Wildfire Games. | /* Copyright (C) 2020 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
Show All 38 Lines | if (! JS_GetProperty(rq.cx, obj, #name, &prop)) \ | ||||
return NULL; \ | return NULL; \ | ||||
if (! ScriptInterface::FromJSVal(rq, prop, name)) \ | if (! ScriptInterface::FromJSVal(rq, prop, name)) \ | ||||
return NULL; \ | return NULL; \ | ||||
} | } | ||||
JS::Value CMessage::ToJSValCached(const ScriptInterface& scriptInterface) const | JS::Value CMessage::ToJSValCached(const ScriptInterface& scriptInterface) const | ||||
{ | { | ||||
if (!m_Cached) | if (!m_Cached) | ||||
m_Cached.reset(new JS::PersistentRootedValue(scriptInterface.GetJSRuntime(), ToJSVal(scriptInterface))); | m_Cached.reset(new JS::PersistentRootedValue(scriptInterface.GetGeneralJSContext(), ToJSVal(scriptInterface))); | ||||
return m_Cached->get(); | return m_Cached->get(); | ||||
} | } | ||||
//////////////////////////////// | //////////////////////////////// | ||||
JS::Value CMessageTurnStart::ToJSVal(const ScriptInterface& scriptInterface) const | JS::Value CMessageTurnStart::ToJSVal(const ScriptInterface& scriptInterface) const | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 501 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator