1
0
Fork 0

Case-insensitive aircraft names, for the startup arg, so 'C172', 'F16', etc work.

This commit is contained in:
jmt 2009-12-05 14:25:31 +00:00 committed by Tim Moore
parent 6fcd9f967b
commit 106aa02b76

View file

@ -49,6 +49,8 @@
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <string> #include <string>
#include <boost/algorithm/string/compare.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <simgear/constants.h> #include <simgear/constants.h>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
@ -137,6 +139,7 @@
#endif #endif
using std::string; using std::string;
using namespace boost::algorithm;
class Sound; class Sound;
extern const char *default_root; extern const char *default_root;
@ -557,7 +560,7 @@ static string fgFindAircraftPath( const SGPath &path, const string &aircraft,
n->setStringValue(path.str().c_str()); n->setStringValue(path.str().c_str());
n->setAttribute(SGPropertyNode::USERARCHIVE, true); n->setAttribute(SGPropertyNode::USERARCHIVE, true);
if ( !strcmp(dire->d_name, aircraft.c_str()) ) { if ( boost::equals(dire->d_name, aircraft.c_str(), is_iequal()) ) {
result = path.str(); result = path.str();
break; break;
} }
@ -640,7 +643,7 @@ bool fgInitConfig ( int argc, char **argv ) {
vector<SGPropertyNode_ptr> cache = cache_root->getChildren("aircraft"); vector<SGPropertyNode_ptr> cache = cache_root->getChildren("aircraft");
for (unsigned int i = 0; i < cache.size(); i++) { for (unsigned int i = 0; i < cache.size(); i++) {
const char *name = cache[i]->getStringValue("file", ""); const char *name = cache[i]->getStringValue("file", "");
if (aircraft_set == name) { if (boost::equals(aircraft_set, name, is_iequal())) {
const char *path = cache[i]->getStringValue("path", ""); const char *path = cache[i]->getStringValue("path", "");
SGPath xml(path); SGPath xml(path);
xml.append(name); xml.append(name);