From 31b9c763dfc38d1905352defaa05d65055cf0689 Mon Sep 17 00:00:00 2001 From: curt Date: Wed, 6 Dec 2000 04:13:16 +0000 Subject: [PATCH] Added a --visibility= option. --- src/Main/fg_init.cxx | 10 ++++++++-- src/Main/options.cxx | 8 ++++++++ src/Main/options.hxx | 5 ++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index dd571f349..70cb8137a 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -622,13 +622,19 @@ bool fgInitSubsystems( void ) { current_aircraft.fdm_state->get_Longitude(), current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER ); FGLocalWeatherDatabase::theFGLocalWeatherDatabase = - new FGLocalWeatherDatabase( position, globals->get_options()->get_fg_root() ); + new FGLocalWeatherDatabase( position, + globals->get_options()->get_fg_root() ); // cout << theFGLocalWeatherDatabase << endl; // cout << "visibility = " // << theFGLocalWeatherDatabase->getWeatherVisibility() << endl; WeatherDatabase = FGLocalWeatherDatabase::theFGLocalWeatherDatabase; - + + double init_vis = globals->get_options()->get_default_visibility(); + if ( init_vis > 0 ) { + WeatherDatabase->setWeatherVisibility( init_vis ); + } + // register the periodic update of the weather global_events.Register( "weather update", fgUpdateWeatherDatabase, fgEVENT::FG_EVENT_READY, 30000); diff --git a/src/Main/options.cxx b/src/Main/options.cxx index 42817c853..ff379206a 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -190,6 +190,7 @@ FGOptions::FGOptions() : bpp(16), view_mode(FG_VIEW_PILOT), default_view_offset(0), + visibility(-1.0), // HUD options units(FG_UNITS_FEET), @@ -943,6 +944,10 @@ int FGOptions::parse_option( const string& arg ) { pilot_view->set_view_offset( default_view_offset ); pilot_view->set_goal_view_offset( default_view_offset ); // $$$ end - added VS Renganathan, 14 Oct 2K + } else if ( arg.find( "--visibility=" ) != string::npos ) { + visibility = atof( arg.substr( 13 ) ); + } else if ( arg.find( "--visibility-miles=" ) != string::npos ) { + visibility = atof( arg.substr( 19 ) ) * 5280.0 * FEET_TO_METER; } else if ( arg.find( "--wp=" ) != string::npos ) { parse_wp( arg.substr( 5 ) ); } else if ( arg.find( "--flight-plan=") != string::npos) { @@ -1180,6 +1185,9 @@ void FGOptions::usage ( void ) { cout << "\t\tas an offset from straight ahead. Allowable values are" << endl; cout << "\t\tLEFT, RIGHT, CENTER, or a specific number of degrees" << endl; + cout << "\t--visibility=xxx: specify initial visibility in meters" << endl; + cout << "\t--visibility-miles=xxx: specify initial visibility in miles" + << endl; cout << endl; cout << "Scenery Options:" << endl; diff --git a/src/Main/options.hxx b/src/Main/options.hxx index 3905a796a..3d1fac291 100644 --- a/src/Main/options.hxx +++ b/src/Main/options.hxx @@ -194,6 +194,7 @@ private: fgViewMode view_mode; // view mode double default_view_offset; // default forward view offset (for use by // multi-display configuration + double visibility; // visibilty in meters // HUD options int units; // feet or meters @@ -296,6 +297,7 @@ public: inline double get_default_view_offset() const { return default_view_offset; } + inline double get_default_visibility() const { return visibility; } inline int get_units() const { return units; } inline int get_tris_or_culled() const { return tris_or_culled; } @@ -393,9 +395,6 @@ private: }; -// extern FGOptions current_options; - - #endif /* _OPTIONS_HXX */ -- 2.39.5