]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/options.cxx
Crash-fix: mat-lib is now reference-counted.
[flightgear.git] / src / Main / options.cxx
index cbc1c2fecb4b6da2d147127802f01df612d9c37e..3c20cdee8a8154d97cdeab7822e9feaa46bf50eb 100644 (file)
 #include <simgear/sound/soundmgr_openal.hxx>
 #include <simgear/misc/strutils.hxx>
 #include <Autopilot/route_mgr.hxx>
+
 #include <GUI/gui.h>
+#include <GUI/MessageBox.hxx>
 
+#include <Main/locale.hxx>
 #include "globals.hxx"
 #include "fg_init.hxx"
 #include "fg_props.hxx"
@@ -62,6 +65,7 @@
 #include <Viewer/viewer.hxx>
 #include <Viewer/viewmgr.hxx>
 #include <Environment/presets.hxx>
+#include "AircraftDirVisitorBase.hxx"
 
 #include <osg/Version>
 
 #  include <Include/no_version.h>
 #endif
 
-#ifdef __APPLE__
-#  include <CoreFoundation/CoreFoundation.h>
-#endif
-
 using std::string;
 using std::sort;
 using std::cout;
@@ -84,19 +84,9 @@ using std::endl;
 using std::vector;
 using std::cin;
 
-#define NEW_DEFAULT_MODEL_HZ 120
+using namespace flightgear;
 
-enum
-{
-    FG_OPTIONS_OK = 0,
-    FG_OPTIONS_HELP = 1,
-    FG_OPTIONS_ERROR = 2,
-    FG_OPTIONS_EXIT = 3,
-    FG_OPTIONS_VERBOSE_HELP = 4,
-    FG_OPTIONS_SHOW_AIRCRAFT = 5,
-    FG_OPTIONS_SHOW_SOUND_DEVICES = 6,
-    FG_OPTIONS_NO_DEFAULT_CONFIG = 7
-};
+#define NEW_DEFAULT_MODEL_HZ 120
 
 static flightgear::Options* shared_instance = NULL;
 
@@ -121,8 +111,7 @@ static int fgSetupProxy( const char *arg );
  * in case, we provide some initial sane values here. This method
  * should be invoked *before* reading any init files.
  */
-static void
-fgSetDefaults ()
+void fgSetDefaults ()
 {
 
                                // Position (deliberately out of range)
@@ -168,9 +157,7 @@ fgSetDefaults ()
     fgSetBool("/sim/presets/trim", false);
 
                                // Miscellaneous
-    fgSetBool("/sim/startup/game-mode", false);
     fgSetBool("/sim/startup/splash-screen", true);
-    fgSetBool("/sim/startup/intro-music", true);
     // we want mouse-pointer to have an undefined value if nothing is
     // specified so we can do the right thing for voodoo-1/2 cards.
     // fgSetString("/sim/startup/mouse-pointer", "disabled");
@@ -185,6 +172,7 @@ fgSetDefaults ()
     fgSetBool("/sim/panel/visibility", true);
     fgSetBool("/sim/sound/enabled", true);
     fgSetBool("/sim/sound/working", true);
+    fgSetBool("/sim/fgcom/enabled", false);
 
                                // Flight Model options
     fgSetString("/sim/flight-model", "jsb");
@@ -197,7 +185,6 @@ fgSetDefaults ()
     fgSetBool("/environment/clouds/status", true);
     fgSetBool("/sim/startup/fullscreen", false);
     fgSetBool("/sim/rendering/shading", true);
-    fgSetBool("/sim/rendering/skyblend", true);
     fgSetBool("/sim/rendering/textures", true);
     fgTie( "/sim/rendering/filtering", SGGetTextureFilter, SGSetTextureFilter, false);
     fgSetInt("/sim/rendering/filtering", 1);
@@ -207,9 +194,9 @@ fgSetDefaults ()
     fgSetBool("/sim/rendering/distance-attenuation", false);
     fgSetBool("/sim/rendering/specular-highlight", true);
     fgSetString("/sim/rendering/materials-file", "materials.xml");
-    fgSetInt("/sim/startup/xsize", 800);
-    fgSetInt("/sim/startup/ysize", 600);
-    fgSetInt("/sim/rendering/bits-per-pixel", 16);
+    fgSetInt("/sim/startup/xsize", 1024);
+    fgSetInt("/sim/startup/ysize", 768);
+    fgSetInt("/sim/rendering/bits-per-pixel", 32);
     fgSetString("/sim/view-mode", "pilot");
     fgSetDouble("/sim/current-view/heading-offset-deg", 0);
 
@@ -234,18 +221,145 @@ fgSetDefaults ()
     fgSetInt("/sim/multiplay/rxport", 0);
     fgSetInt("/sim/multiplay/txport", 0);
     
-    fgSetString("/sim/version/flightgear", FLIGHTGEAR_VERSION);
-    fgSetString("/sim/version/simgear", SG_STRINGIZE(SIMGEAR_VERSION));
-    fgSetString("/sim/version/openscenegraph", osgGetVersion());
-    fgSetString("/sim/version/revision", REVISION);
-    fgSetInt("/sim/version/build-number", HUDSON_BUILD_NUMBER);
-    fgSetString("/sim/version/build-id", HUDSON_BUILD_ID);
-  
-  char* envp = ::getenv( "http_proxy" );
+    SGPropertyNode* v = globals->get_props()->getNode("/sim/version", true);
+    v->setValueReadOnly("flightgear", FLIGHTGEAR_VERSION);
+    v->setValueReadOnly("simgear", SG_STRINGIZE(SIMGEAR_VERSION));
+    v->setValueReadOnly("openscenegraph", osgGetVersion());
+    v->setValueReadOnly("openscenegraph-thread-safe-reference-counting",
+                         osg::Referenced::getThreadSafeReferenceCounting());
+    v->setValueReadOnly("revision", REVISION);
+    v->setValueReadOnly("build-number", HUDSON_BUILD_NUMBER);
+    v->setValueReadOnly("build-id", HUDSON_BUILD_ID);
+    v->setValueReadOnly("hla-support", bool(FG_HAVE_HLA));
+
+    char* envp = ::getenv( "http_proxy" );
     if( envp != NULL )
       fgSetupProxy( envp );
 }
 
