core/sourcemod.cpp
changeset 663 b526b82e256e
parent 661 5c0988b9bf0c
child 665 74fa35a4c27c
     1.1 --- a/core/sourcemod.cpp	Thu Apr 05 03:16:03 2007 +0000
     1.2 +++ b/core/sourcemod.cpp	Thu Apr 05 05:25:11 2007 +0000
     1.3 @@ -69,24 +69,32 @@
     1.4  	m_GotBasePath = false;
     1.5  }
     1.6  
     1.7 -CoreConfigErr SourceModBase::OnSourceModConfigChanged(const char *option, const char *value)
     1.8 +ConfigResult SourceModBase::OnSourceModConfigChanged(const char *key, 
     1.9 +									  const char *value, 
    1.10 +									  ConfigSource source, 
    1.11 +									  char *error, 
    1.12 +									  size_t maxlength)
    1.13  {
    1.14 -	if (strcasecmp(option, "BasePath") == 0)
    1.15 +	if (strcasecmp(value, "BasePath") == 0)
    1.16  	{
    1.17 +		if (source == ConfigSource_Console)
    1.18 +		{
    1.19 +			UTIL_Format(error, maxlength, "Cannot be set at runtime");
    1.20 +			return ConfigResult_Reject;
    1.21 +		}
    1.22 +
    1.23  		if (!m_GotBasePath)
    1.24  		{
    1.25  			g_LibSys.PathFormat(m_SMBaseDir, sizeof(m_SMBaseDir), "%s/%s", g_BaseDir.c_str(), value);
    1.26  			g_LibSys.PathFormat(m_SMRelDir, sizeof(m_SMRelDir), value);
    1.27  
    1.28  			m_GotBasePath = true;
    1.29 +		}
    1.30  
    1.31 -			return CoreConfig_Okay;
    1.32 -		} else {
    1.33 -			return CoreConfig_NoRuntime;
    1.34 -		}
    1.35 +		return ConfigResult_Accept;
    1.36  	}
    1.37  
    1.38 -	return CoreConfig_InvalidOption;
    1.39 +	return ConfigResult_Ignore;
    1.40  }
    1.41  
    1.42  bool SourceModBase::InitializeSourceMod(char *error, size_t err_max, bool late)
    1.43 @@ -97,7 +105,7 @@
    1.44  	g_CoreConfig.Initialize();
    1.45  
    1.46  	/* This shouldn't happen, but can't hurt to be safe */
    1.47 -	if (!m_GotBasePath || !g_LibSys.PathExists(m_SMBaseDir))
    1.48 +	if (!g_LibSys.PathExists(m_SMBaseDir) || !m_GotBasePath)
    1.49  	{
    1.50  		g_LibSys.PathFormat(m_SMBaseDir, sizeof(m_SMBaseDir), "%s/addons/sourcemod", g_BaseDir.c_str());
    1.51  		g_LibSys.PathFormat(m_SMRelDir, sizeof(m_SMRelDir), "addons/sourcemod");