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

Method LoadPlugin

core/logic/PluginSys.cpp:930–969  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

928}
929
930LoadRes CPluginManager::LoadPlugin(CPlugin **aResult, const char *path, bool debug, PluginType type)
931{
932 if (m_LoadingLocked)
933 return LoadRes_NeverLoad;
934
935 /**
936 * Does this plugin already exist?
937 */
938 CPlugin *pPlugin;
939 if (m_LoadLookup.retrieve(path, &pPlugin))
940 {
941 /* Check to see if we should try reloading it */
942 if (pPlugin->GetStatus() == Plugin_BadLoad
943 || pPlugin->GetStatus() == Plugin_Error
944 || pPlugin->GetStatus() == Plugin_Failed)
945 {
946 UnloadPlugin(pPlugin);
947 }
948 else
949 {
950 if (aResult)
951 *aResult = pPlugin;
952 return LoadRes_AlreadyLoaded;
953 }
954 }
955
956 CPlugin *plugin = CompileAndPrep(path);
957
958 // Assign our outparam so we can return early. It must be set.
959 *aResult = plugin;
960
961 if (plugin->GetStatus() != Plugin_Created)
962 return LoadRes_Failure;
963
964 if (plugin->AskPluginLoad() != APLRes_Success)
965 return LoadRes_Failure;
966
967 LoadExtensions(plugin);
968 return LoadRes_Successful;
969}
970
971IPlugin *CPluginManager::LoadPlugin(const char *path, bool debug, PluginType type, char error[], size_t maxlength, bool *wasloaded)
972{

Callers 1

LoadPluginMethod · 0.45

Calls 6

AskPluginLoadMethod · 0.80
GetFileExtensionMethod · 0.80
GetErrorMsgMethod · 0.80
retrieveMethod · 0.45
GetStatusMethod · 0.45

Tested by

no test coverage detected