1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-02-26 19:54:14 +01:00

Added API for getting a plugin's base handle (needed?)

Bumped plugin version for any more API additions that will come up

--HG--
extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40241
This commit is contained in:
David Anderson 2006-08-01 02:09:19 +00:00
parent 97084c161b
commit d97f336edc
4 changed files with 27 additions and 2 deletions

View File

@ -544,6 +544,20 @@ bool CPluginManager::QueryRunning(PluginId id, char *error, size_t maxlength)
return pl->m_API->QueryRunning(error, maxlength);
}
bool CPluginManager::QueryHandle(PluginId id, void *&handle)
{
CPlugin *pl = FindById(id);
if (!pl)
{
return false;
}
handle = static_cast<void *>(pl->m_Lib);
return true;
}
PluginIter CPluginManager::_begin()
{
return m_Plugins.begin();

View File

@ -35,8 +35,9 @@
* M 7: Changed template libraries (2005-08-11)
* New loading structure mechanism
* New SourceHook version
* C 8: New SourceHook version (2005-12-23)
* 8: New SourceHook version (2005-12-23)
* New ISmmAPI additions
* C 9: New ISmmPluginManager additions
*/
#define PLAPI_MIN_VERSION 7
@ -86,6 +87,7 @@ namespace SourceMM
public:
bool Query(PluginId id, const char *&file, Pl_Status &status, PluginId &source);
bool QueryRunning(PluginId id, char *error, size_t maxlength);
bool QueryHandle(PluginId id, void *&handle);
void AddPluginCvar(ISmmPlugin *api, ConCommandBase *pCvar);
void AddPluginCmd(ISmmPlugin *api, ConCommandBase *pCmd);

View File

@ -123,6 +123,15 @@ public:
* @return Status value
*/
virtual bool QueryRunning(PluginId id, char *error, size_t maxlength) =0;
/**
* @brief Returns the handle of a plugin (OS dependent meaning)
*
* @param id Id of plugin
* @param handle By reference handle of plugin, if any
* @return True if plugin id is valid, false otherwise
*/
virtual bool QueryHandle(PluginId id, void *&handle) =0;
};
#endif //_INCLUDE_PLUGINMANAGER_H

View File

@ -20,7 +20,7 @@
#include <sourcehook/sourcehook.h>
#include "ISmmAPI.h"
#define PLAPI_VERSION 8
#define PLAPI_VERSION 9
#define PLAPI_NAME "ISmmPlugin"
class ISmmAPI;