MCPcopy Create free account
hub / github.com/adventuregamestudio/ags / RunScriptFunctionNonBlocking

Function RunScriptFunctionNonBlocking

Engine/script/script.cpp:602–625  ·  view source on GitHub ↗

TODO: merge this function with DoRunScriptFuncCantBlock

Source from the content-addressed store, hash-verified

600
601// TODO: merge this function with DoRunScriptFuncCantBlock
602RunScFuncResult RunScriptFunctionNonBlocking(ScriptType sc_type, const ScriptFunctionRef &fn_ref,
603 size_t param_count, const RuntimeScriptValue *params)
604{
605 auto *script = GetScriptInstance(sc_type, fn_ref.ModuleName);
606
607 no_blocking_functions++;
608 const ScriptExecError result = scriptExecutor->Run(scriptThreadNonBlocking.get(),
609 script, fn_ref.FuncName, params, param_count);
610
611 if ((result != kScExecErr_None) && (result != kScExecErr_FuncNotFound) && (result != kScExecErr_Aborted))
612 {
613 quit_with_script_error(fn_ref.FuncName);
614 }
615
616 // this might be nested, so don't disrupt blocked scripts
617 cc_clear_error();
618 no_blocking_functions--;
619
620 // Convert any instance exec error into RunScriptFunction result;
621 // NOTE: only kScExecErr_FuncNotFound and kScExecErr_Aborted can reach here
622 if (result == kScExecErr_FuncNotFound)
623 return kScFnRes_NotFound;
624 return kScFnRes_Done;
625}
626
627void InitScriptExec()
628{

Callers

nothing calls this directly

Calls 5

GetScriptInstanceFunction · 0.85
quit_with_script_errorFunction · 0.85
cc_clear_errorFunction · 0.85
RunMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected