Run a single event callback in the specified script module; if the name is not provided, then tries to run it in global script.
| 532 | // Run a single event callback in the specified script module; |
| 533 | // if the name is not provided, then tries to run it in global script. |
| 534 | static bool RunEventInModule(const ScriptFunctionRef &fn_ref, size_t param_count, const RuntimeScriptValue *params) |
| 535 | { |
| 536 | if (!fn_ref.ModuleName.IsEmpty()) |
| 537 | { |
| 538 | for (size_t i = 0; i < numScriptModules; ++i) |
| 539 | { |
| 540 | if (fn_ref.ModuleName.Compare(scriptModules[i]->GetScriptName()) == 0) |
| 541 | { |
| 542 | return RunScriptFunction(scriptModules[i].get(), fn_ref.FuncName, param_count, params) == kScFnRes_Done; |
| 543 | } |
| 544 | } |
| 545 | } |
| 546 | // Try global script last, for backwards compatibility |
| 547 | return RunScriptFunction(gamescript.get(), fn_ref.FuncName, param_count, params) == kScFnRes_Done; |
| 548 | } |
| 549 | |
| 550 | // Run claimable event in all script modules, *including* room; |
| 551 | // break if event was claimed by any of the run callbacks. |
no test coverage detected