these should compile now

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40225
This commit is contained in:
David Anderson 2006-12-16 22:31:32 +00:00
parent 77ca28b8a3
commit 522a1f605f
2 changed files with 44 additions and 1 deletions

View File

@ -1,11 +1,13 @@
#include <stdio.h>
#include "PluginSys.h"
#include "LibrarySys.h"
#include "HandleSys.h"
#include "sourcemm_api.h"
#include "sourcemod.h"
#include "CTextParsers.h"
CPluginManager g_PluginSys;
HandleType_t g_PluginType = 0;
CPlugin::CPlugin(const char *file)
{
@ -20,6 +22,8 @@ CPlugin::CPlugin(const char *file)
m_pub_funcs = NULL;
m_errormsg[256] = '\0';
snprintf(m_filename, sizeof(m_filename), "%s", file);
/* :TODO: ShareSys token */
m_handle = g_HandleSys.CreateHandle(g_PluginType, this, DEFAULT_IDENTITY, 1);
}
CPlugin::~CPlugin()
@ -441,6 +445,11 @@ bool CPlugin::SetPauseState(bool paused)
return true;
}
IdentityToken_t CPlugin::GetIdentity()
{
return 0;
}
/*******************
* PLUGIN ITERATOR *
*******************/
@ -1078,3 +1087,25 @@ bool CPluginManager::IsLateLoadTime()
{
return (m_AllPluginsLoaded || g_SourceMod.IsLateLoadInMap());
}
void CPluginManager::OnSourceModAllInitialized()
{
HandleSecurity sec;
sec.owner = 1; /* :TODO: implement ShareSys */
sec.all.canCreate = false;
sec.all.canDelete = false;
sec.all.canInherit = false;
g_PluginType = g_HandleSys.CreateTypeEx("IPlugin", this, 0, &sec);
}
void CPluginManager::OnSourceModShutdown()
{
g_HandleSys.RemoveType(g_PluginType, 1);
}
void CPluginManager::OnHandleDestroy(HandleType_t type, void *object)
{
/* We don't care about the internal object, actually */
}

View File

@ -3,12 +3,14 @@
#include <time.h>
#include <IPluginSys.h>
#include <IHandleSys.h>
#include <sh_list.h>
#include <sh_stack.h>
#include "sm_globals.h"
#include "CFunction.h"
#include "PluginInfoDatabase.h"
#include "sm_trie.h"
#include "sourcemod.h"
using namespace SourceHook;
@ -91,6 +93,7 @@ public:
virtual const sp_plugin_t *GetPluginStructure() const;
virtual IPluginFunction *GetFunctionByName(const char *public_name);
virtual IPluginFunction *GetFunctionById(funcid_t func_id);
virtual IdentityToken_t GetIdentity();
public:
/**
* Creates a plugin object with default values.
@ -148,9 +151,13 @@ private:
CFunction **m_pub_funcs;
char m_errormsg[256];
time_t m_LastAccess;
Handle_t m_handle;
};
class CPluginManager : public IPluginManager
class CPluginManager :
public IPluginManager,
public SMGlobalClass,
public IHandleTypeDispatch
{
friend class CPlugin;
public:
@ -186,6 +193,11 @@ public: //IPluginManager
virtual IPluginIterator *GetPluginIterator();
virtual void AddPluginsListener(IPluginsListener *listener);
virtual void RemovePluginsListener(IPluginsListener *listener);
public: //SMGlobalClass
virtual void OnSourceModAllInitialized();
virtual void OnSourceModShutdown();
public: //IHandleTypeDispatch
virtual void OnHandleDestroy(HandleType_t type, void *object);
public:
/**
* Loads all plugins not yet loaded