From: ehofman Date: Mon, 7 Sep 2009 10:19:45 +0000 (+0000) Subject: One last update; remember whether input or output is requested. This will make sure... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1fa48722b4dc037a6e34df60f1c5b400077fc6b1;p=flightgear.git One last update; remember whether input or output is requested. This will make sure FlightGear isn't communicating in both directions all the time. --- diff --git a/src/Network/generic.cxx b/src/Network/generic.cxx index b518a8a32..b1e0c2048 100644 --- a/src/Network/generic.cxx +++ b/src/Network/generic.cxx @@ -62,10 +62,11 @@ FGGeneric::FGGeneric(vector 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); + } } } diff --git a/src/Network/generic.hxx b/src/Network/generic.hxx index efb223867..6df468193 100644 --- a/src/Network/generic.hxx +++ b/src/Network/generic.hxx @@ -73,6 +73,7 @@ protected: private: string file_name; + string direction; int length; char buf[ FG_MAX_MSG_SIZE ];