summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/console.cpp11
-rw-r--r--src/console_cmds.cpp6
-rw-r--r--src/settings_type.h1
-rw-r--r--src/table/settings.h2
4 files changed, 8 insertions, 12 deletions
diff --git a/src/console.cpp b/src/console.cpp
index e2c0bbf33..89b38c590 100644
--- 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 @@ 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);
}
/**
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 1b4eac61d..cfd46e042 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -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 */
diff --git a/src/settings_type.h b/src/settings_type.h
index b875844f7..8a7c15ed4 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -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
};
diff --git a/src/table/settings.h b/src/table/settings.h
index 4958e0f3b..8dd38a635 100644
--- a/src/table/settings.h
+++ b/src/table/settings.h
@@ -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