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

Method UnhookCommand

core/ConsoleDetours.cpp:174–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172 }
173
174 void UnhookCommand(ConCommandBase *pBase)
175 {
176 if (!pBase->IsCommand())
177 return;
178
179 ConCommand *cmd = (ConCommand*)pBase;
180 void **vtable = GetVirtualTable(cmd);
181
182 size_t index;
183 if (!FindVtable(vtable, index))
184 {
185 logger->LogError("Console detour tried to unhook command \"%s\" but it wasn't found", pBase->GetName());
186 return;
187 }
188
189 assert(vtables[index].refcount > 0);
190 vtables[index].refcount--;
191 if (vtables[index].refcount == 0)
192 {
193 SH_REMOVE_HOOK_ID(vtables[index].hook);
194 vtables.erase(vtables.iterAt(index));
195 }
196 }
197
198public:
199 GenericCommandHooker() : enabled(false)

Callers

nothing calls this directly

Calls 3

LogErrorMethod · 0.45
GetNameMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected