fixed various retarded errors

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40671
This commit is contained in:
David Anderson 2007-04-05 05:45:35 +00:00
parent 2cb7b5a06a
commit eb006bb665
4 changed files with 14 additions and 5 deletions

View File

@ -51,7 +51,11 @@ void CoreConfig::OnRootConsoleCommand(const char *command, unsigned int argcount
if (err == ConfigResult_Reject) if (err == ConfigResult_Reject)
{ {
g_Logger.LogError("Could not set config option \"%s\" to \"%s\" (error: %s)", option, value, error); g_RootMenu.ConsolePrint("Could not set config option \"%s\" to \"%s\" (%s)", option, value, error);
} else if (err == ConfigResult_Ignore) {
g_RootMenu.ConsolePrint("No such config option \"%s\" exists.", option);
} else {
g_RootMenu.ConsolePrint("Config option \"%s\" successfully set to \"%s.\"", option, value);
} }
return; return;
@ -81,7 +85,7 @@ void CoreConfig::Initialize()
if ((err=g_TextParser.ParseFile_SMC(filePath, this, NULL, NULL)) if ((err=g_TextParser.ParseFile_SMC(filePath, this, NULL, NULL))
!= SMCParse_Okay) != SMCParse_Okay)
{ {
/* :TODO: This won't actually log or print anything :( - So fix that somehow */ /* :TODO: This won't actually log or print anything :( - So fix that somehow */
const char *error = g_TextParser.GetSMCErrorString(err); const char *error = g_TextParser.GetSMCErrorString(err);
g_Logger.LogFatal("[SM] Error encountered parsing core config file: %s", error ? error : ""); g_Logger.LogFatal("[SM] Error encountered parsing core config file: %s", error ? error : "");
} }
@ -95,7 +99,7 @@ SMCParseResult CoreConfig::ReadSMC_KeyValue(const char *key, const char *value,
if (err == ConfigResult_Reject) if (err == ConfigResult_Reject)
{ {
/* This is a fatal error */ /* This is a fatal error */
g_Logger.LogFatal("%s", error); g_Logger.LogFatal("Config error (key: %s) (value: %s) %s", key, value, error);
} }
return SMCParse_Continue; return SMCParse_Continue;

View File

@ -427,6 +427,11 @@ void Logger::DisableLogging()
void Logger::LogFatal(const char *msg, ...) void Logger::LogFatal(const char *msg, ...)
{ {
/* :TODO: make this print all pretty-like
* In fact, the pretty log printing function should be abstracted.
* It's already implemented twice which is bad.
*/
char path[PLATFORM_MAX_PATH]; char path[PLATFORM_MAX_PATH];
g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "sourcemod_fatal.log"); g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "sourcemod_fatal.log");
FILE *fp = fopen(path, "at"); FILE *fp = fopen(path, "at");

View File

@ -610,7 +610,7 @@ ConfigResult Translator::OnSourceModConfigChanged(const char *key,
char *error, char *error,
size_t maxlength) size_t maxlength)
{ {
if (strcasecmp(value, "ServerLang") == 0) if (strcasecmp(key, "ServerLang") == 0)
{ {
if (source == ConfigSource_Console) if (source == ConfigSource_Console)
{ {

View File

@ -75,7 +75,7 @@ ConfigResult SourceModBase::OnSourceModConfigChanged(const char *key,
char *error, char *error,
size_t maxlength) size_t maxlength)
{ {
if (strcasecmp(value, "BasePath") == 0) if (strcasecmp(key, "BasePath") == 0)
{ {
if (source == ConfigSource_Console) if (source == ConfigSource_Console)
{ {