core/systems/PluginSys.cpp
changeset 486 c8aa9d25b2c0
parent 464 765517f654a5
child 487 3410298035cb
     1.1 --- a/core/systems/PluginSys.cpp	Tue Feb 13 16:39:47 2007 +0000
     1.2 +++ b/core/systems/PluginSys.cpp	Tue Feb 13 19:20:48 2007 +0000
     1.3 @@ -40,6 +40,7 @@
     1.4  	snprintf(m_filename, sizeof(m_filename), "%s", file);
     1.5  	m_handle = 0;
     1.6  	m_ident = NULL;
     1.7 +	m_pProps = sm_trie_create();
     1.8  }
     1.9  
    1.10  CPlugin::~CPlugin()
    1.11 @@ -75,6 +76,10 @@
    1.12  		g_pSourcePawn->FreeFromMemory(m_plugin);
    1.13  		m_plugin = NULL;
    1.14  	}
    1.15 +	if (!m_pProps)
    1.16 +	{
    1.17 +		sm_trie_destroy(m_pProps);
    1.18 +	}
    1.19  }
    1.20  
    1.21  void CPlugin::InitIdentity()
    1.22 @@ -125,6 +130,23 @@
    1.23  	return pPlugin;
    1.24  }
    1.25  
    1.26 +bool CPlugin::GetProperty(const char *prop, void **ptr, bool remove/* =false */)
    1.27 +{
    1.28 +	bool exists = sm_trie_retrieve(m_pProps, prop, ptr);
    1.29 +
    1.30 +	if (exists && remove)
    1.31 +	{
    1.32 +		sm_trie_delete(m_pProps, prop);
    1.33 +	}
    1.34 +
    1.35 +	return exists;
    1.36 +}
    1.37 +
    1.38 +bool CPlugin::SetProperty(const char *prop, void *ptr)
    1.39 +{
    1.40 +	return sm_trie_insert(m_pProps, prop, ptr);
    1.41 +}
    1.42 +
    1.43  ICompilation *CPlugin::StartMyCompile(IVirtualMachine *vm)
    1.44  {
    1.45  	if (!m_plugin)