1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-21 05:29:11 +00:00

(svn r24099) -Add: Output list of -d option facilities with in the help text.

This commit is contained in:
alberth
2012-04-07 20:55:55 +00:00
parent fd2900f863
commit b57bef91a1
3 changed files with 29 additions and 0 deletions

View File

@@ -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)
/**