]> git.mxchange.org Git - flightgear.git/commitdiff
Added support for $FG_SCENERY and --fg-scenery=path
authorcurt <curt>
Fri, 14 Jul 2000 16:57:55 +0000 (16:57 +0000)
committercurt <curt>
Fri, 14 Jul 2000 16:57:55 +0000 (16:57 +0000)
Thanks
src/Main/fg_init.cxx
src/Main/options.cxx
src/Main/options.hxx
src/Scenery/tilecache.cxx

diff --git a/Thanks b/Thanks
index cfb2ff65178c1137c13d402891719f294d7b09c8..c3290a35a3de38c2b8560b928f4a130c8bc756bd 100644 (file)
--- a/Thanks
+++ b/Thanks
@@ -190,6 +190,8 @@ David Megginson <david@megginson.com>
   Updates to README.running.
   Working on getting fgfs and ssg to work without textures.
   Also added the new 2D panel and the save/load support.
+  Property manager
+  Joystick support
 
 
 Eric Mitchell <mitchell@mars.ark.com>
index 3cb462ec2a688ce4d49ef859b19b8d5176d35609..6235493ff4d6d28d6a56d4bc68fabd111263ae84 100644 (file)
@@ -1,4 +1,3 @@
-//
 // fg_init.cxx -- Flight Gear top level initialization routines
 //
 // Written by Curtis Olson, started August 1997.
index d4d9c06edf456a8919527514c7713cd6748c0131..6046cef48d67606413f58109ed0982ed2827dc7d 100644 (file)
@@ -208,7 +208,7 @@ fgOPTIONS::fgOPTIONS() :
        // variable $FG_ROOT if it is set.
        fg_root = envp;
     } else {
-       // Otherwise, default to a random compiled in location if
+       // Otherwise, default to a random compiled-in location if
        // $FG_ROOT is not set.  This can still be overridden from the
        // command line or a config file.
 
@@ -221,6 +221,20 @@ fgOPTIONS::fgOPTIONS() :
 #endif
     }
 
+    // set a possibly independent location for scenery data
+    envp = ::getenv( "FG_SCENERY" );
+
+    if ( envp != NULL ) {
+       // fg_root could be anywhere, so default to environmental
+       // variable $FG_ROOT if it is set.
+       fg_scenery = envp;
+    } else {
+       // Otherwise, default to Scenery being in $FG_ROOT/Scenery
+       FGPath tmp( fg_root );
+       tmp.append( "Scenery" );
+       fg_scenery = tmp.str();
+    }
+
     airport_id = "";           // default airport id
     net_id = "Johnney";                // default pilot's name
 
@@ -675,6 +689,8 @@ int fgOPTIONS::parse_option( const string& arg ) {
        pitch = atof( arg.substr(8) );
     } else if ( arg.find( "--fg-root=" ) != string::npos ) {
        fg_root = arg.substr( 10 );
+    } else if ( arg.find( "--fg-scenery=" ) != string::npos ) {
+       fg_scenery = arg.substr( 13 );
     } else if ( arg.find( "--fdm=" ) != string::npos ) {
        flight_model = parse_fdm( arg.substr(6) );
     if((flight_model == FGInterface::FG_JSBSIM) && (get_trim_mode() == 0)) {
@@ -908,6 +924,9 @@ void fgOPTIONS::usage ( void ) {
     cout << "\t--help -h:  print usage" << endl;
     cout << "\t--fg-root=path:  specify the root path for all the data files"
         << endl;
+    cout << "\t--fg-scenery=path:  specify the base path for all the scenery"
+        << " data." << endl
+        << "\t\tdefaults to $FG_ROOT/Scenery" << endl;
     cout << "\t--disable-game-mode:  disable full-screen game mode" << endl;
     cout << "\t--enable-game-mode:  enable full-screen game mode" << endl;
     cout << "\t--disable-splash-screen:  disable splash screen" << endl;
index 09e2d87b5056377e02dd03758509e454e88d2524..3f931baf6b4e95188c465792052aac719c5ba6c0 100644 (file)
@@ -128,6 +128,9 @@ private:
     // The flight gear "root" directory
     string fg_root;
 
+    // The scenery "root" directory
+    string fg_scenery;
+
     // Starting position and orientation
     string airport_id;  // ID of initial starting airport
     double lon;         // starting longitude in degrees (west = -)
@@ -224,6 +227,7 @@ public:
 
     // Query functions
     inline string get_fg_root() const { return fg_root; }
+    inline string get_fg_scenery() const { return fg_scenery; }
     inline string get_airport_id() const { return airport_id; }
     inline double get_lon() const { return lon; }
     inline double get_lat() const { return lat; }
@@ -294,6 +298,7 @@ public:
 
     // Update functions
     inline void set_fg_root (const string value) { fg_root = value; }
+    inline void set_fg_scenery (const string value) { fg_scenery = value; }
     inline void set_airport_id( const string id ) { airport_id = id; }
     inline void set_lon (double value) { lon = value; }
     inline void set_lat (double value) { lat = value; }
index ba07fa29d3225dc471ef0c026d3bcf1607250145..c6c742058337b6427203b11e2154761af50c2847 100644 (file)
@@ -169,8 +169,7 @@ FGTileCache::fill_in( int index, const FGBucket& p )
     tile_cache[index].range_ptr = new ssgRangeSelector;
     tile_cache[index].tile_bucket = p;
 
-    FGPath tile_path( current_options.get_fg_root() );
-    tile_path.append( "Scenery" );
+    FGPath tile_path( current_options.get_fg_scenery() );
     tile_path.append( p.gen_base_path() );
     
     // Load the appropriate data file