]> git.mxchange.org Git - flightgear.git/commitdiff
GPS: enable switching to OBS/DTO mode with no valid scratch - use active waypoint.
authorjmt <jmt>
Sat, 27 Mar 2010 11:37:25 +0000 (11:37 +0000)
committerTim Moore <timoore33@gmail.com>
Sat, 27 Mar 2010 23:33:44 +0000 (00:33 +0100)
src/Instrumentation/gps.cxx

index 4eee22a699f3d4dae411a2d566b08a51e6372595..740c70a38ad40e3f388613531f34bbb16bc3df41 100644 (file)
@@ -1325,21 +1325,18 @@ bool GPS::isScratchPositionValid() const
 
 void GPS::directTo()
 {
-  if (!isScratchPositionValid()) {
-    SG_LOG(SG_INSTR, SG_WARN, "invalid DTO lat/lon");
-    return;
+  _wp0_position = _indicated_pos;
+  
+  if (isScratchPositionValid()) {
+    _wp1Ident = _scratchNode->getStringValue("ident");
+    _wp1Name = _scratchNode->getStringValue("name");
+    _wp1_position = _scratchPos;
   }
   
-  _wp0_position = _indicated_pos;
-  _wp1Ident = _scratchNode->getStringValue("ident");
-  _wp1Name = _scratchNode->getStringValue("name");
-  _wp1_position = _scratchPos;
-
   _mode = "dto";
   _desiredCourse = getLegMagCourse();
   _desiredCourseNode->fireValueChanged();
   clearScratch();
-  
   wp1Changed();
 }
 
@@ -1609,17 +1606,14 @@ void GPS::addAirportToScratch(FGAirport* aAirport)
 
 void GPS::selectOBSMode()
 {
-  if (!isScratchPositionValid()) {
-    SG_LOG(SG_INSTR, SG_WARN, "invalid OBS lat/lon");
-    return;
+  if (isScratchPositionValid()) {
+    _wp1Ident = _scratchNode->getStringValue("ident");
+    _wp1Name = _scratchNode->getStringValue("name");
+    _wp1_position = _scratchPos;
   }
   
   SG_LOG(SG_INSTR, SG_INFO, "GPS switching to OBS mode");
   _mode = "obs";
-  
-  _wp1Ident = _scratchNode->getStringValue("ident");
-  _wp1Name = _scratchNode->getStringValue("name");
-  _wp1_position = _scratchPos;
   _wp0_position = _indicated_pos;
   wp1Changed();
 }