1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 04:53:12 +01:00

Add game mutable protection

This commit is contained in:
Ted John
2020-02-23 02:00:22 +00:00
parent dc64d3541d
commit a5c8ff920f
14 changed files with 77 additions and 24 deletions

View File

@@ -93,12 +93,12 @@ bool HookEngine::HasSubscriptions(HOOK_TYPE type) const
return !hookList.Hooks.empty();
}
void HookEngine::Call(HOOK_TYPE type)
void HookEngine::Call(HOOK_TYPE type, bool isGameStateMutable)
{
auto& hookList = GetHookList(type);
for (auto& hook : hookList.Hooks)
{
ScriptExecutionInfo::PluginScope scope(_execInfo, hook.Owner);
ScriptExecutionInfo::PluginScope scope(_execInfo, hook.Owner, false);
const auto& function = hook.Function;
function.push();
@@ -107,12 +107,12 @@ void HookEngine::Call(HOOK_TYPE type)
}
}
void HookEngine::Call(HOOK_TYPE type, DukValue args)
void HookEngine::Call(HOOK_TYPE type, DukValue args, bool isGameStateMutable)
{
auto& hookList = GetHookList(type);
for (auto& hook : hookList.Hooks)
{
ScriptExecutionInfo::PluginScope scope(_execInfo, hook.Owner);
ScriptExecutionInfo::PluginScope scope(_execInfo, hook.Owner, false);
const auto& function = hook.Function;
auto ctx = function.context();
@@ -124,12 +124,12 @@ void HookEngine::Call(HOOK_TYPE type, DukValue args)
}
}
void HookEngine::Call(HOOK_TYPE type, const std::initializer_list<std::pair<std::string_view, std::any>>& args)
void HookEngine::Call(HOOK_TYPE type, const std::initializer_list<std::pair<std::string_view, std::any>>& args, bool isGameStateMutable)
{
auto& hookList = GetHookList(type);
for (auto& hook : hookList.Hooks)
{
ScriptExecutionInfo::PluginScope scope(_execInfo, hook.Owner);
ScriptExecutionInfo::PluginScope scope(_execInfo, hook.Owner, false);
const auto& function = hook.Function;
auto ctx = function.context();