diff --git a/source/simulation2/components/CCmpSelectable.cpp b/source/simulation2/components/CCmpSelectable.cpp index a936d91daf..d23916f310 100644 --- a/source/simulation2/components/CCmpSelectable.cpp +++ b/source/simulation2/components/CCmpSelectable.cpp @@ -89,8 +89,10 @@ public: // reconstructed by the GUI soon enough, I think) } - virtual void Deserialize(const CParamNode& UNUSED(paramNode), IDeserializer& UNUSED(deserialize)) + virtual void Deserialize(const CParamNode& paramNode, IDeserializer& UNUSED(deserialize)) { + // Need to call Init to reload the template properties + Init(paramNode); } virtual void HandleMessage(const CMessage& msg, bool UNUSED(global)) diff --git a/source/simulation2/serialization/BinarySerializer.cpp b/source/simulation2/serialization/BinarySerializer.cpp index 82225505d0..af026da934 100644 --- a/source/simulation2/serialization/BinarySerializer.cpp +++ b/source/simulation2/serialization/BinarySerializer.cpp @@ -132,7 +132,23 @@ void CBinarySerializerScriptImpl::HandleScriptVal(jsval val) } case JSTYPE_FUNCTION: { - LOGERROR(L"Cannot serialise JS objects of type 'function'"); + // We can't serialise functions, but we can at least name the offender (hopefully) + const jschar* funcname = NULL; + size_t length = 0; + JSFunction* func = JS_ValueToFunction(cx, val); + if (func) + { + JSString* string = JS_GetFunctionId(func); + if (string) + { + funcname = JS_GetStringCharsAndLength(cx, string, &length); + } + } + + if (!funcname || !length) + funcname = L"(unnamed)"; + + LOGERROR(L"Cannot serialise JS objects of type 'function': %ls", funcname); throw PSERROR_Serialize_InvalidScriptValue(); } case JSTYPE_STRING: