From 86bf012f50819ed7ab8866d2fce307b47fcd964f Mon Sep 17 00:00:00 2001 From: curt Date: Tue, 11 Feb 2003 21:17:36 +0000 Subject: [PATCH] Erik Hofman: Sort aircraft when using --show-aircraft option. --- src/Main/options.cxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 402130453..0cf352f38 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -32,6 +32,7 @@ #include #include // atof(), atoi() #include // strcmp() +#include #include STL_STRING @@ -62,6 +63,7 @@ SG_USING_STD(string); +SG_USING_STD(sort); SG_USING_NAMESPACE(std); @@ -1872,6 +1874,8 @@ fgUsage (bool verbose) // Show available aircraft types void fgShowAircraft(void) { + vector aircraft; + SGPath path( globals->get_fg_root() ); path.append("Aircraft"); @@ -1884,7 +1888,6 @@ void fgShowAircraft(void) { exit(-1); } - cout << "Available aircraft:" << endl; while ((dire = ulReadDir(dirp)) != NULL) { char *ptr; @@ -1916,9 +1919,15 @@ void fgShowAircraft(void) { snprintf(cstr, 96, " %-27s\n%32c%s", dire->d_name, ' ', (desc) ? desc->getStringValue() : "" ); - cout << cstr << endl; + aircraft.push_back(cstr); } } + sort(aircraft.begin(), aircraft.end()); + cout << "Available aircraft:" << endl; + for (int i = 0; i < aircraft.size(); i++) + cout << aircraft[i] << endl; + + aircraft.clear(); ulCloseDir(dirp); } -- 2.39.5