]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/gps.cxx
better use unset() for unsetting ...
[flightgear.git] / src / Instrumentation / gps.cxx
index ae0f3c8101829858f934199dc42ddcf53143482f..aff76facf897f1441b919fa1e6ee8224f00ffa60 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "gps.hxx"
 
-SG_USING_STD(string);
+using std::string;
 
 
 GPS::GPS ( SGPropertyNode *node)
@@ -43,17 +43,20 @@ GPS::GPS ( SGPropertyNode *node)
       _distance_m(0),
       _course_deg(0),
       _name(node->getStringValue("name", "gps")),
-      _num(node->getIntValue("number", 0))
+      _num(node->getIntValue("number", 0)),
+      route(0)
 {
 }
 
 GPS::~GPS ()
 {
+    delete route;
 }
 
 void
 GPS::init ()
 {
+    delete route; // in case init is called twice
     route = new SGRoute;
     route->clear();
 
@@ -308,7 +311,7 @@ GPS::update (double delta_time_sec)
         // If the get-nearest-airport-node is true.
         // Get the nearest airport, and set it as waypoint 1.
         if (_get_nearest_airport_node->getBoolValue()) {
-            const FGAirport* a = globals->get_airports()->search(longitude_deg, latitude_deg, false);
+            const FGAirport* a = globals->get_airports()->search(longitude_deg, latitude_deg);
             if(a) {
                 _wp1_ID_node->setStringValue(a->getId().c_str());
                 wp1_longitude_deg = a->getLongitude();