]> git.mxchange.org Git - flightgear.git/commitdiff
Clarify warnings from fgUntie, and fix one source of such warnings, in FGInterface.
authorJames Turner <zakalawe@mac.com>
Thu, 1 Jul 2010 01:04:16 +0000 (02:04 +0100)
committerJames Turner <zakalawe@mac.com>
Thu, 1 Jul 2010 01:04:16 +0000 (02:04 +0100)
src/FDM/flight.cxx
src/Main/fg_props.cxx

index 6b642408963de7d6fd153e06e7d133b2e07b6a45..5676e688b87f00d1b48e1c7e2c81b4ac8b703c61 100644 (file)
@@ -410,6 +410,10 @@ FGInterface::bind ()
 void
 FGInterface::unbind ()
 {
+  if (!bound) {
+    return;
+  }
+  
   bound = false;
 
   fgUntie("/position/latitude-deg");
index 896f713ae9489d932bad80039c9297ff767fcfca..4d944bfc3495e5a054a32e1c495d724716a918a3 100644 (file)
@@ -827,10 +827,21 @@ fgSetWritable (const char * name, bool state)
 }
 
 void
-fgUntie (const char * name)
+fgUntie(const char * name)
 {
-  if (!globals->get_props()->untie(name))
+  SGPropertyNode* node = globals->get_props()->getNode(name);
+  if (!node) {
+    SG_LOG(SG_GENERAL, SG_WARN, "fgUntie: unknown property " << name);
+    return;
+  }
+  
+  if (!node->isTied()) {
+    return;
+  }
+  
+  if (!node->untie()) {
     SG_LOG(SG_GENERAL, SG_WARN, "Failed to untie property " << name);
+  }
 }