+///////////////////////////////////////////////////////////////////////////////
+// helper object to implement the --show-aircraft command.
+// resides here so we can share the fgFindAircraftInDir template above,
+// and hence ensure this command lists exectly the same aircraft as the normal
+// loading path.
+class ShowAircraft : public AircraftDirVistorBase
+{
+public:
+    ShowAircraft()
+    {
+        _minStatus = getNumMaturity(fgGetString("/sim/aircraft-min-status", "all"));
+    }
+    
+    
+    void show(const SGPath& path)
+    {
+        visitDir(path, 0);
+        
+        simgear::requestConsole(); // ensure console is shown on Windows
+        
+        std::sort(_aircraft.begin(), _aircraft.end(), ciLessLibC());
+        cout << "Available aircraft:" << endl;
+        for ( unsigned int i = 0; i < _aircraft.size(); i++ ) {
+            cout << _aircraft[i] << endl;
+        }
+    }
+    
+private:
+    virtual VisitResult visit(const SGPath& path)
+    {
+        SGPropertyNode root;
+        try {
+            readProperties(path.str(), &root);
+        } catch (sg_exception& ) {
+            return VISIT_CONTINUE;
+        }
+        
+        int maturity = 0;
+        string descStr("   ");
+        descStr += path.file();
+        // trim common suffix from file names
+        int nPos = descStr.rfind("-set.xml");
+        if (nPos == (int)(descStr.size() - 8)) {
+            descStr.resize(nPos);
+        }
+        
+        SGPropertyNode *node = root.getNode("sim");
+        if (node) {
+            SGPropertyNode* desc = node->getNode("description");
+            // if a status tag is found, read it in
+            if (node->hasValue("status")) {
+                maturity = getNumMaturity(node->getStringValue("status"));
+            }
+            
+            if (desc) {
+                if (descStr.size() <= 27+3) {
+                    descStr.append(29+3-descStr.size(), ' ');
+                } else {
+                    descStr += '\n';
+                    descStr.append( 32, ' ');
+                }
+                descStr += desc->getStringValue();
+            }
+        } // of have 'sim' node
+        
+        if (maturity >= _minStatus) {
+            _aircraft.push_back(descStr);
+        }
+        
+        return VISIT_CONTINUE;
+    }
+    
+    
+    int getNumMaturity(const char * str)
+    {
+        // changes should also be reflected in $FG_ROOT/data/options.xml &
+        // $FG_ROOT/data/Translations/string-default.xml
+        const char* levels[] = {"alpha","beta","early-production","production"};
+        
+        if (!strcmp(str, "all")) {
+            return 0;
+        }
+        
+        for (size_t i=0; i<(sizeof(levels)/sizeof(levels[0]));i++)
+            if (strcmp(str,levels[i])==0)
+                return i;
+        
+        return 0;
+    }
+    
+    // recommended in Meyers, Effective STL when internationalization and embedded
+    // NULLs aren't an issue.  Much faster than the STL or Boost lex versions.
+    struct ciLessLibC : public std::binary_function<string, string, bool>
+    {
+        bool operator()(const std::string &lhs, const std::string &rhs) const
+        {
+            return strcasecmp(lhs.c_str(), rhs.c_str()) < 0 ? 1 : 0;
+        }
+    };
+    
+    int _minStatus;
+    string_list _aircraft;
+};
+
+/*
+ * Search in the current directory, and in on directory deeper
+ * for <aircraft>-set.xml configuration files and show the aircaft name
+ * and the contents of the<description> tag in a sorted manner.
+ *
+ * @parampath the directory to search for configuration files
+ */
+void fgShowAircraft(const SGPath &path)
+{
+    ShowAircraft s;
+    s.show(path);
+    
+#ifdef _MSC_VER
+    cout << "Hit a key to continue..." << endl;
+    std::cin.get();
+#endif
+}
+
+
 static bool
 parse_wind (const string &wind, double * min_hdg, double * max_hdg,
            double * speed, double * gust)
