Changeset View
Changeset View
Standalone View
Standalone View
source/gui/IGUIObject.cpp
Show First 20 Lines • Show All 406 Lines • ▼ Show 20 Lines | void IGUIObject::RegisterScriptHandler(const CStr& Action, const CStr& Code, CGUI* pGUI) | ||||
// Generate a unique name | // Generate a unique name | ||||
static int x = 0; | static int x = 0; | ||||
char buf[64]; | char buf[64]; | ||||
sprintf_s(buf, ARRAY_SIZE(buf), "__eventhandler%d (%s)", x++, Action.c_str()); | sprintf_s(buf, ARRAY_SIZE(buf), "__eventhandler%d (%s)", x++, Action.c_str()); | ||||
JS::CompileOptions options(cx); | JS::CompileOptions options(cx); | ||||
options.setFileAndLine(CodeName.c_str(), 0); | options.setFileAndLine(CodeName.c_str(), 0); | ||||
options.setCompileAndGo(true); | |||||
wraitii: Deleted without replacement. | |||||
JS::RootedFunction func(cx); | JS::RootedFunction func(cx); | ||||
JS::AutoObjectVector emptyScopeChain(cx); | JS::AutoObjectVector emptyScopeChain(cx); | ||||
if (!JS::CompileFunction(cx, emptyScopeChain, options, buf, paramCount, paramNames, Code.c_str(), Code.length(), &func)) | if (!JS::CompileFunction(cx, emptyScopeChain, options, buf, paramCount, paramNames, Code.c_str(), Code.length(), &func)) | ||||
{ | { | ||||
LOGERROR("RegisterScriptHandler: Failed to compile the script for %s", Action.c_str()); | LOGERROR("RegisterScriptHandler: Failed to compile the script for %s", Action.c_str()); | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 130 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Deleted without replacement.