diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index 20c1c2076..97777dcb2 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -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 diff --git a/src/Main/globals.hxx b/src/Main/globals.hxx index b0ecf79de..52ee7deb6 100644 --- a/src/Main/globals.hxx +++ b/src/Main/globals.hxx @@ -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; } diff --git a/src/Scenery/FGTileLoader.cxx b/src/Scenery/FGTileLoader.cxx index bb89d746c..6d247cb92 100644 --- a/src/Scenery/FGTileLoader.cxx +++ b/src/Scenery/FGTileLoader.cxx @@ -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(); }