]> git.mxchange.org Git - flightgear.git/blobdiff - src/Airports/xmlloader.cxx
Some cleanup in the ATC/AI code before merging with the next branch:
[flightgear.git] / src / Airports / xmlloader.cxx
index 7579e8cc4c4d404d9a0fb10e7b387e38935e10e5..3d65f7756611241764dab8025d71da53682c44d1 100644 (file)
@@ -14,8 +14,8 @@
 //
 
 #include <simgear/misc/sg_path.hxx>
-
 #include <simgear/xml/easyxml.hxx>
+#include <simgear/misc/strutils.hxx>
 
 #include <Main/globals.hxx>
 #include <Main/fg_props.hxx>
@@ -34,7 +34,7 @@ XMLLoader::~XMLLoader() {}
 
 void XMLLoader::load(FGAirportDynamics* d) {
   FGAirportDynamicsXMLLoader visitor(d);
-  if (fgGetBool("/sim/traffic-manager/use-custom-scenery-data") == false) {
+  if (fgGetBool("/sim/paths/use-custom-scenery-data") == false) {
    SGPath parkpath( globals->get_fg_root() );
    parkpath.append( "/AI/Airports/" );
    parkpath.append( d->getId() );
@@ -57,7 +57,7 @@ void XMLLoader::load(FGAirportDynamics* d) {
 
 void XMLLoader::load(FGRunwayPreference* p) {
   FGRunwayPreferenceXMLLoader visitor(p);
-  if (fgGetBool("/sim/traffic-manager/use-custom-scenery-data") == false) {
+  if (fgGetBool("/sim/paths/use-custom-scenery-data") == false) {
     SGPath rwyPrefPath( globals->get_fg_root() );
     rwyPrefPath.append( "AI/Airports/" );
     rwyPrefPath.append( p->getId() );
@@ -84,11 +84,16 @@ void XMLLoader::load(FGSidStar* p) {
 bool XMLLoader::findAirportData(const std::string& aICAO, 
     const std::string& aFileName, SGPath& aPath)
 {
+  string fileName(aFileName);
+  if (!simgear::strutils::ends_with(aFileName, ".xml")) {
+    fileName.append(".xml");
+  }
+  
   string_list sc = globals->get_fg_scenery();
   char buffer[128];
-  ::snprintf(buffer, 128, "%c/%c/%c/%s.%s.xml", 
+  ::snprintf(buffer, 128, "%c/%c/%c/%s.%s", 
     aICAO[0], aICAO[1], aICAO[2], 
-    aICAO.c_str(), aFileName.c_str());
+    aICAO.c_str(), fileName.c_str());
 
   for (string_list_iterator it = sc.begin(); it != sc.end(); ++it) {
     SGPath path(*it);