From c19712dccc188791c96dd89f0b43b7973f410ba1 Mon Sep 17 00:00:00 2001 From: Asher Baker Date: Thu, 15 Nov 2012 17:49:13 +0000 Subject: [PATCH] Improved console config editing (bug 5470, r=psychonic). --- core/CoreConfig.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/core/CoreConfig.cpp b/core/CoreConfig.cpp index 010667db..f9d3141f 100644 --- a/core/CoreConfig.cpp +++ b/core/CoreConfig.cpp @@ -193,17 +193,30 @@ void CoreConfig::OnRootConsoleCommand(const char *cmdname, const CCommand &comma if (res == ConfigResult_Reject) { - g_RootMenu.ConsolePrint("[SM] Could not set config option \"%s\" to \"%s\" (%s)", option, value, error); + g_RootMenu.ConsolePrint("[SM] Could not set config option \"%s\" to \"%s\". (%s)", option, value, error); } else if (res == ConfigResult_Ignore) { g_RootMenu.ConsolePrint("[SM] No such config option \"%s\" exists.", option); } else { - g_RootMenu.ConsolePrint("Config option \"%s\" successfully set to \"%s.\"", option, value); + g_RootMenu.ConsolePrint("[SM] Config option \"%s\" successfully set to \"%s\".", option, value); } + return; + } else if (argcount >= 3) { + const char *option = command.Arg(2); + + const char *value = GetCoreConfigValue(option); + + if (value == NULL) + { + g_RootMenu.ConsolePrint("[SM] No such config option \"%s\" exists.", option); + } else { + g_RootMenu.ConsolePrint("[SM] Config option \"%s\" is set to \"%s\".", option, value); + } + return; } - g_RootMenu.ConsolePrint("[SM] Usage: sm config