1.1 --- a/core/systems/PluginSys.cpp Mon Jun 18 03:39:15 2007 +0000
1.2 +++ b/core/systems/PluginSys.cpp Mon Jun 18 07:04:22 2007 +0000
1.3 @@ -27,6 +27,7 @@
1.4 #include "sm_stringutil.h"
1.5 #include "ConCmdManager.h"
1.6 #include "PlayerManager.h"
1.7 +#include "CoreConfig.h"
1.8
1.9 CPluginManager g_PluginSys;
1.10 HandleType_t g_PluginType = 0;
1.11 @@ -85,6 +86,11 @@
1.12 {
1.13 sm_trie_destroy(m_pProps);
1.14 }
1.15 + for (size_t i=0; i<m_configs.size(); i++)
1.16 + {
1.17 + delete m_configs[i];
1.18 + }
1.19 + m_configs.clear();
1.20 }
1.21
1.22 void CPlugin::InitIdentity()
1.23 @@ -309,12 +315,9 @@
1.24 pFunction->Execute(NULL);
1.25 }
1.26 }
1.27 - if (g_ConCmds.IsServerCfgDone())
1.28 + if (SM_AreConfigsExecuted())
1.29 {
1.30 - if ((pFunction = m_ctx.base->GetFunctionByName("OnServerCfg")) != NULL)
1.31 - {
1.32 - pFunction->Execute(NULL);
1.33 - }
1.34 + SM_ExecuteForPlugin(GetBaseContext());
1.35 }
1.36 }
1.37 }
1.38 @@ -618,6 +621,32 @@
1.39 m_dependsOn.remove(pOwner);
1.40 }
1.41
1.42 +unsigned int CPlugin::GetConfigCount()
1.43 +{
1.44 + return (unsigned int)m_configs.size();
1.45 +}
1.46 +
1.47 +AutoConfig *CPlugin::GetConfig(unsigned int i)
1.48 +{
1.49 + if (i >= GetConfigCount())
1.50 + {
1.51 + return NULL;
1.52 + }
1.53 +
1.54 + return m_configs[i];
1.55 +}
1.56 +
1.57 +void CPlugin::AddConfig(bool autoCreate, const char *cfg, const char *folder)
1.58 +{
1.59 + AutoConfig *c = new AutoConfig;
1.60 +
1.61 + c->autocfg = cfg;
1.62 + c->folder = folder;
1.63 + c->create = autoCreate;
1.64 +
1.65 + m_configs.push_back(c);
1.66 +}
1.67 +
1.68 /*******************
1.69 * PLUGIN ITERATOR *
1.70 *******************/
1.71 @@ -1971,3 +2000,10 @@
1.72
1.73 return (CPlugin *)(pToken->ptr);
1.74 }
1.75 +
1.76 +void CPluginManager::ExecAndGenPluginConfs()
1.77 +{
1.78 + List<CPlugin *>::iterator iter;
1.79 +
1.80 + //for (iter =
1.81 +}