]> git.mxchange.org Git - flightgear.git/commitdiff
Make use of the new SGPath::add() function and automatically append 'Terren' and...
authorehofman <ehofman>
Mon, 7 Jun 2004 09:52:11 +0000 (09:52 +0000)
committerehofman <ehofman>
Mon, 7 Jun 2004 09:52:11 +0000 (09:52 +0000)
src/Main/globals.cxx
src/Main/globals.hxx
src/Scenery/FGTileLoader.cxx

index 20c1c20768bc55181bcba5c3a3a2023107817098..97777dcb27ef5a46983506df99492fa13e40f57d 100644 (file)
@@ -117,6 +117,38 @@ void FGGlobals::set_fg_root (const string &root) {
         }
 }
 
+void FGGlobals::set_fg_scenery (const string &scenery) {
+
+    if (scenery.empty())
+        return;
+
+    SGPath pt( scenery ), po( scenery );
+    pt.append("Terrain");
+    po.append("Objects");
+
+cout << "pt: " << pt.str() << endl;
+cout << "po: " << po.str() << endl;
+    ulDir *td = ulOpenDir(pt.c_str());
+    ulDir *od = ulOpenDir(po.c_str());
+
+    if (td == NULL) {
+        if (od == NULL) {
+            fg_scenery = scenery;
+        } else {
+            fg_scenery = po.str();
+            ulCloseDir(od);
+        }
+    } else {
+        if (od != NULL) {
+            pt.add(po.str());
+            ulCloseDir(od);
+        }
+        fg_scenery = pt.str();
+        ulCloseDir(td);
+    }
+cout << "fg_scenery: " << fg_scenery << endl;
+}
+
 
 SGSubsystemMgr *
 FGGlobals::get_subsystem_mgr () const
index b0ecf79de6ed71d29c6315a2cdd82e575874ee4c..52ee7deb6720cd6e73413b2d81ea69156bb41069 100644 (file)
@@ -237,9 +237,7 @@ public:
     void set_fg_root (const string &root);
 
     inline const string &get_fg_scenery () const { return fg_scenery; }
-    inline void set_fg_scenery (const string &scenery) {
-      fg_scenery = scenery;
-    }
+    void set_fg_scenery (const string &scenery);
 
 #if defined(FX) && defined(XMESA)
     inline bool get_fullscreen() const { return fullscreen; }
index bb89d746cccc889ee10c6f715519b5d8d9646551..6d247cb920a6851c434d538c5c537e7861646ae3 100644 (file)
@@ -99,12 +99,7 @@ FGTileLoader::add( FGTileEntry* tile )
             SGPath tmp;
            tmp.set( globals->get_fg_root() );
             tmp.append( "Scenery/Terrain" );
-#ifdef _MSC_VER
-            tmp.append( ";");
-#else
-            tmp.append( ":");
-#endif
-            tmp.append(globals->get_fg_root() );
+            tmp.add(globals->get_fg_root() );
             tmp.append( "Scenery/Objects" );
             tile_path = tmp.str();
        }