]> git.mxchange.org Git - flightgear.git/commitdiff
Adjust fg-aircraft handling back to original style.
authorJames Turner <zakalawe@mac.com>
Wed, 22 Jan 2014 10:56:04 +0000 (10:56 +0000)
committerJames Turner <zakalawe@mac.com>
Wed, 22 Jan 2014 10:56:04 +0000 (10:56 +0000)
- startup code will warn and fix the alternate style
- man page now documents the option

man/fgfs.1.in
src/AIModel/AIBase.cxx
src/Main/AircraftDirVisitorBase.hxx
src/Main/globals.cxx

index 6e1c166d8f07ae2b82a3c10644652e938e4f5f66..464212afe34a09744de555aaec3c41963acd4764 100644 (file)
@@ -40,8 +40,8 @@ Specify aerodynamics model to load.
 Specify aircraft to load.
 .TP
 .BI "--aircraft-dir=" "path"
-Specify the aircraft model directory relative to the path of the
-executable.  This is used for UIUC aircraft only.
+Specify the exact directory to use for the aircraft (normally not required,
+but may be useful for testing).
 .TP
 .BI "--airport=" "id"
 Specify starting postion by airport ID.
@@ -226,6 +226,9 @@ or electrical.  Multiple instances allowed.
 Specify the flight dynamics model to use.  Name may be one of jsb, larcsim,
 yasim, magic, balloon, ada, external, or null.
 .TP
+.BI "--fg-aircraft=" "path"
+Specify an additional path to search for aircraft directories. (can be repeated)
+.TP
 .BI "--fg-root=" "path"
 Specify the root path for data files.
 .TP
index eede54b6a1a9df8782c42844aff07ec5b81e9a35..a648a35c955d1a8f1ecb2406b57222449e9d4211 100644 (file)
@@ -346,31 +346,17 @@ bool FGAIBase::init(bool search_in_AI_path)
     string f;
     if(search_in_AI_path)
     {
-    // setup a modified Options structure, with only the $fg-root/AI defined;
-    // we'll check that first, then give the normal search logic a chance.
-    // this ensures that models in AI/ are preferred to normal models, where
-    // both exist.
-        osg::ref_ptr<osgDB::ReaderWriter::Options> 
-          opt(osg::clone(osgDB::Registry::instance()->getOptions(), osg::CopyOp::SHALLOW_COPY));
-
-        osgDB::FilePathList& paths(opt->getDatabasePathList());
-        paths.clear();
         BOOST_FOREACH(SGPath p, globals->get_data_paths("AI")) {
-            paths.push_back(p.str());
-        }
-
-        // search models in --fg-aircraft paths;
-        // when a copy of an aircraft is in --fg-aircraft paths
-        // we want to load this one instead of the default one from fgdata/Aircraft
-        BOOST_FOREACH(SGPath p, globals->get_aircraft_paths()) {
-            paths.push_back(p.str());
-        }
-
-        f = osgDB::findDataFile(model_path, opt.get());
-    }
+            p.append(model_path);
+            if (p.exists()) {
+                f = p.str();
+                break;
+            }
+        } // of AI data paths iteration
+    } // of search in AI path
 
     if (f.empty()) {
-      f = simgear::SGModelLib::findDataFile(model_path);
+        f = simgear::SGModelLib::findDataFile(model_path);
     }
     
     if(f.empty())
index 1096a788d3adb5c3e2f701be439957c7d8cd3c38..78e7c90b8eabd3385533974db9164342efdc4d3f 100644 (file)
@@ -47,14 +47,6 @@ protected:
         string_list::const_iterator it = paths.begin();
         for (; it != paths.end(); ++it) {
             SGPath p(*it);
-        // additional aircraft-paths are supposed to specify the directory
-        // containing the 'Aircraft' dir (same structure as fg-root, so cross-
-        // aircraft resource paths can be resolved correctly). Some users omit
-        // this, so check for both.
-            p.append("Aircraft");
-            if (!p.exists())
-                p = SGPath(*it);
-            
             VisitResult vr = visitDir(p, 0);
             if (vr != VISIT_CONTINUE) {
                 return vr;
index e21e5b59127c05ca913e9671e22ef9b6e7e2880d..d57defc0fe88594d857a65413954fc464f786e1f 100644 (file)
@@ -406,19 +406,13 @@ void FGGlobals::append_aircraft_path(const std::string& path)
     
   SGPath acSubdir(dirPath);
   acSubdir.append("Aircraft");
-  if (!acSubdir.exists()) {
-      if (dirPath.file() == "Aircraft") {
-          dirPath = dirPath.dir();
-          SG_LOG(SG_GENERAL, SG_WARN, "Specified an aircraft-dir path ending in 'Aircraft':" << path
-                 << ", will instead use parent directory:" << dirPath);
-      } else {
-          SG_LOG(SG_GENERAL, SG_ALERT, "Aircraft-dir path '" << path <<
-             "' does not contain an 'Aircraft' subdirectory, cross-aircraft paths will not resolve correctly.");
-      }
+  if (acSubdir.exists()) {
+      SG_LOG(SG_GENERAL, SG_WARN, "Specified an aircraft-dir with an 'Aircraft' subdirectory:" << dirPath
+                 << ", will instead use child directory:" << acSubdir);
+      dirPath = acSubdir;
   }
     
   std::string abspath = dirPath.realpath();
-  
   unsigned int index = fg_aircraft_dirs.size();  
   fg_aircraft_dirs.push_back(abspath);