]> git.mxchange.org Git - flightgear.git/commitdiff
One last update; remember whether input or output is requested. This will make sure...
authorehofman <ehofman>
Mon, 7 Sep 2009 10:19:45 +0000 (10:19 +0000)
committerTim Moore <timoore@redhat.com>
Wed, 9 Sep 2009 06:56:31 +0000 (08:56 +0200)
src/Network/generic.cxx
src/Network/generic.hxx

index b518a8a327abfa941aee4fd5ba13cce32d241934..b1e0c204832f2bfa71df9a4e48b74bc4417491d3 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();
@@ -533,16 +534,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);
+        }
     }
 }
 
index efb223867b781b2db3e288ab8782884aee82a69c..6df4681935808896c219f7c22e0d01bd685800d6 100644 (file)
@@ -73,6 +73,7 @@ protected:
 private:
 
     string file_name;
+    string direction;
 
     int length;
     char buf[ FG_MAX_MSG_SIZE ];