mirror of https://github.com/OpenTTD/OpenTTD
(svn r22007) -Change: only show one AI per unique ID instead of all versions in the output of "openttd -h"
parent
64cba95fbe
commit
79fd8a362b
|
@ -125,7 +125,7 @@ public:
|
||||||
static int GetStartNextTime();
|
static int GetStartNextTime();
|
||||||
|
|
||||||
/** Wrapper function for AIScanner::GetAIConsoleList */
|
/** Wrapper function for AIScanner::GetAIConsoleList */
|
||||||
static char *GetConsoleList(char *p, const char *last);
|
static char *GetConsoleList(char *p, const char *last, bool newest_only = false);
|
||||||
/** Wrapper function for AIScanner::GetAIConsoleLibraryList */
|
/** Wrapper function for AIScanner::GetAIConsoleLibraryList */
|
||||||
static char *GetConsoleLibraryList(char *p, const char *last);
|
static char *GetConsoleLibraryList(char *p, const char *last);
|
||||||
/** Wrapper function for AIScanner::GetAIInfoList */
|
/** Wrapper function for AIScanner::GetAIInfoList */
|
||||||
|
|
|
@ -289,9 +289,9 @@ void CcAI(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
|
||||||
return DAYS_IN_YEAR;
|
return DAYS_IN_YEAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ char *AI::GetConsoleList(char *p, const char *last)
|
/* static */ char *AI::GetConsoleList(char *p, const char *last, bool newest_only)
|
||||||
{
|
{
|
||||||
return AI::ai_scanner->GetAIConsoleList(p, last);
|
return AI::ai_scanner->GetAIConsoleList(p, last, newest_only);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ char *AI::GetConsoleLibraryList(char *p, const char *last)
|
/* static */ char *AI::GetConsoleLibraryList(char *p, const char *last)
|
||||||
|
|
|
@ -330,11 +330,12 @@ AIInfo *AIScanner::FindInfo(const char *nameParam, int versionParam, bool force_
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *AIScanner::GetAIConsoleList(char *p, const char *last) const
|
char *AIScanner::GetAIConsoleList(char *p, const char *last, bool newest_only) const
|
||||||
{
|
{
|
||||||
p += seprintf(p, last, "List of AIs:\n");
|
p += seprintf(p, last, "List of AIs:\n");
|
||||||
AIInfoList::const_iterator it = this->info_list.begin();
|
const AIInfoList &list = newest_only ? this->info_single_list : this->info_list;
|
||||||
for (; it != this->info_list.end(); it++) {
|
AIInfoList::const_iterator it = list.begin();
|
||||||
|
for (; it != list.end(); it++) {
|
||||||
AIInfo *i = (*it).second;
|
AIInfo *i = (*it).second;
|
||||||
p += seprintf(p, last, "%10s (v%d): %s\n", i->GetName(), i->GetVersion(), i->GetDescription());
|
p += seprintf(p, last, "%10s (v%d): %s\n", i->GetName(), i->GetVersion(), i->GetDescription());
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Get the list of available AIs for the console.
|
* Get the list of available AIs for the console.
|
||||||
*/
|
*/
|
||||||
char *GetAIConsoleList(char *p, const char *last) const;
|
char *GetAIConsoleList(char *p, const char *last, bool newest_only) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of available AI Libraries for the console.
|
* Get the list of available AI Libraries for the console.
|
||||||
|
|
|
@ -204,7 +204,7 @@ static void ShowHelp()
|
||||||
/* We need to initialize the AI, so it finds the AIs */
|
/* We need to initialize the AI, so it finds the AIs */
|
||||||
TarScanner::DoScan();
|
TarScanner::DoScan();
|
||||||
AI::Initialize();
|
AI::Initialize();
|
||||||
p = AI::GetConsoleList(p, lastof(buf));
|
p = AI::GetConsoleList(p, lastof(buf), true);
|
||||||
AI::Uninitialize(true);
|
AI::Uninitialize(true);
|
||||||
|
|
||||||
/* ShowInfo put output to stderr, but version information should go
|
/* ShowInfo put output to stderr, but version information should go
|
||||||
|
|
Loading…
Reference in New Issue