summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dbg-util.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2010-11-01 00:41:42 +0100
committerAdam Borowski <kilobyte@angband.pl>2010-11-01 00:44:36 +0100
commit8c8a9865ea16df63b06a374415fc54bdaf07d787 (patch)
tree1cc7df30e13dde1fcff0c1de2ca38a26a70b1ff2 /crawl-ref/source/dbg-util.cc
parent5b1c13fbe968c539ac3221c41b215b569c0db9d7 (diff)
downloadcrawl-ref-8c8a9865ea16df63b06a374415fc54bdaf07d787.tar.gz
crawl-ref-8c8a9865ea16df63b06a374415fc54bdaf07d787.zip
Add a quick and dirty debugging function for where dprf() is of no use.
I use a similar include, but there's no reason to not have this properly as a part of the project -- as others can benefit from it as well. Something like this is needed for times such as debugging the save browser or the text display itself.
Diffstat (limited to 'crawl-ref/source/dbg-util.cc')
-rw-r--r--crawl-ref/source/dbg-util.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/crawl-ref/source/dbg-util.cc b/crawl-ref/source/dbg-util.cc
index e27e85e696..ebef7008da 100644
--- a/crawl-ref/source/dbg-util.cc
+++ b/crawl-ref/source/dbg-util.cc
@@ -401,3 +401,23 @@ int debug_cap_stat(int stat)
stat > 127 ? 127
: stat);
}
+
+#ifdef DEBUG
+static FILE *debugf = 0;
+
+void debuglog(const char *format, ...)
+{
+ va_list args;
+
+ if (!debugf)
+ {
+ debugf = fopen("debuglog.txt", "w");
+ ASSERT(debugf);
+ }
+
+ va_start(args, format);
+ vfprintf(debugf, format, args);
+ va_end(args);
+ fflush(debugf);
+}
+#endif