-initial import of database natives + config
-initial import of completed database layer -CreateIdentity now requires a non-optional second pointer. This breaks backwards compatibility for CreateIdentity(), however, this is not a function extension authors are supposed to be calling --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40874
This commit is contained in:
@@ -70,7 +70,7 @@ CExtension::CExtension(const char *filename, char *error, size_t maxlength)
|
||||
m_PlId = g_pMMPlugins->Load(path, g_PLID, already, error, maxlength);
|
||||
}
|
||||
|
||||
m_pIdentToken = g_ShareSys.CreateIdentity(g_ExtType);
|
||||
m_pIdentToken = g_ShareSys.CreateIdentity(g_ExtType, this);
|
||||
|
||||
if (!m_pAPI->OnExtensionLoad(this, &g_ShareSys, error, maxlength, !g_SourceMod.IsMapLoading()))
|
||||
{
|
||||
@@ -132,7 +132,11 @@ void CExtension::MarkAllLoaded()
|
||||
|
||||
void CExtension::AddPlugin(IPlugin *pPlugin)
|
||||
{
|
||||
m_Plugins.push_back(pPlugin);
|
||||
/* Unfortunately we have to do this :( */
|
||||
if (m_Plugins.find(pPlugin) != m_Plugins.end())
|
||||
{
|
||||
m_Plugins.push_back(pPlugin);
|
||||
}
|
||||
}
|
||||
|
||||
void CExtension::RemovePlugin(IPlugin *pPlugin)
|
||||
@@ -866,3 +870,13 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmd, unsigned int argco
|
||||
g_RootMenu.DrawGenericOption("list", "List extensions");
|
||||
g_RootMenu.DrawGenericOption("unload", "Unload an extension");
|
||||
}
|
||||
|
||||
CExtension *CExtensionManager::GetExtensionFromIdent(IdentityToken_t *ptr)
|
||||
{
|
||||
if (ptr->type == g_ExtType)
|
||||
{
|
||||
return (CExtension *)(ptr->ptr);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -96,6 +96,8 @@ public:
|
||||
void MarkAllLoaded();
|
||||
void AddDependency(IExtension *pSource, const char *file, bool required, bool autoload);
|
||||
void TryAutoload();
|
||||
public:
|
||||
CExtension *GetExtensionFromIdent(IdentityToken_t *ptr);
|
||||
private:
|
||||
CExtension *FindByOrder(unsigned int num);
|
||||
private:
|
||||
|
||||
@@ -91,7 +91,7 @@ void CPlugin::InitIdentity()
|
||||
{
|
||||
if (!m_handle)
|
||||
{
|
||||
m_ident = g_ShareSys.CreateIdentity(g_PluginIdent);
|
||||
m_ident = g_ShareSys.CreateIdentity(g_PluginIdent, this);
|
||||
m_handle = g_HandleSys.CreateHandle(g_PluginType, this, g_PluginSys.GetIdentity(), g_PluginSys.GetIdentity(), NULL);
|
||||
m_ctx.base->SetIdentity(m_ident);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ IdentityToken_t *ShareSystem::CreateCoreIdentity()
|
||||
m_CoreType = CreateIdentType("CORE");
|
||||
}
|
||||
|
||||
return CreateIdentity(m_CoreType);
|
||||
return CreateIdentity(m_CoreType, this);
|
||||
}
|
||||
|
||||
void ShareSystem::OnSourceModStartup(bool late)
|
||||
@@ -96,7 +96,7 @@ void ShareSystem::OnHandleDestroy(HandleType_t type, void *object)
|
||||
/* THIS WILL NEVER BE CALLED FOR ANYTHING WITH THE IDENTITY TYPE */
|
||||
}
|
||||
|
||||
IdentityToken_t *ShareSystem::CreateIdentity(IdentityType_t type)
|
||||
IdentityToken_t *ShareSystem::CreateIdentity(IdentityType_t type, void *ptr)
|
||||
{
|
||||
if (!m_TypeRoot)
|
||||
{
|
||||
@@ -110,6 +110,8 @@ IdentityToken_t *ShareSystem::CreateIdentity(IdentityType_t type)
|
||||
sec.pOwner = sec.pIdentity = GetIdentRoot();
|
||||
|
||||
pToken->ident = g_HandleSys.CreateHandleInt(type, NULL, &sec, NULL, NULL, true);
|
||||
pToken->ptr = ptr;
|
||||
pToken->type = type;
|
||||
|
||||
return pToken;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ namespace SourceMod
|
||||
struct IdentityToken_t
|
||||
{
|
||||
Handle_t ident;
|
||||
void *ptr;
|
||||
IdentityType_t type;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -53,7 +55,7 @@ public: //IShareSys
|
||||
void AddNatives(IExtension *myself, const sp_nativeinfo_t *natives);
|
||||
IdentityType_t CreateIdentType(const char *name);
|
||||
IdentityType_t FindIdentType(const char *name);
|
||||
IdentityToken_t *CreateIdentity(IdentityType_t type);
|
||||
IdentityToken_t *CreateIdentity(IdentityType_t type, void *ptr);
|
||||
void DestroyIdentType(IdentityType_t type);
|
||||
void DestroyIdentity(IdentityToken_t *identity);
|
||||
void AddDependency(IExtension *myself, const char *filename, bool require, bool autoload);
|
||||
|
||||
Reference in New Issue
Block a user