@@ -1010,12 +1124,12 @@ fgOptConfig( const char *arg )
 {
     string file = arg;
     try {
-       readProperties(file, globals->get_props());
+        readProperties(file, globals->get_props());
     } catch (const sg_exception &e) {
-       string message = "Error loading config file: ";
-       message += e.getFormattedMessage() + e.getOrigin();
-       SG_LOG(SG_INPUT, SG_ALERT, message);
-       exit(2);
+        string message = "Error loading config file: ";
+        message += e.getFormattedMessage() + e.getOrigin();
+        SG_LOG(SG_INPUT, SG_ALERT, message);
+        return FG_OPTIONS_ERROR;
     }
     return FG_OPTIONS_OK;
 }
@@ -1211,6 +1325,14 @@ fgOptCallSign(const char * arg)
     return FG_OPTIONS_OK;
 }
 
+static int
+fgOptIgnoreAutosave(const char* arg)
+{
+    fgSetBool("/sim/startup/ignore-autosave", true);
+    // don't overwrite autosave on exit
+    fgSetBool("/sim/startup/save-on-exit", false);
+    return FG_OPTIONS_OK;
+}
 
 // Set a property for the --prop: option. Syntax: --prop:[<type>:]<name>=<value>
 // <type> can be "double" etc. but also only the first letter "d".
