1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 23:04:36 +01:00

Refactor plugin scope

This commit is contained in:
Ted John
2018-03-23 23:24:36 +00:00
parent f54b3efe9e
commit d445cfc125
3 changed files with 26 additions and 9 deletions

View File

@@ -82,14 +82,13 @@ void HookEngine::Call(HOOK_TYPE type)
auto& hookList = GetHookList(type);
for (auto& hook : hookList.Hooks)
{
_execInfo.SetCurrentPlugin(hook.Owner);
ScriptExecutionInfo::PluginScope scope(_execInfo, hook.Owner);
const auto& function = hook.Function;
function.push();
duk_pcall(function.context(), 0);
duk_pop(function.context());
}
_execInfo.SetCurrentPlugin(nullptr);
}
HookList& HookEngine::GetHookList(HOOK_TYPE type)