2019-07-26 05:21:03 +08:00
|
|
|
#include "../dll/dll.h"
|
|
|
|
#include "Hook_Manager.h"
|
|
|
|
|
2019-08-14 21:09:57 +08:00
|
|
|
#ifndef NO_OVERLAY
|
|
|
|
|
2019-08-27 21:38:07 +08:00
|
|
|
Hook_Manager::Hook_Manager()
|
2019-07-26 05:21:03 +08:00
|
|
|
{}
|
|
|
|
|
|
|
|
Hook_Manager::~Hook_Manager()
|
|
|
|
{
|
|
|
|
for (auto& i : _hooks)
|
|
|
|
delete i;
|
|
|
|
}
|
|
|
|
|
|
|
|
Hook_Manager& Hook_Manager::Inst()
|
|
|
|
{
|
|
|
|
static Hook_Manager hook;
|
|
|
|
return hook;
|
|
|
|
}
|
|
|
|
|
2019-08-27 21:38:07 +08:00
|
|
|
void Hook_Manager::AddHook(Base_Hook* hook)
|
2019-07-26 05:21:03 +08:00
|
|
|
{
|
2019-08-27 21:38:07 +08:00
|
|
|
_hooks.insert(hook);
|
2019-07-26 05:21:03 +08:00
|
|
|
}
|
|
|
|
|
2019-08-27 21:38:07 +08:00
|
|
|
void Hook_Manager::RemoveHook(Base_Hook* hook)
|
2019-07-26 05:21:03 +08:00
|
|
|
{
|
2019-08-27 21:38:07 +08:00
|
|
|
auto it = _hooks.find(hook);
|
|
|
|
if (it != _hooks.end())
|
2019-07-26 05:21:03 +08:00
|
|
|
{
|
2019-08-27 21:38:07 +08:00
|
|
|
delete hook;
|
|
|
|
_hooks.erase(it);
|
2019-08-16 16:36:44 +08:00
|
|
|
}
|
2019-08-14 21:09:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif//NO_OVERLAY
|