@@ -1302,15 +1424,12 @@ struct OptionDesc {
     } fgOptionArray[] = {
 
     {"language",                     true,  OPTION_IGNORE, "", false, "", 0 },
+       {"console",                      false, OPTION_IGNORE,   "", false, "", 0 },
     {"disable-rembrandt",            false, OPTION_BOOL,   "/sim/rendering/rembrandt/enabled", false, "", 0 },
     {"enable-rembrandt",             false, OPTION_BOOL,   "/sim/rendering/rembrandt/enabled", true, "", 0 },
     {"renderer",                     true,  OPTION_STRING, "/sim/rendering/rembrandt/renderer", false, "", 0 },
-    {"disable-game-mode",            false, OPTION_BOOL,   "/sim/startup/game-mode", false, "", 0 },
-    {"enable-game-mode",             false, OPTION_BOOL,   "/sim/startup/game-mode", true, "", 0 },
     {"disable-splash-screen",        false, OPTION_BOOL,   "/sim/startup/splash-screen", false, "", 0 },
     {"enable-splash-screen",         false, OPTION_BOOL,   "/sim/startup/splash-screen", true, "", 0 },
-    {"disable-intro-music",          false, OPTION_BOOL,   "/sim/startup/intro-music", false, "", 0 },
-    {"enable-intro-music",           false, OPTION_BOOL,   "/sim/startup/intro-music", true, "", 0 },
     {"disable-mouse-pointer",        false, OPTION_STRING, "/sim/startup/mouse-pointer", false, "disabled", 0 },
     {"enable-mouse-pointer",         false, OPTION_STRING, "/sim/startup/mouse-pointer", false, "enabled", 0 },
     {"disable-random-objects",       false, OPTION_BOOL,   "/sim/rendering/random-objects", false, "", 0 },
@@ -1408,11 +1527,11 @@ struct OptionDesc {
     {"enable-fullscreen",            false, OPTION_BOOL,   "/sim/startup/fullscreen", true, "", 0 },
     {"disable-save-on-exit",         false, OPTION_BOOL,   "/sim/startup/save-on-exit", false, "", 0 },
     {"enable-save-on-exit",          false, OPTION_BOOL,   "/sim/startup/save-on-exit", true, "", 0 },
+    {"read-only",                    false, OPTION_BOOL,   "/sim/fghome-readonly", true, "", 0 },
+    {"ignore-autosave",              false, OPTION_FUNC,   "", false, "", fgOptIgnoreAutosave },
     {"restore-defaults",             false, OPTION_BOOL,   "/sim/startup/restore-defaults", true, "", 0 },
     {"shading-flat",                 false, OPTION_BOOL,   "/sim/rendering/shading", false, "", 0 },
     {"shading-smooth",               false, OPTION_BOOL,   "/sim/rendering/shading", true, "", 0 },
-    {"disable-skyblend",             false, OPTION_BOOL,   "/sim/rendering/skyblend", false, "", 0 },
-    {"enable-skyblend",              false, OPTION_BOOL,   "/sim/rendering/skyblend", true, "", 0 },
     {"disable-textures",             false, OPTION_BOOL,   "/sim/rendering/textures", false, "", 0 },
     {"enable-textures",              false, OPTION_BOOL,   "/sim/rendering/textures", true, "", 0 },
     {"texture-filtering",            false, OPTION_INT,    "/sim/rendering/filtering", 1, "", 0 },
@@ -1452,6 +1571,7 @@ struct OptionDesc {
     {"AV400WSimA",                   true,  OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 },
     {"AV400WSimB",                   true,  OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 },
     {"garmin",                       true,  OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 },
+    {"igc",                          true,  OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 },
     {"nmea",                         true,  OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 },
     {"generic",                      true,  OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 },
     {"props",                        true,  OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 },
@@ -1464,7 +1584,7 @@ struct OptionDesc {
     {"proxy",                        true,  OPTION_FUNC,    "", false, "", fgSetupProxy },
     {"callsign",                     true,  OPTION_FUNC,    "", false, "", fgOptCallSign},
     {"multiplay",                    true,  OPTION_CHANNEL | OPTION_MULTI, "", false, "", 0 },
-#ifdef FG_HAVE_HLA
+#if FG_HAVE_HLA
     {"hla",                          true,  OPTION_CHANNEL, "", false, "", 0 },
     {"hla-local",                    true,  OPTION_CHANNEL, "", false, "", 0 },
 #endif
@@ -1485,6 +1605,10 @@ struct OptionDesc {
     {"aircraft",                     true,  OPTION_STRING, "/sim/aircraft", false, "", 0 },
     {"vehicle",                      true,  OPTION_STRING, "/sim/aircraft", false, "", 0 },
     {"failure",                      true,  OPTION_FUNC | OPTION_MULTI,   "", false, "", fgOptFailure },
+#ifdef ENABLE_IAX
+    {"enable-fgcom",                 false, OPTION_BOOL,   "/sim/fgcom/enabled", true, "", 0 },
+    {"disable-fgcom",                false, OPTION_BOOL,   "/sim/fgcom/enabled", false, "", 0 },
+#endif
     {"com1",                         true,  OPTION_DOUBLE, "/instrumentation/comm[0]/frequencies/selected-mhz", false, "", 0 },
     {"com2",                         true,  OPTION_DOUBLE, "/instrumentation/comm[1]/frequencies/selected-mhz", false, "", 0 },
     {"nav1",                         true,  OPTION_FUNC,   "", false, "", fgOptNAV1 },
@@ -1696,8 +1820,6 @@ Options::~Options()
   
 void Options::init(int argc, char **argv, const SGPath& appDataPath)
 {
-  fgSetDefaults();
-  
 // first, process the command line
   bool inOptions = true;
   for (int i=1; i<argc; ++i) {
@@ -1765,7 +1887,7 @@ void Options::init(int argc, char **argv, const SGPath& appDataPath)
   setupRoot();
   
 // system.fgfsrc handling
-  if( hostname.size() > 0 ) {
+  if( ! hostname.empty() ) {
     config.set(globals->get_fg_root());
     config.append( "system.fgfsrc" );
     config.concat( "." );
@@ -1803,6 +1925,10 @@ void Options::initAircraft()
     SG_LOG(SG_INPUT, SG_INFO, "No user specified aircraft, using default" );
   }
   
+// persist across reset
+  SGPropertyNode* aircraftProp = fgGetNode("/sim/aircraft", true);
+  aircraftProp->setAttribute(SGPropertyNode::PRESERVE, true);
+    
   if (p->showAircraft) {
     fgOptLogLevel( "alert" );
     SGPath path( globals->get_fg_root() );
@@ -1887,6 +2013,9 @@ int Options::parseOption(const string& s)
   } else if ( (s == "--verbose") || (s == "-v") ) {
     // verbose help/usage request
     return FG_OPTIONS_VERBOSE_HELP;
+  } else if ((s == "--console") || (s == "-c")) {
+         simgear::requestConsole();
+         return FG_OPTIONS_OK;
   } else if (s.find("-psn") == 0) {
     // on Mac, when launched from the GUI, we are passed the ProcessSerialNumber
     // as an argument (and no others). Silently ignore the argument here.
@@ -1977,7 +2106,7 @@ string_list Options::valuesForOption(const std::string& key) const
   return result;
 }
 
-void Options::processOptions()
+OptionResult Options::processOptions()
 {
   // establish locale before showing help (this selects the default locale,
   // when no explicit option was set)
@@ -1987,7 +2116,7 @@ void Options::processOptions()
   // out quickly, but rely on aircraft / root settings
   if (p->showHelp) {
     showUsage();
-    exit(0);
+      return FG_OPTIONS_EXIT;
   }
   
   // processing order is complicated. We must process groups LIFO, but the
@@ -2007,9 +2136,11 @@ void Options::processOptions()
       {
           case FG_OPTIONS_ERROR:
               showUsage();
-              exit(-1); // exit and return an error
+              return FG_OPTIONS_ERROR;
+              
           case FG_OPTIONS_EXIT:
-              exit(0);  // clean exit
+              return FG_OPTIONS_EXIT;
+              
           default:
               break;
       }
@@ -2036,22 +2167,30 @@ void Options::processOptions()
   }
     
 // terrasync directory fixup
+  string terrasyncDir = fgGetString("/sim/terrasync/scenery-dir");
+  if (terrasyncDir.empty()) {
+    SGPath p(globals->get_fg_home());
+    p.append("TerraSync");
+    terrasyncDir = p.str();
+    SG_LOG(SG_GENERAL, SG_INFO,
+           "Using default TerraSync dir: " << terrasyncDir);
+    fgSetString("/sim/terrasync/scenery-dir", terrasyncDir);
+  }
+  
+  SGPath p(terrasyncDir);
+  // following is necessary to ensure NavDataCache sees stable scenery paths from
+  // terrasync. Ensure the Terrain and Objects subdirs exist immediately, rather
+  // than waiting for the first tiles to be scheduled.
+  simgear::Dir terrainDir(SGPath(p, "Terrain")),
+    objectsDir(SGPath(p, "Objects"));
+  if (!terrainDir.exists()) {
+      terrainDir.create(0755);
+  }
+  
+  if (!objectsDir.exists()) {
+      objectsDir.create(0755);
+  }
   if (fgGetBool("/sim/terrasync/enabled")) {
-    string terrasyncDir = fgGetString("/sim/terrasync/scenery-dir");
-    if (terrasyncDir.empty()) {
-      SGPath p(globals->get_fg_home());
-      p.append("TerraSync");
-      if (!p.exists()) {
-        simgear::Dir dd(p);
-        dd.create(0700);
-      }
-      
-      terrasyncDir = p.str();
-      SG_LOG(SG_GENERAL, SG_INFO,
-             "Using default TerraSync dir: " << terrasyncDir);
-      fgSetString("/sim/terrasync/scenery-dir", terrasyncDir);
-    }
-    
     const string_list& scenery_paths(globals->get_fg_scenery());
     if (std::find(scenery_paths.begin(), scenery_paths.end(), terrasyncDir) == scenery_paths.end()) {
       // terrasync dir is not in the scenery paths, add it
@@ -2065,6 +2204,8 @@ void Options::processOptions()
     root.append("Scenery");
     globals->append_fg_scenery(root.str());
   }
+    
+  return FG_OPTIONS_OK;
 }
   
 void Options::showUsage() const
@@ -2074,7 +2215,7 @@ void Options::showUsage() const
   FGLocale *locale = globals->get_locale();
   SGPropertyNode options_root;
   
-  SG_LOG( SG_GENERAL, SG_ALERT, "" ); // To popup the console on Windows
+  simgear::requestConsole(); // ensure console is shown on Windows
   cout << endl;
 
   try {
@@ -2149,7 +2290,7 @@ void Options::showUsage() const
         
         vector<SGPropertyNode_ptr> desc;
         desc = option[k]->getChildren("description");
-        if (desc.size() > 0) {
+        if (! desc.empty()) {
           for ( unsigned int l = 0; l < desc.size(); l++) {
             string t = desc[l]->getStringValue();
 
@@ -2205,33 +2346,13 @@ string Options::platformDefaultRoot() const
   return "../data";
 }
 
-#elif defined(_WIN32)
+#elif defined(SG_WINDOWS)
 string Options::platformDefaultRoot() const
 {
   return "..\\data";
 }
-#elif defined(__APPLE__)
-string Options::platformDefaultRoot() const
-{
-  /*
-   The following code looks for the base package inside the application 
-   bundle, in the standard Contents/Resources location. 
-   */
-  CFURLRef resourcesUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
-  
-  // look for a 'data' subdir
-  CFURLRef dataDir = CFURLCreateCopyAppendingPathComponent(NULL, resourcesUrl, CFSTR("data"), true);
-  
-  // now convert down to a path, and the a c-string
-  CFStringRef path = CFURLCopyFileSystemPath(dataDir, kCFURLPOSIXPathStyle);
-  string root = CFStringGetCStringPtr(path, CFStringGetSystemEncoding());
-  
-  CFRelease(resourcesUrl);
-  CFRelease(dataDir);
-  CFRelease(path);
-  
-  return root;
-}
+#elif defined(SG_MAC)
+// platformDefaultRoot defined in CocoaHelpers.mm
 #else
 string Options::platformDefaultRoot() const
 {
@@ -2260,20 +2381,23 @@ void Options::setupRoot()
 // validate it
   static char required_version[] = FLIGHTGEAR_VERSION;
   string base_version = fgBasePackageVersion();
-  if ( !(base_version == required_version) ) {
-    // tell the operator how to use this application
+    if (base_version.empty()) {
+        flightgear::fatalMessageBox("Base package not found",
+                                    "Required data files not found, check your installation.",
+                                    "Looking for base-package files at: '" + root + "'");
+
+        exit(-1);
+    }
     
-    SG_LOG( SG_GENERAL, SG_ALERT, "" ); // To popup the console on windows
-    cerr << endl << "Base package check failed:" << endl \
-    << "  Version " << base_version << " found at: " \
-    << globals->get_fg_root() << endl \
-    << "  Version " << required_version << " is required." << endl \
-    << "Please upgrade/downgrade base package and set the path to your fgdata" << endl \
-    << "with --fg-root=path_to_your_fgdata" << endl;
-#ifdef _MSC_VER
-    cerr << "Hit a key to continue..." << endl;
-    cin.get();
-#endif
+ if (base_version != required_version) {
+    // tell the operator how to use this application
+   
+      flightgear::fatalMessageBox("Base package version mismatch",
+                                  "Version check failed: please check your installation.",
+                                  "Found data files for version '" + base_version +
+                                  "' at '" + globals->get_fg_root() + "', version '"
+                                  + required_version + "' is required.");
+
     exit(-1);
   }
 }