Mercurial > hg > openttd
changeset 14511:b755671f7cbb draft
(svn r19082) -Codechange: make 'developer' a regular setting
author | smatz <smatz@openttd.org> |
---|---|
date | Wed, 10 Feb 2010 17:01:03 +0000 |
parents | 38952764f91f |
children | e53f601a581c |
files | src/console.cpp src/console_cmds.cpp src/settings_type.h src/table/settings.h |
diffstat | 4 files changed, 8 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/console.cpp +++ b/src/console.cpp @@ -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 @@ 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 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 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); } /**
--- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -1781,9 +1781,6 @@ 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 @@ 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 @@ 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 */
--- a/src/settings_type.h +++ b/src/settings_type.h @@ -106,6 +106,7 @@ 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 };
--- a/src/table/settings.h +++ b/src/table/settings.h @@ -599,7 +599,7 @@ #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