void InitializeC4Script()
{
	InitCoreFunctionMap(&ScriptEngine);

	// Seed PRNG
	FixedRandom(time(NULL));
}
static void InitializeC4Script()
{
	InitCoreFunctionMap(&ScriptEngine);

	// Seed PRNG
	FixedRandom(time(nullptr));
}
Exemple #3
0
C4Value AulTest::RunCode(const char *code, bool wrap)
{
	class OnScopeExit
	{
	public:
		~OnScopeExit()
		{
			GameScript.Clear();
			ScriptEngine.Clear();
		}
	} _cleanup;

	InitCoreFunctionMap(&ScriptEngine);
	FixedRandom(0x40490fdb);

	std::string wrapped;
	if (wrap)
	{
		wrapped = "func Main() {\n";
		wrapped += code;
		wrapped += "\n}\n";
	}
	else
	{
		wrapped = code;
	}
	std::string src("<");
	auto test_info = ::testing::UnitTest::GetInstance()->current_test_info();
	src += test_info->test_case_name();
	src += "::";
	src += test_info->name();
	src += ">";

	GameScript.LoadData(src.c_str(), wrapped.c_str(), NULL);
	ScriptEngine.Link(NULL);
		
	return GameScript.Call("Main", nullptr, true);
}
void c4_random_handle_seed(unsigned int seed)
{
  FixedRandom(seed);
}