|
|
|
@ -4,6 +4,7 @@
|
|
|
|
|
#include "ttd.h"
|
|
|
|
|
#include "console.h"
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
#include "string.h"
|
|
|
|
|
|
|
|
|
|
int _debug_ai_level;
|
|
|
|
|
int _debug_grf_level;
|
|
|
|
@ -28,13 +29,6 @@ void CDECL debug(const char *s, ...)
|
|
|
|
|
IConsoleDebug(buf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SetDebugString(const char *s)
|
|
|
|
|
{
|
|
|
|
|
int v;
|
|
|
|
|
char *end;
|
|
|
|
|
const char *t;
|
|
|
|
|
|
|
|
|
|
typedef struct DebugLevel {
|
|
|
|
|
const char *name;
|
|
|
|
|
int *level;
|
|
|
|
@ -54,6 +48,12 @@ void SetDebugString(const char *s)
|
|
|
|
|
};
|
|
|
|
|
#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;
|
|
|
|
@ -96,3 +96,25 @@ void SetDebugString(const char *s)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 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;
|
|
|
|
|
}
|
|
|
|
|