Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/scripting/MessageTypeConversions.cpp
Show First 20 Lines • Show All 275 Lines • ▼ Show 20 Lines | JS::Value CMessageMotionUpdate::ToJSVal(const ScriptInterface& scriptInterface) const | ||||
JS::RootedValue prop(cx); | JS::RootedValue prop(cx); | ||||
if (!JS_SetProperty(cx, obj, UpdateTypeStr[updateType], JS::TrueHandleValue)) | if (!JS_SetProperty(cx, obj, UpdateTypeStr[updateType], JS::TrueHandleValue)) | ||||
return JS::UndefinedValue(); | return JS::UndefinedValue(); | ||||
return JS::ObjectValue(*obj); | return JS::ObjectValue(*obj); | ||||
} | } | ||||
CMessage* CMessageMotionUpdate::FromJSVal(const ScriptInterface&, JS::HandleValue) | CMessage* CMessageMotionUpdate::FromJSVal(const ScriptInterface& scriptInterface, JS::HandleValue val) | ||||
{ | { | ||||
LOGWARNING("CMessageMotionUpdate::FromJSVal not implemented"); | FROMJSVAL_SETUP(); | ||||
GET_MSG_PROPERTY(std::wstring, updateString); | |||||
if (updateString == L"likelySuccess") | |||||
return new CMessageMotionUpdate(CMessageMotionUpdate::LIKELY_SUCCESS); | |||||
if (updateString == L"likelyFailure") | |||||
return new CMessageMotionUpdate(CMessageMotionUpdate::LIKELY_FAILURE); | |||||
if (updateString == L"obstructed") | |||||
return new CMessageMotionUpdate(CMessageMotionUpdate::OBSTRUCTED); | |||||
LOGWARNING("CMessageMotionUpdate::FromJSVal passed wrong updateString"); | |||||
return NULL; | return NULL; | ||||
} | } | ||||
//////////////////////////////// | //////////////////////////////// | ||||
JS::Value CMessageTerrainChanged::ToJSVal(const ScriptInterface& scriptInterface) const | JS::Value CMessageTerrainChanged::ToJSVal(const ScriptInterface& scriptInterface) const | ||||
{ | { | ||||
TOJSVAL_SETUP(); | TOJSVAL_SETUP(); | ||||
▲ Show 20 Lines • Show All 263 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator