void EntityOutputManager::CleanUpHook(omg_hooks *hook) { FreeHooks.push(hook); OnHookRemoved(); IPlugin *pPlugin = plsys->FindPluginByContext(hook->pf->GetParentContext()->GetContext()); SourceHook::List<omg_hooks *> *pList = NULL; if (!pPlugin->GetProperty("OutputHookList", (void **)&pList, false) || !pList) { return; } SourceHook::List<omg_hooks *>::iterator p_iter = pList->begin(); omg_hooks *pluginHook; while (p_iter != pList->end()) { pluginHook = (omg_hooks *)*p_iter; if (pluginHook == hook) { p_iter = pList->erase(p_iter); } else { p_iter++; } } }
static bool DoTests() { int passed=0, failed=0; for (SourceHook::List<Test*>::iterator iter = ms_Tests.begin(); iter != ms_Tests.end(); ++iter) { if ((**iter)()) ++passed; else ++failed; } cout << endl << "----" << endl << "Passed: " << passed << endl << "Failed: " << failed << endl; cout << "Total: " << passed + failed << endl; return failed == 0; }
void CookieManager::OnPluginDestroyed(IPlugin *plugin) { SourceHook::List<char *> *pList; if (plugin->GetProperty("SettingsMenuItems", (void **)&pList, true)) { SourceHook::List<char *>::iterator p_iter = pList->begin(); char *name; while (p_iter != pList->end()) { name = (char *)*p_iter; p_iter = pList->erase(p_iter); //remove from this plugins list ItemDrawInfo draw; for (unsigned int i=0; i<clientMenu->GetItemCount(); i++) { const char *info = clientMenu->GetItemInfo(i, &draw); if (info == NULL) { continue; } if (strcmp(draw.display, name) == 0) { ItemDrawInfo draw; const char *info = clientMenu->GetItemInfo(i, &draw); AutoMenuData *data = (AutoMenuData *)strtol(info, NULL, 16); if (data->handler->forward != NULL) { forwards->ReleaseForward(data->handler->forward); } delete data->handler; delete data; clientMenu->RemoveItem(i); break; } } delete name; } } }
void EntityOutputManager::OnPluginDestroyed(IPlugin *plugin) { SourceHook::List<omg_hooks *> *pList = NULL; if (plugin->GetProperty("OutputHookList", (void **)&pList, true)) { SourceHook::List<omg_hooks *>::iterator p_iter = pList->begin(); omg_hooks *hook; while (p_iter != pList->end()) { hook = (omg_hooks *)*p_iter; p_iter = pList->erase(p_iter); //remove from this plugins list hook->m_parent->hooks.remove(hook); // remove from the y's list FreeHooks.push(hook); //save the omg_hook OnHookRemoved(); } } }