]> git.mxchange.org Git - flightgear.git/blobdiff - src/Network/generic.cxx
Logging: less verbose panel loading.
[flightgear.git] / src / Network / generic.cxx
index b518a8a327abfa941aee4fd5ba13cce32d241934..eb7911744c900fd5d21ef1ef87566530155d60ea 100644 (file)
@@ -62,10 +62,11 @@ FGGeneric::FGGeneric(vector<string> tokens) : exitOnError(false)
 
     string config = tokens[ configToken ];
     file_name = config+".xml";
+    direction = tokens[2];
 
-    if (tokens[2] != "in" && tokens[2] != "out") {
+    if (direction != "in" && direction != "out") {
         SG_LOG(SG_GENERAL, SG_ALERT, "Unsuported protocol direction: "
-               << tokens[2]);
+               << direction);
     }
 
     reinit();
@@ -377,11 +378,15 @@ bool FGGeneric::parse_message_ascii() {
 
         case FG_FIXED:
         case FG_FLOAT:
-        case FG_DOUBLE:
             val = _in_message[i].offset + strtod(p1, 0) * _in_message[i].factor;
             _in_message[i].prop->setFloatValue((float)val);
             break;
 
+        case FG_DOUBLE:
+            val = _in_message[i].offset + strtod(p1, 0) * _in_message[i].factor;
+            _in_message[i].prop->setDoubleValue(val);
+            break;
+
         default: // SG_STRING
             _in_message[i].prop->setStringValue(p1);
         }
@@ -533,16 +538,18 @@ FGGeneric::reinit()
          return;
     }
 
-    SGPropertyNode *output = root.getNode("generic/output");
-    if (output) {
-        _out_message.clear();
-        read_config(output, _out_message);
-    }
-
-    SGPropertyNode *input = root.getNode("generic/input");
-    if (input) {
-        _in_message.clear();
-        read_config(input, _in_message);
+    if (direction == "out") {
+        SGPropertyNode *output = root.getNode("generic/output");
+        if (output) {
+            _out_message.clear();
+            read_config(output, _out_message);
+        }
+    } else if (direction == "in") {
+        SGPropertyNode *input = root.getNode("generic/input");
+        if (input) {
+            _in_message.clear();
+            read_config(input, _in_message);
+        }
     }
 }