diff options
author | Adam Borowski <kilobyte@angband.pl> | 2013-01-10 04:41:57 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2013-01-10 04:46:07 +0100 |
commit | b31cafb7cd4508bc2d8a704d7b5e7deb10f4a892 (patch) | |
tree | 7da80a68995f96beb48d4ad29024229f7073b138 /crawl-ref/source/dbg-util.cc | |
parent | db8f331c33a376f6c976655d8f2e0de4906eb1b7 (diff) | |
download | crawl-ref-b31cafb7cd4508bc2d8a704d7b5e7deb10f4a892.tar.gz crawl-ref-b31cafb7cd4508bc2d8a704d7b5e7deb10f4a892.zip |
A basic interface for manually togging dprf quietness.
Diffstat (limited to 'crawl-ref/source/dbg-util.cc')
-rw-r--r-- | crawl-ref/source/dbg-util.cc | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/crawl-ref/source/dbg-util.cc b/crawl-ref/source/dbg-util.cc index 6cafc7bcc7..c32d89329d 100644 --- a/crawl-ref/source/dbg-util.cc +++ b/crawl-ref/source/dbg-util.cc @@ -16,11 +16,13 @@ #include "libutil.h" #include "message.h" #include "mon-util.h" +#include "options.h" #include "religion.h" #include "shopping.h" #include "skills2.h" -#include "state.h" #include "spl-util.h" +#include "state.h" +#include "stuff.h" monster_type debug_prompt_for_monster(void) { @@ -402,3 +404,60 @@ void debuglog(const char *format, ...) fflush(debugf); } #endif + +#ifndef DEBUG_DIAGNOSTICS +void wizard_toggle_dprf() +{ + mpr("Diagnostic messages are available only in debug builds."); +} +#else +static const char* diag_names[] = +{ + "normal", + "combat", + "beam", + "abyss", + "monplace", +}; + +void wizard_toggle_dprf() +{ + COMPILE_CHECK(ARRAYSZ(diag_names) == NUM_DIAGNOSTICS); + + while (true) + { + string line; + for (int i = 0; i < NUM_DIAGNOSTICS; i++) + { + line += make_stringf("%s[%c] %-10s%s ", + Options.quiet_debug_messages[i] ? "<white>" : "", + i + '0', + diag_names[i], + Options.quiet_debug_messages[i] ? "</white>" : ""); + if (i % 5 == 4 || i == NUM_DIAGNOSTICS - 1) + { + mpr(line, MSGCH_PROMPT); + line.clear(); + } + } + mpr("Toggle which debug class (ESC to exit)? ", MSGCH_PROMPT); + + int keyin = toalower(get_ch()); + + if (key_is_escape(keyin) || keyin == ' ' + || keyin == '\r' || keyin == '\n') + { + return mpr("M'kay."); + } + + if (keyin < '0' || keyin >= '0' + NUM_DIAGNOSTICS) + continue; + + int diag = keyin - '0'; + Options.quiet_debug_messages.set(diag, !Options.quiet_debug_messages[diag]); + mprf("%s messages will be %s.", diag_names[diag], + Options.quiet_debug_messages[diag] ? "quiet" : "printed"); + return; + } +} +#endif |