summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2012-04-07 20:55:55 +0000
committeralberth <alberth@openttd.org>2012-04-07 20:55:55 +0000
commitb57bef91a12eb78dcd1fb3f106463b9081f09ef0 (patch)
treee571b0011032e68d924841bb1f0d01f4ea791c10 /src
parentfd2900f863a81f24c3a2b921fbaf2743526525a4 (diff)
downloadopenttd-b57bef91a12eb78dcd1fb3f106463b9081f09ef0.tar.xz
(svn r24099) -Add: Output list of -d option facilities with in the help text.
Diffstat (limited to 'src')
-rw-r--r--src/debug.cpp25
-rw-r--r--src/debug.h1
-rw-r--r--src/openttd.cpp3
3 files changed, 29 insertions, 0 deletions
diff --git a/src/debug.cpp b/src/debug.cpp
index fe5b0d3fd..11166dafe 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -73,6 +73,31 @@ struct DebugLevel {
};
#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)
/**
diff --git a/src/debug.h b/src/debug.h
index 263ba0356..ecb6a59b7 100644
--- 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();
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 3c8047b26..155dd9cf2 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -192,6 +192,9 @@ static void ShowHelp()
/* 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);