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

Method BindNativesToPlugin

core/logic/ShareSys.cpp:279–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279void ShareSystem::BindNativesToPlugin(CPlugin *pPlugin, bool bCoreOnly)
280{
281 sp::BaseRuntime *pContext = pPlugin->GetBaseContext()->GetBaseRuntime();
282
283 BeginBindingFor(pPlugin);
284
285 uint32_t native_count = pContext->GetNativesNum();
286 for (uint32_t i = 0; i < native_count; i++)
287 {
288 const sp_native_t *native = pContext->GetNative(i);
289 if (!native)
290 continue;
291
292 // If we're already bound, no need to do anything else.
293 if (native->status == SP_NATIVE_BOUND)
294 continue;
295
296 /* Otherwise, the native must be in our cache. */
297 RefPtr<Native> pEntry = FindNative(native->name);
298 if (!pEntry)
299 continue;
300
301 if (bCoreOnly && pEntry->owner != &g_CoreNatives)
302 continue;
303
304 BindNativeToPlugin(pPlugin, native, i, pEntry);
305 }
306}
307
308void ShareSystem::BindNativeToPlugin(CPlugin *pPlugin, const RefPtr<Native> &entry)
309{

Callers 3

CompileAndPrepMethod · 0.80
RunSecondPassMethod · 0.80

Calls 1

GetBaseContextMethod · 0.80

Tested by

no test coverage detected