forked from citizenfx/fivem
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHookFunction.cpp
More file actions
44 lines (37 loc) · 864 Bytes
/
HookFunction.cpp
File metadata and controls
44 lines (37 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* This file is part of the CitizenFX project - http://citizen.re/
*
* See LICENSE and MENTIONS in the root of the source tree for information
* regarding licensing.
*/
#include "StdInc.h"
#include "HookFunction.h"
static HookFunctionBase* g_hookFunctions;
void HookFunctionBase::Register()
{
m_next = g_hookFunctions;
g_hookFunctions = this;
}
void HookFunctionBase::RunAll()
{
for (auto func = g_hookFunctions; func; func = func->m_next)
{
func->Run();
}
}
static RuntimeHookFunction* g_runtimeHookFunctions;
void RuntimeHookFunction::Register()
{
m_next = g_runtimeHookFunctions;
g_runtimeHookFunctions = this;
}
void RuntimeHookFunction::Run(const char* key)
{
for (auto func = g_runtimeHookFunctions; func; func = func->m_next)
{
if (func->m_key == key)
{
func->m_function();
}
}
}