summaryrefslogtreecommitdiff
path: root/ttd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-02-05 15:58:59 +0000
committertron <tron@openttd.org>2005-02-05 15:58:59 +0000
commitf0f85a7ef3dd7502657138bea7575dd54f6f8bdb (patch)
tree3f6b444dbf38fd09dbe9c5e0be19e8b6fa53c8a4 /ttd.c
parent77b3a76919bc243d16c216ae61b588f6e3be9cb0 (diff)
downloadopenttd-f0f85a7ef3dd7502657138bea7575dd54f6f8bdb.tar.xz
(svn r1803) Move debugging stuff into files of it's own
Diffstat (limited to 'ttd.c')
-rw-r--r--ttd.c77
1 files changed, 1 insertions, 76 deletions
diff --git a/ttd.c b/ttd.c
index db522fdf6..f26e4d896 100644
--- a/ttd.c
+++ b/ttd.c
@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "table/strings.h"
+#include "debug.h"
#include "map.h"
#include "tile.h"
@@ -71,17 +72,6 @@ void CDECL error(const char *s, ...) {
exit(1);
}
-void CDECL debug(const char *s, ...)
-{
- va_list va;
- char buf[1024];
- va_start(va, s);
- vsprintf(buf, s, va);
- va_end(va);
- fprintf(stderr, "dbg: %s\n", buf);
- IConsoleDebug(buf);
-}
-
void CDECL ShowInfoF(const char *str, ...)
{
va_list va;
@@ -431,71 +421,6 @@ md_continue_here:;
}
}
-void SetDebugString(const char *s)
-{
- int v;
- char *end;
- const char *t;
-
- typedef struct DebugLevel {
- const char* name;
- int* level;
- } DebugLevel;
-
- #define DEBUG_LEVEL(x) { #x, &_debug_##x##_level }
- static const DebugLevel debug_level[] = {
- DEBUG_LEVEL(ai),
- DEBUG_LEVEL(grf),
- DEBUG_LEVEL(map),
- DEBUG_LEVEL(misc),
- DEBUG_LEVEL(ms),
- DEBUG_LEVEL(net),
- DEBUG_LEVEL(spritecache)
- };
- #undef DEBUG_LEVEL
-
- // global debugging level?
- if (*s >= '0' && *s <= '9') {
- const DebugLevel *i;
-
- v = strtoul(s, &end, 0);
- s = end;
-
- for (i = debug_level; i != endof(debug_level); ++i)
- *i->level = v;
- }
-
- // individual levels
- for(;;) {
- const DebugLevel *i;
- int *p;
-
- // skip delimiters
- while (*s == ' ' || *s == ',' || *s == '\t') s++;
- if (*s == 0) break;
-
- t = s;
- while (*s >= 'a' && *s <= 'z') s++;
-
- // check debugging levels
- p = NULL;
- for (i = debug_level; i != endof(debug_level); ++i)
- if (s == t + strlen(i->name) && strncmp(t, i->name, s - t) == 0) {
- p = i->level;
- break;
- }
-
- if (*s == '=') s++;
- v = strtoul(s, &end, 0);
- s = end;
- if (p != NULL)
- *p = v;
- else {
- ShowInfoF("Unknown debug level '%.*s'", s - t, t);
- return;
- }
- }
-}
static void ParseResolution(int res[2], char *s)
{