Added safe (identical across platforms) replacement sin and cos functions for scripts. This is part of #1193.
This was SVN commit r11226.
This commit is contained in:
parent
1657c34979
commit
e2e5c81272
@ -613,6 +613,14 @@ void ScriptInterface::ReplaceNondeterministicFunctions(boost::rand48& rng)
|
||||
}
|
||||
// Store the RNG in a slot which is sort-of-guaranteed to be unused by the JS engine
|
||||
JS_SetReservedSlot(m->m_cx, JS_GetFunctionObject(random), 0, PRIVATE_TO_JSVAL(&rng));
|
||||
|
||||
// Load a script which replaces some of the system dependent trig functions
|
||||
VfsPath path("globalscripts/Math.js");
|
||||
if (!this->LoadGlobalScriptFile(path))
|
||||
{
|
||||
LOGERROR(L"ReplaceNondeterministicFunctions: failed to load globalscripts/Math.js");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptInterface::Register(const char* name, JSNative fptr, size_t nargs)
|
||||
|
Loading…
Reference in New Issue
Block a user