1.1 --- a/core/CoreConfig.cpp Tue Feb 17 15:59:51 2009 -0500
1.2 +++ b/core/CoreConfig.cpp Tue Feb 17 16:19:11 2009 -0500
1.3 @@ -116,6 +116,14 @@
1.4 g_pOnAutoConfigsBuffered = g_Forwards.CreateForward("OnAutoConfigsBuffered", ET_Ignore, 0, NULL);
1.5 }
1.6
1.7 +CoreConfig::CoreConfig() : m_Strings(512)
1.8 +{
1.9 +}
1.10 +
1.11 +CoreConfig::~CoreConfig()
1.12 +{
1.13 +}
1.14 +
1.15 void CoreConfig::OnSourceModShutdown()
1.16 {
1.17 g_RootMenu.RemoveRootConsoleCommand("config", this);
1.18 @@ -212,6 +220,10 @@
1.19 /* Format path to config file */
1.20 g_LibSys.PathFormat(filePath, sizeof(filePath), "%s/%s", g_SourceMod.GetGamePath(), corecfg);
1.21
1.22 + /* Reset cached key values */
1.23 + m_KeyValues.clear();
1.24 + m_Strings.Reset();
1.25 +
1.26 /* Parse config file */
1.27 if ((err=textparsers->ParseFile_SMC(filePath, this, NULL)) != SMCError_Okay)
1.28 {
1.29 @@ -250,9 +262,21 @@
1.30 pBase = pBase->m_pGlobalClassNext;
1.31 }
1.32
1.33 + m_KeyValues.replace(option, m_Strings.AddString(value));
1.34 +
1.35 return ConfigResult_Ignore;
1.36 }
1.37
1.38 +const char *CoreConfig::GetCoreConfigValue(const char *key)
1.39 +{
1.40 + int *pKey = m_KeyValues.retrieve(key);
1.41 + if (pKey == NULL)
1.42 + {
1.43 + return NULL;
1.44 + }
1.45 + return m_Strings.GetString(*pKey);
1.46 +}
1.47 +
1.48 bool SM_AreConfigsExecuted()
1.49 {
1.50 return g_bConfigsExecd;