(svn r19082) -Codechange: make 'developer' a regular setting

This commit is contained in:
smatz 2010-02-10 17:01:03 +00:00
parent 21bd2722cd
commit d8a0278cf2
4 changed files with 8 additions and 12 deletions

View File

@ -15,6 +15,7 @@
#include "network/network_func.h"
#include "debug.h"
#include "console_func.h"
#include "settings_type.h"
#include <stdarg.h>
@ -31,8 +32,6 @@ IConsoleCmd *_iconsole_cmds; ///< list of registred commands
IConsoleVar *_iconsole_vars; ///< list of registred vars
IConsoleAlias *_iconsole_aliases; ///< list of registred aliases
/* ** stdlib ** */
byte _stdlib_developer = 1;
FILE *_iconsole_output_file;
void IConsoleInit()
@ -145,8 +144,8 @@ void CDECL IConsolePrintF(ConsoleColour colour_code, const char *format, ...)
*/
void IConsoleDebug(const char *dbg, const char *string)
{
if (_stdlib_developer > 1)
IConsolePrintF(CC_DEBUG, "dbg: [%s] %s", dbg, string);
if (_settings_client.gui.developer <= 1) return;
IConsolePrintF(CC_DEBUG, "dbg: [%s] %s", dbg, string);
}
/**
@ -156,8 +155,8 @@ void IConsoleDebug(const char *dbg, const char *string)
*/
void IConsoleWarning(const char *string)
{
if (_stdlib_developer > 0)
IConsolePrintF(CC_WARNING, "WARNING: %s", string);
if (_settings_client.gui.developer == 0) return;
IConsolePrintF(CC_WARNING, "WARNING: %s", string);
}
/**

View File

@ -1781,9 +1781,6 @@ static void IConsoleDebugLibRegister()
void IConsoleStdLibRegister()
{
/* stdlib */
extern byte _stdlib_developer; // XXX extern in .cpp
/* default variables and functions */
IConsoleCmdRegister("debug_level", ConDebugLevel);
IConsoleCmdRegister("dump_vars", ConListDumpVariables);
@ -1831,6 +1828,7 @@ void IConsoleStdLibRegister()
IConsoleAliasRegister("set", "setting %+");
IConsoleAliasRegister("set_newgame", "setting_newgame %+");
IConsoleAliasRegister("list_patches", "list_settings %+");
IConsoleAliasRegister("developer", "setting developer %+");
#ifdef ENABLE_AI
IConsoleCmdRegister("list_ai", ConListAI);
@ -1840,8 +1838,6 @@ void IConsoleStdLibRegister()
IConsoleCmdRegister("stop_ai", ConStopAI);
#endif /* ENABLE_AI */
IConsoleVarRegister("developer", &_stdlib_developer, ICONSOLE_VAR_BYTE, "Redirect debugging output from the console/command line to the ingame console (value 2). Default value: 1");
/* networking variables and functions */
#ifdef ENABLE_NETWORK
/* Network hooks; only active in network */

View File

@ -106,6 +106,7 @@ struct GUISettings {
uint8 network_chat_box_height; ///< height of the chat box in lines
#endif
uint8 developer; ///< print non-fatal warnings in console (>= 1), copy debug output to console (== 2)
bool show_date_in_logs; ///< whether to show dates in console logs
};

View File

@ -599,7 +599,7 @@ const SettingDesc _settings[] = {
#else
SDTC_BOOL(gui.show_date_in_logs, S, 0, false, STR_NULL, NULL),
#endif
SDTC_VAR(gui.developer, SLE_UINT8, S, 0, 1, 0, 2, 0, STR_NULL, NULL),
SDTC_VAR(gui.console_backlog_timeout, SLE_UINT16, S, 0, 100, 10, 65500, 0, STR_NULL, NULL),
SDTC_VAR(gui.console_backlog_length, SLE_UINT16, S, 0, 100, 10, 65500, 0, STR_NULL, NULL),
#ifdef ENABLE_NETWORK