diff --git a/src/Network/generic.cxx b/src/Network/generic.cxx index c4142ef3f..892b829f9 100644 --- a/src/Network/generic.cxx +++ b/src/Network/generic.cxx @@ -241,11 +241,10 @@ FGGeneric::FGGeneric(vector tokens) : exitOnError(false), initOk(false), string config = tokens[ configToken ]; file_name = config+".xml"; - direction = tokens[2]; + set_direction(tokens[2]); - if (direction != "in" && direction != "out" && direction != "bi") { - SG_LOG(SG_NETWORK, SG_ALERT, "Unsuported protocol direction: " - << direction); + if (get_direction() == SG_IO_NONE) { + SG_LOG(SG_NETWORK, SG_ALERT, "Unsuported protocol direction: " << tokens[2]); return; } @@ -772,7 +771,8 @@ FGGeneric::reinit() return; } - if (direction == "out") { + const auto dir = get_direction(); + if ((dir == SG_IO_OUT) || (dir == SG_IO_BI)) { SGPropertyNode *output = root.getNode("generic/output"); if (output) { _out_message.clear(); @@ -782,7 +782,9 @@ FGGeneric::reinit() return; } } - } else if (direction == "in") { + } + + if ((dir == SG_IO_IN) || (dir == SG_IO_BI)) { SGPropertyNode *input = root.getNode("generic/input"); if (input) { _in_message.clear(); diff --git a/src/Network/generic.hxx b/src/Network/generic.hxx index fbc146d5c..3ae04ebb9 100644 --- a/src/Network/generic.hxx +++ b/src/Network/generic.hxx @@ -76,7 +76,6 @@ protected: private: string file_name; - string direction; int length; char buf[ FG_MAX_MSG_SIZE ];