MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / RegisterInPlugin

Function RegisterInPlugin

core/ConCmdManager.cpp:387–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385}
386
387void RegisterInPlugin(CmdHook *hook)
388{
389 PluginHookList *pList;
390
391 IPlugin *pPlugin = scripts->FindPluginByContext(hook->pf->GetParentContext());
392 if (!pPlugin->GetProperty("CommandList", (void **)&pList))
393 {
394 pList = new PluginHookList();
395 pPlugin->SetProperty("CommandList", pList);
396 }
397
398 const char *orig = hook->info->pCmd->GetName();
399
400 /* Insert this into the help list, SORTED alphabetically. */
401 PluginHookList::iterator iter = pList->begin();
402 while (iter != pList->end())
403 {
404 const char *cmd = (*iter)->info->pCmd->GetName();
405 if (strcmp(orig, cmd) < 0)
406 {
407 pList->emplace(iter, hook);
408 return;
409 }
410 iter++;
411 }
412
413 pList->emplace_back(hook);
414}
415
416void ConCmdManager::AddToCmdList(ConCmdInfo *info)
417{

Callers 2

AddAdminCommandMethod · 0.85
AddServerCommandMethod · 0.85

Calls 6

GetPropertyMethod · 0.80
SetPropertyMethod · 0.80
FindPluginByContextMethod · 0.45
GetNameMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected