1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 22:34:33 +01:00

Add map changed hook

This commit is contained in:
Ted John
2022-02-20 02:05:24 +00:00
parent 1128f76a97
commit 84fdd44e6a
12 changed files with 52 additions and 3 deletions

View File

@@ -31,6 +31,7 @@ static const EnumMap<HOOK_TYPE> HooksLookupTable({
{ "action.location", HOOK_TYPE::ACTION_LOCATION },
{ "guest.generation", HOOK_TYPE::GUEST_GENERATION },
{ "vehicle.crash", HOOK_TYPE::VEHICLE_CRASH },
{ "map.change", HOOK_TYPE::MAP_CHANGE },
{ "map.save", HOOK_TYPE::MAP_SAVE },
});
@@ -97,6 +98,15 @@ bool HookEngine::HasSubscriptions(HOOK_TYPE type) const
return !hookList.Hooks.empty();
}
bool HookEngine::IsValidHookForPlugin(HOOK_TYPE type, Plugin& plugin) const
{
if (type == HOOK_TYPE::MAP_CHANGE && plugin.GetMetadata().Type != PluginType::Intransient)
{
return false;
}
return true;
}
void HookEngine::Call(HOOK_TYPE type, bool isGameStateMutable)
{
auto& hookList = GetHookList(type);