- LibraryExists() now works on extensions
- geoip and cstrike now work as libraries --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401579
This commit is contained in:
+11
-1
@@ -463,7 +463,17 @@ static cell_t LibraryExists(IPluginContext *pContext, const cell_t *params)
|
||||
char *str;
|
||||
pContext->LocalToString(params[1], &str);
|
||||
|
||||
return g_PluginSys.LibraryExists(str) ? 1 : 0;
|
||||
if (g_PluginSys.LibraryExists(str))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (g_Extensions.LibraryExists(str))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static cell_t sm_LogAction(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
@@ -1118,3 +1118,26 @@ void CExtensionManager::AddLibrary(IExtension *pSource, const char *library)
|
||||
pExt->AddLibrary(library);
|
||||
g_PluginSys.OnLibraryAction(library, false, false);
|
||||
}
|
||||
|
||||
bool CExtensionManager::LibraryExists(const char *library)
|
||||
{
|
||||
CExtension *pExt;
|
||||
|
||||
for (List<CExtension *>::iterator iter = m_Libs.begin();
|
||||
iter != m_Libs.end();
|
||||
iter++)
|
||||
{
|
||||
pExt = (*iter);
|
||||
for (List<String>::iterator s_iter = pExt->m_Libraries.begin();
|
||||
s_iter != pExt->m_Libraries.end();
|
||||
s_iter++)
|
||||
{
|
||||
if ((*s_iter).compare(library) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -135,6 +135,7 @@ public:
|
||||
void AddDependency(IExtension *pSource, const char *file, bool required, bool autoload);
|
||||
void TryAutoload();
|
||||
void AddLibrary(IExtension *pSource, const char *library);
|
||||
bool LibraryExists(const char *library);
|
||||
public:
|
||||
CExtension *GetExtensionFromIdent(IdentityToken_t *ptr);
|
||||
void Shutdown();
|
||||
|
||||
Reference in New Issue
Block a user