Files
@ r4381:c965d1f3016a
Branch filter:
Location: cpp/openttd-patchpack/source/debug.c - annotation
r4381:c965d1f3016a
2.4 KiB
text/x-c
(svn r6131) -Codechange : Complete all missing _ttdpatch_flags entries
-Feature : both unifiedmaglevmode are now set.
Maglev and monorail are not allowed to run on each other tracks and will not be.
Setting those flags will allow grfsets as the Norvegian one to be loaded
-Codechange : link the TTDPatch's irregularstations with OTTD's nonuniform_stations
-Codechange : Reformat the whole array (thanks Rubidium, it sure looks better now)
-Feature : both unifiedmaglevmode are now set.
Maglev and monorail are not allowed to run on each other tracks and will not be.
Setting those flags will allow grfsets as the Norvegian one to be loaded
-Codechange : link the TTDPatch's irregularstations with OTTD's nonuniform_stations
-Codechange : Reformat the whole array (thanks Rubidium, it sure looks better now)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | r2186:5ee653b1b5e1 r2186:5ee653b1b5e1 r1302:2f26ebcfbebf r1302:2f26ebcfbebf r1299:07d5483b3f76 r1891:c5c5466afa35 r1299:07d5483b3f76 r1299:07d5483b3f76 r2163:ae001e2aa5b0 r1847:b42491f4b815 r1299:07d5483b3f76 r1299:07d5483b3f76 r2210:ed1be54700ae r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1322:ac830d6af496 r2125:87ebf6378cb6 r1678:650b403b6981 r3900:1c2675abec23 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r2210:ed1be54700ae r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r2125:87ebf6378cb6 r3900:1c2675abec23 r3900:1c2675abec23 r1847:b42491f4b815 r1847:b42491f4b815 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r2639:e298192a7c03 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r2639:e298192a7c03 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r2639:e298192a7c03 r1299:07d5483b3f76 r2639:e298192a7c03 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1299:07d5483b3f76 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 r1847:b42491f4b815 | /* $Id$ */
#include "stdafx.h"
#include <stdio.h>
#include <stdarg.h>
#include "openttd.h"
#include "console.h"
#include "debug.h"
#include "functions.h"
#include "string.h"
int _debug_ai_level;
int _debug_driver_level;
int _debug_grf_level;
int _debug_map_level;
int _debug_misc_level;
int _debug_ms_level;
int _debug_net_level;
int _debug_spritecache_level;
int _debug_oldloader_level;
int _debug_ntp_level;
int _debug_npf_level;
int _debug_yapf_level;
void CDECL debug(const char *s, ...)
{
va_list va;
char buf[1024];
va_start(va, s);
vsnprintf(buf, lengthof(buf), s, va);
va_end(va);
fprintf(stderr, "dbg: %s\n", buf);
IConsoleDebug(buf);
}
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(driver),
DEBUG_LEVEL(grf),
DEBUG_LEVEL(map),
DEBUG_LEVEL(misc),
DEBUG_LEVEL(ms),
DEBUG_LEVEL(net),
DEBUG_LEVEL(spritecache),
DEBUG_LEVEL(oldloader),
DEBUG_LEVEL(ntp),
DEBUG_LEVEL(npf),
DEBUG_LEVEL(yapf)
};
#undef DEBUG_LEVEL
void SetDebugString(const char *s)
{
int v;
char *end;
const char *t;
// 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;
}
}
}
/** Print out the current debug-level
* Just return a string with the values of all the debug categorites
* @return string with debug-levels
*/
const char *GetDebugString(void)
{
const DebugLevel *i;
static char dbgstr[100];
char dbgval[20];
memset(dbgstr, 0, sizeof(dbgstr));
i = debug_level;
snprintf(dbgstr, sizeof(dbgstr), "%s=%d", i->name, *i->level);
for (i++; i != endof(debug_level); i++) {
snprintf(dbgval, sizeof(dbgval), ", %s=%d", i->name, *i->level);
ttd_strlcat(dbgstr, dbgval, sizeof(dbgstr));
}
return dbgstr;
}
|