]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/gps.cxx
Merge branch 'durk/traffic'
[flightgear.git] / src / Instrumentation / gps.cxx
index 43646cbf0e9e2ab815a49058220fd0d1d3cda8b7..4477dd4eddaf23e5ce1e77b7ad6a0ddfda24694a 100644 (file)
@@ -281,6 +281,7 @@ GPS::Config::setExternalCourse(double aCourseDeg)
 ////////////////////////////////////////////////////////////////////////////
 
 GPS::GPS ( SGPropertyNode *node) : 
+  _selectedCourse(0.0),
   _dataValid(false),
   _lastPosValid(false),
   _mode("init"),
@@ -559,6 +560,9 @@ GPS::update (double delta_time_sec)
   if (_dataValid && (_mode == "init")) {
     // allow a realistic delay in the future, here
     SG_LOG(SG_INSTR, SG_INFO, "GPS initialisation complete");
+    
+    _selectedCourse = _config.getExternalCourse();
+    
     if (_route_active_node->getBoolValue()) {
       // GPS init with active route
       SG_LOG(SG_INSTR, SG_INFO, "GPS init with active route");
@@ -1488,6 +1492,12 @@ void GPS::search()
   string sty(_scratchNode->getStringValue("type"));
   _searchType = FGPositioned::typeFromName(sty);
   _searchQuery = _scratchNode->getStringValue("query");
+  if (_searchQuery.empty()) {
+    SG_LOG(SG_INSTR, SG_WARN, "empty GPS search query");
+    clearScratch();
+    return;
+  }
+  
   _searchExact = _scratchNode->getBoolValue("exact", true);
   _searchOrderByRange = _scratchNode->getBoolValue("order-by-distance", true);
   _searchResultIndex = 0;