Mercurial > hg > openttd
changeset 19214:cd90b3c2ff49 draft
(svn r24099) -Add: Output list of -d option facilities with in the help text.
author | alberth <alberth@openttd.org> |
---|---|
date | Sat, 07 Apr 2012 20:55:55 +0000 |
parents | 356d49e63ccd |
children | a4e7c26673b4 |
files | src/debug.cpp src/debug.h src/openttd.cpp |
diffstat | 3 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/debug.cpp +++ b/src/debug.cpp @@ -73,6 +73,31 @@ }; #undef DEBUG_LEVEL +/** + * Dump the available debug facility names in the help text. + * @param buf Start address for storing the output. + * @param last Last valid address for storing the output. + * @return Next free position in the output. + */ +char *DumpDebugFacilityNames(char *buf, char *last) +{ + int length = 0; + for (const DebugLevel *i = debug_level; i != endof(debug_level); ++i) { + if (length == 0) { + buf = strecpy(buf, "List of debug facility names:\n", last); + } else { + buf = strecpy(buf, ", ", last); + length += 2; + } + buf = strecpy(buf, i->name, last); + length += strlen(i->name); + } + if (length > 0) { + buf = strecpy(buf, "\n\n", last); + } + return buf; +} + #if !defined(NO_DEBUG_MESSAGES) /**
--- a/src/debug.h +++ b/src/debug.h @@ -58,6 +58,7 @@ void CDECL debug(const char *dbg, const char *format, ...) WARN_FORMAT(2, 3); #endif /* NO_DEBUG_MESSAGES */ +char *DumpDebugFacilityNames(char *buf, char *last); void SetDebugString(const char *s); const char *GetDebugString();
--- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -192,6 +192,9 @@ /* List the blitters */ p = BlitterFactoryBase::GetBlittersInfo(p, lastof(buf)); + /* List the debug facilities. */ + p = DumpDebugFacilityNames(p, lastof(buf)); + /* We need to initialize the AI, so it finds the AIs */ AI::Initialize(); p = AI::GetConsoleList(p, lastof(buf), true);