Fix HookedFunctions

This commit is contained in:
LightCat 2018-10-18 11:16:47 +02:00
parent 7c57b6cc3c
commit 9d653a8fa1

View File

@ -9,16 +9,11 @@ std::vector<HookedFunction *> &HookTools::GetHookedFunctions()
// -----------------------------------------------------------
static std::array<int, 3> bounds{};
void RunHookedFunctions(HookedFunctions_types type)
{
auto &HookedFunctions = HookTools::GetHookedFunctions();
for (int i = bounds.at(type); i < HookedFunctions.size(); i++)
{
if (!HookedFunctions.at(i)->run(type))
break;
}
for (auto &i : HookedFunctions)
i->run(type);
}
void HookTools::CM()
@ -38,23 +33,10 @@ void HookTools::PAINT()
static InitRoutine init([]() {
auto &HookedFunctions = HookTools::GetHookedFunctions();
logging::Info("Hooked Functions amount: %i", HookedFunctions.size());
std::sort(HookedFunctions.begin(), HookedFunctions.end(),
[](HookedFunction *a, HookedFunction *b) { return *a > *b; });
logging::Info("Sorted Hooked Functions: %i", HookedFunctions.size());
for (int i = 0; i < bounds.size(); i++)
{
for (int j = 0; j < HookedFunctions.size(); j++)
{
if (HookedFunctions.at(j)->m_type == i)
{
bounds.at(i) = j;
break;
}
}
}
logging::Info(
"Initialized HookedFunction bounds: CM: %i, Draw: %i, Paint: %i",
bounds.at(0), bounds.at(1), bounds.at(2));
});
static CatCommand print("debug_print_hookedfunctions",